broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return {k:-v for k,v in x.items()}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed signs', solve({'a': 2, 'b': 0, 'c': -1}), {'c': 1})
check('positive omitted', solve({'a': 2}), {})
check('negative becomes positive', solve({'a': -2}), {'a': 2})
check('empty', 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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return {k:abs(v) for k,v in x.items() if v!=0}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('mixed signs', solve({'a': 2, 'b': 0, 'c': -1}), {'c': 1})
check('positive omitted', solve({'a': 2}), {})
check('negative becomes positive', solve({'a': -2}), {'a': 2})
check('empty', 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:
The operation returns a result or retained state that violates this contract: Unary minus returns positive magnitudes of negative counts only.

Unary minus returns positive magnitudes of negative counts only. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return {k:min(v,y.get(k,0)) for k,v in x.items()}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('counts matter', solve({'a': 3, 'b': 1}, {'a': 2, 'c': 1}), {'a': 2})
check('nonpositive omitted', solve({'a': -1}, {'a': 2}), {})
check('empty right', solve({'a': 1}, {}), {})
check('empty both', 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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return {k:1 for k in x if k in y}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('counts matter', solve({'a': 3, 'b': 1}, {'a': 2, 'c': 1}), {'a': 2})
check('nonpositive omitted', solve({'a': -1}, {'a': 2}), {})
check('empty right', solve({'a': 1}, {}), {})
check('empty both', 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:
The operation returns a result or retained state that violates this contract: Counter intersection takes the minimum count for shared members and drops nonpositive results.

Counter intersection takes the minimum count for shared members and drops nonpositive results. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return dict(Counter(x)+Counter(y))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('maximum instead of sum or overwrite', solve({'a': 3, 'b': 1}, {'a': 2, 'c': 2}), {'a': 3, 'b': 1, 'c': 2})
check('negative maxima omitted', solve({'a': -1}, {'a': -2}), {})
check('zero omitted', solve({'a': 0}, {}), {})
check('empty', 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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=dict(x); a.update(y); return a
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('maximum instead of sum or overwrite', solve({'a': 3, 'b': 1}, {'a': 2, 'c': 2}), {'a': 3, 'b': 1, 'c': 2})
check('negative maxima omitted', solve({'a': -1}, {'a': -2}), {})
check('zero omitted', solve({'a': 0}, {}), {})
check('empty', 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:
The operation returns a result or retained state that violates this contract: Counter union takes the maximum count for each member, retaining only positive maxima.

Counter union takes the maximum count for each member, retaining only positive maxima. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return len(list(Counter(x).elements()))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative offsets positive', solve({'a': 3, 'b': -2, 'c': 0}), 1)
check('negative total', solve({'a': -3}), -3)
check('one member multiple count', solve({'a': 4}), 4)
check('empty', solve({}), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return len(x)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('negative offsets positive', solve({'a': 3, 'b': -2, 'c': 0}), 1)
check('negative total', solve({'a': -3}), -3)
check('one member multiple count', solve({'a': 4}), 4)
check('empty', solve({}), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: The total sums all signed counts, including negative entries rather than counting expanded positive elements.

The total sums all signed counts, including negative entries rather than counting expanded positive elements. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return ChainMap(*reversed(x)).get(y,"missing")
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inner shadows outer', solve([{'a': 'inner'}, {'a': 'outer'}], 'a'), 'inner')
check('None shadows outer', solve([{'a': None}, {'a': 'outer'}], 'a'), None)
check('fallback scope', solve([{}, {'a': 'outer'}], 'a'), 'outer')
check('absent', solve([{}, {}], 'a'), 'missing')
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return next((scope[y] for scope in x if scope.get(y)),"missing")
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('inner shadows outer', solve([{'a': 'inner'}, {'a': 'outer'}], 'a'), 'inner')
check('None shadows outer', solve([{'a': None}, {'a': 'outer'}], 'a'), None)
check('fallback scope', solve([{}, {'a': 'outer'}], 'a'), 'outer')
check('absent', solve([{}, {}], 'a'), 'missing')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Look up the key in the first containing scope, retaining falsy values; return missing only when no scope contains it.

Look up the key in the first containing scope, retaining falsy values; return missing only when no scope contains it. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[dict(m) for m in x]; next((m for m in a if y[0] in m),a[0])[y[0]]=y[1]; return a
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shadow outer binding', solve([{}, {'a': 1}], ['a', 2]), [{'a': 2}, {'a': 1}])
check('new key belongs inner', solve([{}, {}], ['a', 1]), [{'a': 1}, {}])
check('replace inner', solve([{'a': 1}, {'a': 3}], ['a', 2]), [{'a': 2}, {'a': 3}])
check('one scope', solve([{}], ['a', 1]), [{'a': 1}])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[dict(m) for m in x]; a[-1][y[0]]=y[1]; return a
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('shadow outer binding', solve([{}, {'a': 1}], ['a', 2]), [{'a': 2}, {'a': 1}])
check('new key belongs inner', solve([{}, {}], ['a', 1]), [{'a': 1}, {}])
check('replace inner', solve([{'a': 1}, {'a': 3}], ['a', 2]), [{'a': 2}, {'a': 3}])
check('one scope', solve([{}], ['a', 1]), [{'a': 1}])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Assignment always writes the first scope, even when the key exists only in an outer scope; return all scopes.

Assignment always writes the first scope, even when the key exists only in an outer scope; return all scopes. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[dict(m) for m in x]; m=next((m for m in a if y in m),None); ok=m is not None
    if ok: del m[y]
    return [ok,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer binding protected', solve([{}, {'a': 1}], 'a'), [False, [{}, {'a': 1}]])
check('inner reveals outer', solve([{'a': 2}, {'a': 1}], 'a'), [True, [{}, {'a': 1}]])
check('missing untouched', solve([{}, {}], 'a'), [False, [{}, {}]])
check('single scope', solve([{'a': 1}], 'a'), [True, [{}]])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[dict(m) for m in x]; ok=any(y in m for m in a)
    for m in a: m.pop(y,None)
    return [ok,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer binding protected', solve([{}, {'a': 1}], 'a'), [False, [{}, {'a': 1}]])
check('inner reveals outer', solve([{'a': 2}, {'a': 1}], 'a'), [True, [{}, {'a': 1}]])
check('missing untouched', solve([{}, {}], 'a'), [False, [{}, {}]])
check('single scope', solve([{'a': 1}], 'a'), [True, [{}]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Deletion removes a key only from the first scope; outer-only or missing keys report false without modifying any scope.

Deletion removes a key only from the first scope; outer-only or missing keys report false without modifying any scope. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    c=ChainMap(*x); return [[k,c[k]] for k in dict.fromkeys(k for m in x for k in m)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer order with inner values', solve([{'a': 2, 'c': 3}, {'b': 1, 'a': 1}]), [['b', 1], ['a', 2], ['c', 3]])
check('one scope order', solve([{'b': 2, 'a': 1}]), [['b', 2], ['a', 1]])
check('empty scopes', solve([{}, {}]), [])
check('inner only key', solve([{'a': 1}, {}]), [['a', 1]])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    c=ChainMap(*x); return [[k,c[k]] for k in sorted(c)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer order with inner values', solve([{'a': 2, 'c': 3}, {'b': 1, 'a': 1}]), [['b', 1], ['a', 2], ['c', 3]])
check('one scope order', solve([{'b': 2, 'a': 1}]), [['b', 2], ['a', 1]])
check('empty scopes', solve([{}, {}]), [])
check('inner only key', solve([{'a': 1}, {}]), [['a', 1]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: ChainMap key iteration begins with the last scope and appends previously unseen keys from inner scopes; lookup values still favor inner scopes.

ChainMap key iteration begins with the last scope and appends previously unseen keys from inner scopes; lookup values still favor inner scopes. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[dict(m) for m in x]; a[0].update(y); return [a,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('child shadows without rewriting', solve([{'a': 1}], {'a': 2}), [[{'a': 2}, {'a': 1}], [{'a': 1}]])
check('empty child is scope', solve([{'a': 1}], {}), [[{}, {'a': 1}], [{'a': 1}]])
check('multiple parent scopes', solve([{'a': 1}, {'b': 2}], {'c': 3}), [[{'c': 3}, {'a': 1}, {'b': 2}], [{'a': 1}, {'b': 2}]])
check('empty parent scope', 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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[dict(m) for m in x]; return [a+[dict(y)],a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('child shadows without rewriting', solve([{'a': 1}], {'a': 2}), [[{'a': 2}, {'a': 1}], [{'a': 1}]])
check('empty child is scope', solve([{'a': 1}], {}), [[{}, {'a': 1}], [{'a': 1}]])
check('multiple parent scopes', solve([{'a': 1}, {'b': 2}], {'c': 3}), [[{'c': 3}, {'a': 1}, {'b': 2}], [{'a': 1}, {'b': 2}]])
check('empty parent scope', 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:
The operation returns a result or retained state that violates this contract: Creating a child prepends exactly the child map without merging or mutating the parent scope list.

Creating a child prepends exactly the child map without merging or mutating the parent scope list. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return x
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two scopes', solve([{'a': 1}, {'a': 2}]), [{'a': 2}])
check('three scopes', solve([{'a': 1}, {'b': 2}, {'c': 3}]), [{'b': 2}, {'c': 3}])
check('one scope', solve([{'a': 1}]), [{}])
check('one empty scope', 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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return [dict(ChainMap(*x))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two scopes', solve([{'a': 1}, {'a': 2}]), [{'a': 2}])
check('three scopes', solve([{'a': 1}, {'b': 2}, {'c': 3}]), [{'b': 2}, {'c': 3}])
check('one scope', solve([{'a': 1}]), [{}])
check('one empty scope', 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:
The operation returns a result or retained state that violates this contract: The parents view removes only the current first scope and retains remaining scope boundaries; an empty parent chain exposes one empty map.

The parents view removes only the current first scope and retains remaining scope boundaries; an empty parent chain exposes one empty map. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return y in x[0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer membership', solve([{}, {'a': 1}], 'a'), True)
check('None present', solve([{'a': None}], 'a'), True)
check('absent', solve([{}, {}], 'a'), False)
check('false present', solve([{}, {'a': False}], 'a'), True)
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return bool(ChainMap(*x).get(y))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer membership', solve([{}, {'a': 1}], 'a'), True)
check('None present', solve([{'a': None}], 'a'), True)
check('absent', solve([{}, {}], 'a'), False)
check('false present', solve([{}, {'a': False}], 'a'), True)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Membership is true if any scope contains the key, regardless of its value.

Membership is true if any scope contains the key, regardless of its value. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[dict(m) for m in x]; v=a[0].setdefault(y[0],y[1]); return [v,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer binding remains outer', solve([{}, {'a': 1}], ['a', 2]), [1, [{}, {'a': 1}]])
check('outer None retained', solve([{}, {'a': None}], ['a', 2]), [None, [{}, {'a': None}]])
check('absent inserted', solve([{}, {}], ['a', 2]), [2, [{'a': 2}, {}]])
check('inner existing', solve([{'a': 1}], ['a', 2]), [1, [{'a': 1}]])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    c=ChainMap(*[dict(m) for m in x]); v=c.get(y[0]) or y[1]; c[y[0]]=v; return [v,c.maps]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer binding remains outer', solve([{}, {'a': 1}], ['a', 2]), [1, [{}, {'a': 1}]])
check('outer None retained', solve([{}, {'a': None}], ['a', 2]), [None, [{}, {'a': None}]])
check('absent inserted', solve([{}, {}], ['a', 2]), [2, [{'a': 2}, {}]])
check('inner existing', solve([{'a': 1}], ['a', 2]), [1, [{'a': 1}]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: setdefault returns an existing binding from any scope without inserting into the first scope; only an absent key is inserted.

setdefault returns an existing binding from any scope without inserting into the first scope; only an absent key is inserted. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[dict(m) for m in x]; m=next((m for m in a if y[0] in m),a[0]); v=m.pop(y[0],y[1]); return [v,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer-only returns default', solve([{}, {'a': 1}], ['a', 'missing']), ['missing', [{}, {'a': 1}]])
check('inner removes only inner', solve([{'a': 2}, {'a': 1}], ['a', 'missing']), [2, [{}, {'a': 1}]])
check('None pops', solve([{'a': None}], ['a', 'missing']), [None, [{}]])
check('absent fallback', solve([{}], ['a', 'missing']), ['missing', [{}]])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    c=ChainMap(*[dict(m) for m in x]); v=c.get(y[0],y[1]); c.maps[0].pop(y[0],None); return [v,c.maps]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer-only returns default', solve([{}, {'a': 1}], ['a', 'missing']), ['missing', [{}, {'a': 1}]])
check('inner removes only inner', solve([{'a': 2}, {'a': 1}], ['a', 'missing']), [2, [{}, {'a': 1}]])
check('None pops', solve([{'a': None}], ['a', 'missing']), [None, [{}]])
check('absent fallback', solve([{}], ['a', 'missing']), ['missing', [{}]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Pop removes only a top-scope binding; an outer-only binding returns the supplied fallback.

Pop removes only a top-scope binding; an outer-only binding returns the supplied fallback. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return [{} for m in x]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer preserved', solve([{'a': 2}, {'a': 1}]), [{}, {'a': 1}])
check('three scopes', solve([{'a': 1}, {'b': 2}, {'c': 3}]), [{}, {'b': 2}, {'c': 3}])
check('one scope', solve([{'a': 1}]), [{}])
check('empty top', solve([{}, {'a': 1}]), [{}, {'a': 1}])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return [{}]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer preserved', solve([{'a': 2}, {'a': 1}]), [{}, {'a': 1}])
check('three scopes', solve([{'a': 1}, {'b': 2}, {'c': 3}]), [{}, {'b': 2}, {'c': 3}])
check('one scope', solve([{'a': 1}]), [{}])
check('empty top', solve([{}, {'a': 1}]), [{}, {'a': 1}])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Clear erases only the first scope, preserving all outer bindings.

Clear erases only the first scope, preserving all outer bindings. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return (list(x)+[y[1]])[:y[0]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full evicts oldest', solve(['a', 'b'], [2, 'c']), ['b', 'c'])
check('zero capacity', solve([], [0, 'a']), [])
check('room remains', solve(['a'], [3, 'b']), ['a', 'b'])
check('empty accepts', solve([], [2, 'a']), ['a'])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return (list(x)+[y[1]])[-y[0]:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full evicts oldest', solve(['a', 'b'], [2, 'c']), ['b', 'c'])
check('zero capacity', solve([], [0, 'a']), [])
check('room remains', solve(['a'], [3, 'b']), ['a', 'b'])
check('empty accepts', solve([], [2, 'a']), ['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Append to a bounded deque, evicting from the left when capacity is exceeded; zero capacity retains nothing.

Append to a bounded deque, evicting from the left when capacity is exceeded; zero capacity retains nothing. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=deque(x,maxlen=y[0]); a.append(y[1]); return list(a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full evicts right', solve(['a', 'b'], [2, 'c']), ['c', 'a'])
check('zero capacity', solve([], [0, 'a']), [])
check('room remains', solve(['a'], [3, 'b']), ['b', 'a'])
check('empty accepts', solve([], [2, 'a']), ['a'])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return ([y[1]]+list(x))[-y[0]:] if y[0] else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full evicts right', solve(['a', 'b'], [2, 'c']), ['c', 'a'])
check('zero capacity', solve([], [0, 'a']), [])
check('room remains', solve(['a'], [3, 'b']), ['b', 'a'])
check('empty accepts', solve([], [2, 'a']), ['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Prepend to a bounded deque and evict from the right on overflow.

Prepend to a bounded deque and evict from the right on overflow. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=deque(x,maxlen=y[0]); a.extendleft(reversed(y[1])); return list(a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('source reverses', solve(['a'], [4, ['b', 'c']]), ['c', 'b', 'a'])
check('overflow evicts right', solve(['a', 'b'], [2, ['c', 'd']]), ['d', 'c'])
check('empty extension', solve(['a'], [2, []]), ['a'])
check('zero capacity', solve([], [0, ['a']]), [])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=deque(x,maxlen=y[0]); a.extend(y[1]); return list(a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('source reverses', solve(['a'], [4, ['b', 'c']]), ['c', 'b', 'a'])
check('overflow evicts right', solve(['a', 'b'], [2, ['c', 'd']]), ['d', 'c'])
check('empty extension', solve(['a'], [2, []]), ['a'])
check('zero capacity', solve([], [0, ['a']]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: extendleft repeatedly prepends input elements, so input order reverses; bounded overflow evicts the right.

extendleft repeatedly prepends input elements, so input order reverses; bounded overflow evicts the right. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    g=iter(y[1]); a=deque(x,maxlen=y[0]); a.extend(next(g) for _ in range(min(y[0]-len(a),len(y[1])))); return [list(a),list(g)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full still consumes and replaces', solve(['a', 'b'], [2, ['c', 'd', 'e']]), [['d', 'e'], []])
check('zero drains source', solve([], [0, ['a', 'b']]), [[], []])
check('room accepts', solve([], [3, ['a']]), [['a'], []])
check('empty source', solve(['a'], [2, []]), [['a'], []])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    g=iter(y[1]); a=deque(x,maxlen=y[0]); a.extend(g if y[0] else []); return [list(a),list(g)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full still consumes and replaces', solve(['a', 'b'], [2, ['c', 'd', 'e']]), [['d', 'e'], []])
check('zero drains source', solve([], [0, ['a', 'b']]), [[], []])
check('room accepts', solve([], [3, ['a']]), [['a'], []])
check('empty source', solve(['a'], [2, []]), [['a'], []])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Extending a bounded deque consumes the complete iterator even when capacity is zero; retain the newest capacity values.

Extending a bounded deque consumes the complete iterator even when capacity is zero; retain the newest capacity values. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=deque(x,maxlen=y[0]); a.append(y[2]); return [True,list(a)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full insertion rejects', solve(['a', 'b'], [2, 0, 'c']), [False, ['a', 'b']])
check('room inserts positional', solve(['a', 'b'], [3, 1, 'c']), [True, ['a', 'c', 'b']])
check('zero capacity rejects', solve([], [0, 0, 'a']), [False, []])
check('empty insertion', solve([], [1, 0, 'a']), [True, ['a']])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); a.insert(y[1],y[2]); return [len(x)<y[0],a[:y[0]]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full insertion rejects', solve(['a', 'b'], [2, 0, 'c']), [False, ['a', 'b']])
check('room inserts positional', solve(['a', 'b'], [3, 1, 'c']), [True, ['a', 'c', 'b']])
check('zero capacity rejects', solve([], [0, 0, 'a']), [False, []])
check('empty insertion', solve([], [1, 0, 'a']), [True, ['a']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Insert at a positional index only when the bounded deque has room; full deque returns false unchanged rather than evicting.

Insert at a positional index only when the bounded deque has room; full deque returns false unchanged rather than evicting. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return x[y:]+x[:y]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive right', solve(['a', 'b', 'c'], 1), ['c', 'a', 'b'])
check('large offset', solve(['a', 'b', 'c'], 7), ['c', 'a', 'b'])
check('negative left', solve(['a', 'b', 'c'], -1), ['b', 'c', 'a'])
check('empty', solve([], 3), [])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return x[-y:]+x[:-y] if y else list(x)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive right', solve(['a', 'b', 'c'], 1), ['c', 'a', 'b'])
check('large offset', solve(['a', 'b', 'c'], 7), ['c', 'a', 'b'])
check('negative left', solve(['a', 'b', 'c'], -1), ['b', 'c', 'a'])
check('empty', solve([], 3), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Positive rotation moves elements right, negative rotation moves left, and offsets reduce modulo length; empty remains empty.

Positive rotation moves elements right, negative rotation moves left, and offsets reduce modulo length; empty remains empty. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=deque(x,maxlen=y[0]); b=a; b.append(y[1]); return [list(a),list(b),b.maxlen]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full independent copy', solve(['a', 'b'], [2, 'c']), [['a', 'b'], ['b', 'c'], 2])
check('room remains', solve(['a'], [3, 'b']), [['a'], ['a', 'b'], 3])
check('zero bound', solve([], [0, 'a']), [[], [], 0])
check('empty copy', solve([], [2, 'a']), [[], ['a'], 2])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=deque(x,maxlen=y[0]); b=deque(a); b.append(y[1]); return [list(a),list(b),b.maxlen]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full independent copy', solve(['a', 'b'], [2, 'c']), [['a', 'b'], ['b', 'c'], 2])
check('room remains', solve(['a'], [3, 'b']), [['a'], ['a', 'b'], 3])
check('zero bound', solve([], [0, 'a']), [[], [], 0])
check('empty copy', solve([], [2, 'a']), [[], ['a'], 2])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Copy a bounded deque, append to the copy, and return [original,copy,copy capacity]; the copy preserves maxlen and does not mutate the original.

Copy a bounded deque, append to the copy, and return [original,copy,copy capacity]; the copy preserves maxlen and does not mutate the original. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return x[:y]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('truncates left', solve(['a', 'b', 'c'], 2), ['b', 'c'])
check('zero retains none', solve(['a'], 0), [])
check('under capacity', solve(['a'], 3), ['a'])
check('empty', solve([], 1), [])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return x[-y:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('truncates left', solve(['a', 'b', 'c'], 2), ['b', 'c'])
check('zero retains none', solve(['a'], 0), [])
check('under capacity', solve(['a'], 3), ['a'])
check('empty', solve([], 1), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Construct a bounded deque from a sequence, retaining its newest suffix when the initial sequence exceeds capacity.

Construct a bounded deque from a sequence, retaining its newest suffix when the initial sequence exceeds capacity. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); return [heapq.heappop(a) for _ in range(len(a))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('arbitrary input order', solve(['c', 'a', 'b']), ['a', 'b', 'c'])
check('duplicates retained', solve(['b', 'a', 'b']), ['a', 'b', 'b'])
check('empty', solve([]), [])
check('singleton', solve(['a']), ['a'])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(dict.fromkeys(x)); heapq.heapify(a); return [heapq.heappop(a) for _ in range(len(a))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('arbitrary input order', solve(['c', 'a', 'b']), ['a', 'b', 'c'])
check('duplicates retained', solve(['b', 'a', 'b']), ['a', 'b', 'b'])
check('empty', solve([]), [])
check('singleton', solve(['a']), ['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Build a min heap from arbitrary input and pop all values in sorted order, retaining duplicates.

Build a min heap from arbitrary input and pop all values in sorted order, retaining duplicates. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); heapq.heapify(a); v=heapq.heapreplace(a,y) if a else y; return [v,sorted(a)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('new smallest immediately returned', solve(['b', 'c'], 'a'), ['a', ['b', 'c']])
check('new largest retained', solve(['a', 'b'], 'c'), ['a', ['b', 'c']])
check('empty', solve([], 'a'), ['a', []])
check('equal minimum', solve(['a', 'b'], 'a'), ['a', ['a', 'b']])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); heapq.heappush(a,y); return [None,sorted(a)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('new smallest immediately returned', solve(['b', 'c'], 'a'), ['a', ['b', 'c']])
check('new largest retained', solve(['a', 'b'], 'c'), ['a', ['b', 'c']])
check('empty', solve([], 'a'), ['a', []])
check('equal minimum', solve(['a', 'b'], 'a'), ['a', ['a', 'b']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Push then pop returns the smaller of the new value and previous heap minimum, retaining the other; empty heap returns the new value and remains empty.

Push then pop returns the smaller of the new value and previous heap minimum, retaining the other; empty heap returns the new value and remains empty. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); heapq.heapify(a); v=heapq.heappushpop(a,y); return [v,sorted(a)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('smaller replacement retained', solve(['b', 'c'], 'a'), ['b', ['a', 'c']])
check('larger replacement retained', solve(['a', 'b'], 'c'), ['a', ['b', 'c']])
check('singleton replacement', solve(['b'], 'a'), ['b', ['a']])
check('equal minimum', solve(['a', 'b'], 'a'), ['a', ['a', 'b']])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); heapq.heapify(a); v=heapq.heappop(a); return [v,sorted(a)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('smaller replacement retained', solve(['b', 'c'], 'a'), ['b', ['a', 'c']])
check('larger replacement retained', solve(['a', 'b'], 'c'), ['a', ['b', 'c']])
check('singleton replacement', solve(['b'], 'a'), ['b', ['a']])
check('equal minimum', solve(['a', 'b'], 'a'), ['a', ['a', 'b']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: For a nonempty heap, replace and return the old minimum even if the new value is smaller.

For a nonempty heap, replace and return the old minimum even if the new value is smaller. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); heapq.heapify(a)
    if y in a: a.remove(y)
    return [heapq.heappop(a) for _ in range(len(a))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('removal shifts internal children', solve(['a', 'd', 'b', 'e', 'f', 'c'], 'a'), ['b', 'c', 'd', 'e', 'f'])
check('one duplicate removed', solve(['a', 'a', 'b'], 'a'), ['a', 'b'])
check('missing unchanged', solve(['c', 'a', 'b'], 'z'), ['a', 'b', 'c'])
check('empty', solve([], 'a'), [])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[v for v in x if v!=y]; heapq.heapify(a); return [heapq.heappop(a) for _ in range(len(a))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('removal shifts internal children', solve(['a', 'd', 'b', 'e', 'f', 'c'], 'a'), ['b', 'c', 'd', 'e', 'f'])
check('one duplicate removed', solve(['a', 'a', 'b'], 'a'), ['a', 'b'])
check('missing unchanged', solve(['c', 'a', 'b'], 'z'), ['a', 'b', 'c'])
check('empty', solve([], 'a'), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Remove one matching heap value if present, then restore heap ordering before draining remaining values.

Remove one matching heap value if present, then restore heap ordering before draining remaining values. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); heapq.heapify(a); a[y[0]]=y[1]; return [heapq.heappop(a) for _ in range(len(a))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decrease nonroot', solve(['b', 'c', 'd'], [2, 'a']), ['a', 'b', 'c'])
check('duplicate one occurrence', solve(['b', 'b', 'c'], [1, 'a']), ['a', 'b', 'c'])
check('increase root', solve(['a', 'b', 'c'], [0, 'd']), ['b', 'c', 'd'])
check('singleton', solve(['b'], [0, 'a']), ['a'])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=list(x); a=[y[1] if v==x[y[0]] else v for v in a]; heapq.heapify(a); return [heapq.heappop(a) for _ in range(len(a))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decrease nonroot', solve(['b', 'c', 'd'], [2, 'a']), ['a', 'b', 'c'])
check('duplicate one occurrence', solve(['b', 'b', 'c'], [1, 'a']), ['a', 'b', 'c'])
check('increase root', solve(['a', 'b', 'c'], [0, 'd']), ['b', 'c', 'd'])
check('singleton', solve(['b'], [0, 'a']), ['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Replace exactly one selected original list item, then heapify and drain; changing a key requires restoring heap order.

Replace exactly one selected original list item, then heapify and drain; changing a key requires restoring heap order. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=[(p,v) for p,v in x]; heapq.heapify(a); return [heapq.heappop(a)[1] for _ in range(len(a))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('equal priority stable', solve([[1, 'z'], [1, 'a'], [0, 'm']]), ['m', 'z', 'a'])
check('priority dominates arrival', solve([[2, 'a'], [1, 'b']]), ['b', 'a'])
check('empty', solve([]), [])
check('singleton', solve([[1, 'a']]), ['a'])
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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return [v for p,v in x]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('equal priority stable', solve([[1, 'z'], [1, 'a'], [0, 'm']]), ['m', 'z', 'a'])
check('priority dominates arrival', solve([[2, 'a'], [1, 'b']]), ['b', 'a'])
check('empty', solve([]), [])
check('singleton', solve([[1, 'a']]), ['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The operation returns a result or retained state that violates this contract: Order [priority,label] jobs by priority, using arrival sequence to break equal priorities independently of label lexical order.

Order [priority,label] jobs by priority, using arrival sequence to break equal priorities independently of label lexical order. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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)

evaluation_group: xl-positional-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, /, *, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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:
Accepts the positional-only parameter by keyword and changes the required Python-language result.

Call f(a, /, b=10) and return [a,b]. The first parameter is required and positional-only; b accepts position or keyword. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, /, *, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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)

evaluation_group: xl-positional-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, /, b=10):
        return [a,10]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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:
Makes the second parameter keyword-only and changes the required Python-language result.

Call f(a, /, b=10) and return [a,b]. The first parameter is required and positional-only; b accepts position or keyword. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, /, b=10):
        return [a,10]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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)

evaluation_group: xl-positional-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, /, b=None):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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:
Binds but discards the explicitly supplied second parameter and changes the required Python-language result.

Call f(a, /, b=10) and return [a,b]. The first parameter is required and positional-only; b accepts position or keyword. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, /, b=None):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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)

evaluation_group: xl-positional-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a=0, /, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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:
Changes the omitted second-argument default and changes the required Python-language result.

Call f(a, /, b=10) and return [a,b]. The first parameter is required and positional-only; b accepts position or keyword. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a=0, /, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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)

evaluation_group: xl-positional-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('keyword first rejected', solve([], {'a': 1}), 'TypeError')
check('omitted optional', solve([1], {}), [1, 10])
check('two positions', solve([1, 2], {}), [1, 2])
check('named second', solve([1], {'b': 3}), [1, 3])
check('missing first', solve([], {}), 'TypeError')
check('duplicate apparent first', solve([1], {'a': 2}), 'TypeError')
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:
Adds a default to the required first parameter and changes the required Python-language result.

Call f(a, /, b=10) and return [a,b]. The first parameter is required and positional-only; b accepts position or keyword. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xl-keyword-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, /, *, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Accepts the keyword-only parameter positionally and changes the required Python-language result.

Call f(a, *, b=10) and return [a,b]. Reject extra positional arguments, unknown keywords and repeated binding of a. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, /, *, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xl-keyword-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *, b):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Forbids legal keyword binding of the first parameter and changes the required Python-language result.

Call f(a, *, b=10) and return [a,b]. Reject extra positional arguments, unknown keywords and repeated binding of a. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *, b):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xl-keyword-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *, b=10, **rest):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Makes an optional keyword-only parameter required and changes the required Python-language result.

Call f(a, *, b=10) and return [a,b]. Reject extra positional arguments, unknown keywords and repeated binding of a. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *, b=10, **rest):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xl-keyword-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    if len(args)>1: return "TypeError"
    values={"a":args[0]} if args else {}
    values.update(kwargs)
    if "a" not in values or set(values)-{"a","b"}: return "TypeError"
    return [values["a"],values.get("b",10)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Silently accepts unexpected keywords and changes the required Python-language result.

Call f(a, *, b=10) and return [a,b]. Reject extra positional arguments, unknown keywords and repeated binding of a. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    if len(args)>1: return "TypeError"
    values={"a":args[0]} if args else {}
    values.update(kwargs)
    if "a" not in values or set(values)-{"a","b"}: return "TypeError"
    return [values["a"],values.get("b",10)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xl-keyword-only-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, b=10):
        return [a,b]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second positional rejected', solve([1, 2], {}), 'TypeError')
check('all named', solve([], {'a': 1, 'b': 2}), [1, 2])
check('optional omitted', solve([1], {}), [1, 10])
check('unknown name', solve([1], {'c': 3}), 'TypeError')
check('a bound twice', solve([1], {'a': 2}), 'TypeError')
check('explicit None', solve([None], {'b': None}), [None, None])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Overwrites a positional binding with a keyword binding and changes the required Python-language result.

Call f(a, *, b=10) and return [a,b]. Reject extra positional arguments, unknown keywords and repeated binding of a. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, flag=False, *tail):
        return [a,list(tail),flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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)

evaluation_group: xl-variadic-positional-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *, flag=False):
        return [a,[],flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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:
Consumes the first variadic positional argument as flag and changes the required Python-language result.

Call f(a, *tail, flag=False), returning [a,list(tail),flag]. flag must be named; arbitrary extra positions belong to tail. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *, flag=False):
        return [a,[],flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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)

evaluation_group: xl-variadic-positional-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *tail, flag=False):
        return [a,[item for v in tail for item in (v if isinstance(v,list) else [v])],flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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:
Rejects extra positions instead of collecting the variadic tail and changes the required Python-language result.

Call f(a, *tail, flag=False), returning [a,list(tail),flag]. flag must be named; arbitrary extra positions belong to tail. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *tail, flag=False):
        return [a,[item for v in tail for item in (v if isinstance(v,list) else [v])],flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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)

evaluation_group: xl-variadic-positional-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *tail, flag=False):
        return [a,list(tail[1:]),flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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:
Flattens nested positional values while collecting tail and changes the required Python-language result.

Call f(a, *tail, flag=False), returning [a,list(tail),flag]. flag must be named; arbitrary extra positions belong to tail. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *tail, flag=False):
        return [a,list(tail[1:]),flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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)

evaluation_group: xl-variadic-positional-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *tail, flag=False):
        return [a,list(tail)+([flag] if flag is not False else []),flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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:
Drops the first variadic argument after binding and changes the required Python-language result.

Call f(a, *tail, flag=False), returning [a,list(tail),flag]. flag must be named; arbitrary extra positions belong to tail. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access


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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, *tail, flag=False):
        return [a,list(tail)+([flag] if flag is not False else []),flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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)

evaluation_group: xl-variadic-positional-binding

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

N = 1
observations = []
def solve(args, kwargs):
    def f(a, flag=False, *tail):
        return [a,list(tail),flag]
    try:
        return f(*args, **kwargs)
    except TypeError:
        return "TypeError"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('only required', solve([1], {}), [1, [], False])
check('several extras', solve([1, 2, 3], {}), [1, [2, 3], False])
check('named flag', solve([1, 2], {'flag': True}), [1, [2], True])
check('nested tail preserved', solve([1, [2, 3]], {}), [1, [[2, 3]], False])
check('unknown keyword', solve([1], {'other': 2}), 'TypeError')
check('missing required', solve([], {}), 'TypeError')
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:
Copies a named flag into the positional tail and changes the required Python-language result.

Call f(a, *tail, flag=False), returning [a,list(tail),flag]. flag must be named; arbitrary extra positions belong to tail. Inputs use the finite Python types shown in the fixtures. An error string denotes the specified caught exception, not an unhandled process failure.

split: open-access