broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ''.join(html.unescape(v)[0] if v.startswith('&') and html.unescape(v) else v for v in re.split(r'(&[^;]+;)',x))
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('≂̸'), '≂̸')
check('boundary 2', solve('fj'), 'fj')
check('boundary 3', solve('&'), '&')
check('boundary 4', solve('abc'), 'abc')
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ''.join(c for c in html.unescape(x) if not unicodedata.combining(c))
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('≂̸'), '≂̸')
check('boundary 2', solve('fj'), 'fj')
check('boundary 3', solve('&'), '&')
check('boundary 4', solve('abc'), 'abc')
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:
Entity decoding keeps only the first resulting codepoint.

Decode HTML entities, retaining combining and multi-codepoint mappings.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return '<![CDATA['+x+']]>'
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a]]>b'), '<![CDATA[a]]]]><![CDATA[>b]]>')
check('boundary 2', solve('x'), '<![CDATA[x]]>')
check('boundary 3', solve(''), '<![CDATA[]]>')
check('boundary 4', solve(']]>]]>'), '<![CDATA[]]]]><![CDATA[>]]]]><![CDATA[>]]>')
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return '<![CDATA['+x.replace(']]>','')+']]>'
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a]]>b'), '<![CDATA[a]]]]><![CDATA[>b]]>')
check('boundary 2', solve('x'), '<![CDATA[x]]>')
check('boundary 3', solve(''), '<![CDATA[]]>')
check('boundary 4', solve(']]>]]>'), '<![CDATA[]]]]><![CDATA[>]]]]><![CDATA[>]]>')
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:
CDATA serialization emits an embedded terminator.

Wrap text in CDATA, splitting embedded ]]> across adjacent CDATA sections.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return next(iter(ET.fromstring(x).attrib.values()),None)
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('<r xmlns="u" id="x"/>'), 'x')
check('boundary 2', solve('<r xmlns:p="u" p:id="x"/>'), None)
check('boundary 3', solve('<r name="n"/>'), None)
check('boundary 4', solve('<r/>'), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return next((v for k,v in ET.fromstring(x).attrib.items() if k.rsplit('}',1)[-1]=='id'),None)
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('<r xmlns="u" id="x"/>'), 'x')
check('boundary 2', solve('<r xmlns:p="u" p:id="x"/>'), None)
check('boundary 3', solve('<r name="n"/>'), None)
check('boundary 4', solve('<r/>'), 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:
Default element namespaces are incorrectly applied to attributes.

Return the unqualified id attribute; prefixed attributes do not satisfy it.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x.count('<a:x')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('<r xmlns:q="urn:a"><q:x/></r>'), 1)
check('boundary 2', solve('<r xmlns:a="urn:b"><a:x/></r>'), 0)
check('boundary 3', solve('<r><x/></r>'), 0)
check('boundary 4', solve('<r xmlns="urn:a"><x/><x/></r>'), 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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return sum(e.tag.rsplit('}',1)[-1]=='x' for e in ET.fromstring(x))
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('<r xmlns:q="urn:a"><q:x/></r>'), 1)
check('boundary 2', solve('<r xmlns:a="urn:b"><a:x/></r>'), 0)
check('boundary 3', solve('<r><x/></r>'), 0)
check('boundary 4', solve('<r xmlns="urn:a"><x/><x/></r>'), 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:
Element matching relies on a source prefix spelling.

Count direct children whose expanded name is {urn:a}x independent of prefix.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ''.join('\\'+c for c in x)
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a*b'), 'a\\*b')
check('boundary 2', solve('a b'), 'a b')
check('boundary 3', solve('é'), 'é')
check('boundary 4', solve('[x]'), '\\[x\\]')
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ''.join('\\'+c if not c.isalnum() else c for c in x)
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a*b'), 'a\\*b')
check('boundary 2', solve('a b'), 'a b')
check('boundary 3', solve('é'), 'é')
check('boundary 4', solve('[x]'), '\\[x\\]')
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:
Markdown escaping modifies alphanumeric text.

Backslash-escape ASCII punctuation only; leave letters, whitespace and non-ASCII characters literal.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ','.join(x)+'\n'
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', 'b']), '"a","b"\n')
check('boundary 2', solve(['']), '""\n')
check('boundary 3', solve(['a"b']), '"a""b"\n')
check('boundary 4', solve([]), '\n')
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        out=io.StringIO(newline='')
        csv.writer(out,lineterminator='\n').writerow(x)
        return out.getvalue()
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', 'b']), '"a","b"\n')
check('boundary 2', solve(['']), '""\n')
check('boundary 3', solve(['a"b']), '"a""b"\n')
check('boundary 4', solve([]), '\n')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A quoted-all dialect leaves ordinary fields bare.

Write every CSV field quoted, double embedded quotes, and terminate with LF.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x.split(',')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a\\,b,c'), ['a,b', 'c'])
check('boundary 2', solve('"a,b"'), ['"a', 'b"'])
check('boundary 3', solve('a\\\\b'), ['a\\b'])
check('boundary 4', 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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return next(csv.reader([x],escapechar="\\"))
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a\\,b,c'), ['a,b', 'c'])
check('boundary 2', solve('"a,b"'), ['"a', 'b"'])
check('boundary 3', solve('a\\\\b'), ['a\\b'])
check('boundary 4', 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:
A backslash-escaped delimiter is treated as a field boundary.

Parse one comma-delimited row with backslash escaping and no quote semantics.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return [v for k,v in parse_qsl(x) if k=='a']
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a='), [''])
check('boundary 2', solve('b=1'), [])
check('boundary 3', solve('a=1&a=2'), ['1', '2'])
check('boundary 4', 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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return [dict(parse_qsl(x,keep_blank_values=True)).get('a','')]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('a='), [''])
check('boundary 2', solve('b=1'), [])
check('boundary 3', solve('a=1&a=2'), ['1', '2'])
check('boundary 4', 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:
An empty query field is confused with an absent field.

Return all values of key a from a form query, retaining empty and repeated values.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return base64.encodebytes(bytes(x)).decode()
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97]), 'YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh')
check('boundary 2', solve([97]), 'YQ==')
check('boundary 3', solve([]), '')
check('boundary 4', solve([0, 0, 0]), 'AAAA')
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return base64.encodebytes(bytes(x)).decode().rstrip('\n')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97]), 'YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh')
check('boundary 2', solve([97]), 'YQ==')
check('boundary 3', solve([]), '')
check('boundary 4', solve([0, 0, 0]), 'AAAA')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A base64 token contains MIME line wrapping.

Encode bytes to standard padded Base64 with no newline, even for long input.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ':'.join(bytes(x).hex())
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([0, 10, 255]), '00:0a:ff')
check('boundary 2', solve([16]), '10')
check('boundary 3', solve([]), '')
check('boundary 4', solve([1, 2]), '01:02')
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ':'.join(format(v,'x') for v in x)
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([0, 10, 255]), '00:0a:ff')
check('boundary 2', solve([16]), '10')
check('boundary 3', solve([]), '')
check('boundary 4', solve([1, 2]), '01:02')
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:
Hex formatting places a separator between nybbles.

Format bytes as lowercase two-digit hex groups separated by one colon; empty input empty.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x.replace('<','<').replace('&','&')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('<'), '<')
check('boundary 2', solve('&'), '&')
check('boundary 3', solve('<'), '&lt;')
check('boundary 4', solve('a>b'), '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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x.replace('<','<')
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve('<'), '<')
check('boundary 2', solve('&'), '&')
check('boundary 3', solve('<'), '&lt;')
check('boundary 4', solve('a>b'), '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:
HTML escaping double-escapes the entities it just generated.

Escape only ampersand and less-than once from original text.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        stack=[]
        for t in x:
            if t in ('+','-'):
                left=stack.pop(); right=stack.pop(); stack.append([t,left,right])
            else: stack.append(t)
        return stack[0]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', 'b', '-']), ['-', 'a', 'b'])
check('boundary 2', solve(['a', 'b', 'c', '-', '+']), ['+', 'a', ['-', 'b', 'c']])
check('boundary 3', solve(['x']), 'x')
check('boundary 4', solve(['a', 'b', '+']), ['+', '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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        stack=[]
        for t in x:
            if t in ('+','-'):
                right=stack.pop(); left=stack.pop(); stack.append(['+',left,right])
            else: stack.append(t)
        return stack[0]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', 'b', '-']), ['-', 'a', 'b'])
check('boundary 2', solve(['a', 'b', 'c', '-', '+']), ['+', 'a', ['-', 'b', 'c']])
check('boundary 3', solve(['x']), 'x')
check('boundary 4', solve(['a', 'b', '+']), ['+', '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:
A postfix parser reverses noncommutative operands.

Parse a valid postfix token list with binary plus/minus into [operator,left,right] ASTs; letters are leaves.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        def parse(i):
            if i >= len(x): raise ValueError('missing operand')
            t=x[i]
            if t not in ('+','*'): return t,i+1
            a,j=parse(i+1)
            b,k=parse(j)
            return [t,a,b],k
        try:
            tree,end=parse(0)
        except ValueError:
            return None
        return tree
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['+', 'a', 'b', 'c']), None)
check('boundary 2', solve(['+', 'a', '*', 'b', 'c']), ['+', 'a', ['*', 'b', 'c']])
check('boundary 3', solve(['a']), 'a')
check('boundary 4', solve(['+', 'a']), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        def parse(i):
            if i >= len(x): raise ValueError('missing operand')
            t=x[i]
            if t not in ('+','*'): return t,i+1
            a,j=parse(i+1)
            b,k=parse(j)
            return [t,a,b],k
        try:
            tree,end=parse(0)
        except ValueError:
            return None
        return tree if len(x)<=3 else None
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['+', 'a', 'b', 'c']), None)
check('boundary 2', solve(['+', 'a', '*', 'b', 'c']), ['+', 'a', ['*', 'b', 'c']])
check('boundary 3', solve(['a']), 'a')
check('boundary 4', solve(['+', 'a']), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A prefix AST silently ignores an unconsumed token.

Parse binary +/* prefix expressions with other tokens as leaves; reject missing operands and unconsumed tokens.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        tree=x[-1]
        for i in range(len(x)-2,0,-2): tree=[x[i],x[i-1],tree]
        return tree
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '-', 'b', '-', 'c']), ['-', ['-', 'a', 'b'], 'c'])
check('boundary 2', solve(['x']), 'x')
check('boundary 3', solve(['a', '-', 'b']), ['-', 'a', 'b'])
check('boundary 4', solve(['a', '-', 'b', '-', 'c', '-', 'd']), ['-', ['-', ['-', 'a', 'b'], 'c'], 'd'])
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ['-',x[0],x[-1]] if len(x)>1 else x[0]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '-', 'b', '-', 'c']), ['-', ['-', 'a', 'b'], 'c'])
check('boundary 2', solve(['x']), 'x')
check('boundary 3', solve(['a', '-', 'b']), ['-', 'a', 'b'])
check('boundary 4', solve(['a', '-', 'b', '-', 'c', '-', 'd']), ['-', ['-', ['-', 'a', 'b'], 'c'], 'd'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A subtraction chain builds a right-associated tree.

Parse a valid alternating operand/minus token list with left associativity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        tree=x[0]
        for i in range(1,len(x),2): tree=[x[i],tree,x[i+1]]
        return tree
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '^', 'b', '^', 'c']), ['^', 'a', ['^', 'b', 'c']])
check('boundary 2', solve(['x']), 'x')
check('boundary 3', solve(['a', '^', 'b']), ['^', 'a', 'b'])
check('boundary 4', solve(['a', '^', 'b', '^', 'c', '^', 'd']), ['^', 'a', ['^', 'b', ['^', 'c', 'd']]])
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return ['^',x[0],x[-1]] if len(x)>1 else x[0]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '^', 'b', '^', 'c']), ['^', 'a', ['^', 'b', 'c']])
check('boundary 2', solve(['x']), 'x')
check('boundary 3', solve(['a', '^', 'b']), ['^', 'a', 'b'])
check('boundary 4', solve(['a', '^', 'b', '^', 'c', '^', 'd']), ['^', 'a', ['^', 'b', ['^', 'c', 'd']]])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An exponentiation chain builds a left-associated tree.

Parse a valid alternating operand/caret token list with right associativity.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        tree=x[0]
        for i in range(1,len(x),2): tree=[x[i],tree,x[i+1]]
        return tree
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '+', 'b', '*', 'c']), ['+', 'a', ['*', 'b', 'c']])
check('boundary 2', solve(['a', '*', 'b', '+', 'c']), ['+', ['*', 'a', 'b'], 'c'])
check('boundary 3', solve(['a', '+', 'b', '+', 'c']), ['+', ['+', 'a', 'b'], 'c'])
check('boundary 4', solve(['x']), 'x')
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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        tree=x[-1]
        for i in range(len(x)-2,0,-2): tree=[x[i],x[i-1],tree]
        return tree
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(['a', '+', 'b', '*', 'c']), ['+', 'a', ['*', 'b', 'c']])
check('boundary 2', solve(['a', '*', 'b', '+', 'c']), ['+', ['*', 'a', 'b'], 'c'])
check('boundary 3', solve(['a', '+', 'b', '+', 'c']), ['+', ['+', 'a', 'b'], 'c'])
check('boundary 4', solve(['x']), 'x')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A multiplication operator binds no tighter than addition.

Parse valid alternating operands and +/* into binary ASTs, with multiplication binding first and equal precedence associating left.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return [suffix for count,suffix in x]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([[0, 'car'], [3, 't'], [2, 't']]), ['car', 'cart', 'cat'])
check('boundary 2', solve([[1, 'x']]), None)
check('boundary 3', solve([[0, 'x'], [-1, 'y']]), None)
check('boundary 4', 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
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        out=[]
        previous=''
        for count,suffix in x:
            previous=previous[:count]+suffix
            out.append(previous)
        return out
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([[0, 'car'], [3, 't'], [2, 't']]), ['car', 'cart', 'cat'])
check('boundary 2', solve([[1, 'x']]), None)
check('boundary 3', solve([[0, 'x'], [-1, 'y']]), None)
check('boundary 4', 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:
Front-coded strings ignore the previous decoded prefix.

Decode [prefix_length,suffix] records against the previous decoded string, starting with empty text; invalid prefix lengths return None.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x[1:]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([2, 65, 2, 66]), [65, 0, 66])
check('boundary 2', solve([1]), [])
check('boundary 3', solve([2, 65]), [65])
check('boundary 4', solve([0]), None)
check('boundary 5', solve([3, 65]), None)
check('boundary 6', solve([2, 0]), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        out=[]
        i=0
        while i<len(x):
            c=x[i]
            if not c or i+c>len(x): return None
            out.extend(x[i+1:i+c])
            if c<255: out.append(0)
            i+=c
        return out
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([2, 65, 2, 66]), [65, 0, 66])
check('boundary 2', solve([1]), [])
check('boundary 3', solve([2, 65]), [65])
check('boundary 4', solve([0]), None)
check('boundary 5', solve([3, 65]), None)
check('boundary 6', solve([2, 0]), 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:
COBS decoding inserts a zero after the final block.

Decode COBS code blocks to bytes; insert an implied zero only between blocks with code below 255. Reject zero code or truncation.

split: open-access


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

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('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['c', 'b', '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

N = 1
observations = []
def solve(x, y=None):
    return sorted(x, reverse=True)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['c', 'b', '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: Reverse the complete list, retaining every occurrence.

Reverse the complete list, retaining every occurrence. 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(x, y=None):
    return x
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'c'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return sorted(set(x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'c'])
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: Keep each value once in first-appearance order.

Keep each value once in first-appearance 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(x, y=None):
    return list(dict.fromkeys(x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'b', 'c'])
check('last-occurrence order is not lexical', solve(['b','a','c','b']), ['a','c','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

N = 1
observations = []
def solve(x, y=None):
    return sorted(set(x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'b', 'c'])
check('last-occurrence order is not lexical', solve(['b','a','c','b']), ['a','c','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: Keep only last occurrences, ordered by their original positions.

Keep only last occurrences, ordered by their original positions. 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(x, y=None):
    return list(dict.fromkeys(x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'b', 'c'])
check('adjacent duplicates collapse', solve(['b','b','a','b']), ['b','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

N = 1
observations = []
def solve(x, y=None):
    return sorted(set(x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'b', 'c'])
check('adjacent duplicates collapse', solve(['b','b','a','b']), ['b','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: Collapse adjacent equal values only; separated repetitions remain.

Collapse adjacent equal values only; separated repetitions remain. 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(x, y=None):
    return [v for v in x if x.count(v)>1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b'])
check('third occurrence remains', solve(['a','a','a']), ['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

N = 1
observations = []
def solve(x, y=None):
    return list(dict.fromkeys(v for v in x if x.count(v)>1))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b'])
check('third occurrence remains', solve(['a','a','a']), ['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: Return each repeated occurrence after its first appearance, in occurrence order.

Return each repeated occurrence after its first appearance, in occurrence 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(x, y=None):
    return [v for i,v in enumerate(x) if v in x[:i]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', '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

N = 1
observations = []
def solve(x, y=None):
    return list(dict.fromkeys(v for v in x if x.count(v)>1))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', '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: Return every occurrence of values that occur more than once.

Return every occurrence of values that occur more than once. 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(x, y=None):
    return list(dict.fromkeys(x))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'c'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return [v for i,v in enumerate(x) if v not in x[:i]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a', 'b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'c'])
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: Return values whose total occurrence count is exactly one, preserving input order.

Return values whose total occurrence count is exactly one, preserving input 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(x, y=None):
    return x[-1] if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), 'a')
check('two distinct elements', solve(['a', 'b']), 'a')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), '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

N = 1
observations = []
def solve(x, y=None):
    return min(x) if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), 'a')
check('two distinct elements', solve(['a', 'b']), 'a')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), '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: Return the first element, or None only when the list is empty.

Return the first element, or None only when the list is 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

N = 1
observations = []
def solve(x, y=None):
    return x[0] if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), 'a')
check('two distinct elements', solve(['a', 'b']), 'b')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), 'c')
check('last is not maximum', solve(['c','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

N = 1
observations = []
def solve(x, y=None):
    return max(x) if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), 'a')
check('two distinct elements', solve(['a', 'b']), 'b')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), 'c')
check('last is not maximum', solve(['c','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: Return the last element, or None only when the list is empty.

Return the last element, or None only when the list is 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

N = 1
observations = []
def solve(x, y=None):
    return x[0] if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), None)
check('two distinct elements', solve(['a', 'b']), 'b')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), 'a')
check('equal first and second', solve(['a','a','b']), '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

N = 1
observations = []
def solve(x, y=None):
    return list(dict.fromkeys(x))[1] if len(set(x))>1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), None)
check('two distinct elements', solve(['a', 'b']), 'b')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), 'a')
check('equal first and second', solve(['a','a','b']), '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: Return the second positional element or None if fewer than two elements exist.

Return the second positional element or None if fewer than two elements exist. 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(x, y=None):
    return x[-1] if x else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), None)
check('two distinct elements', solve(['a', 'b']), 'a')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), '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

N = 1
observations = []
def solve(x, y=None):
    return x[1] if len(x)>1 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), None)
check('singleton collection', solve(['a']), None)
check('two distinct elements', solve(['a', 'b']), 'a')
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), '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: Return the penultimate element, or None for lengths zero and one.

Return the penultimate element, or None for lengths zero and one. 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(x, y=None):
    return [v for v in x if v != x[0]] if x else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), ['b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'b', 'c'])
check('duplicate suffix is retained', solve(['c','b','b']), ['b','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

N = 1
observations = []
def solve(x, y=None):
    return list(dict.fromkeys(x[1:]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), ['b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'b', 'c'])
check('duplicate suffix is retained', solve(['c','b','b']), ['b','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: Remove exactly the first positional element.

Remove exactly the first positional element. 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(x, y=None):
    return [v for v in x if v != x[-1]] if x else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), ['a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'b'])
check('last value also occurs earlier', solve(['a','b','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

N = 1
observations = []
def solve(x, y=None):
    return list(dict.fromkeys(x[:-1]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), ['a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', 'a', 'b'])
check('last value also occurs earlier', solve(['a','b','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: Remove exactly the last positional element.

Remove exactly the last positional element. 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(x, y=None):
    return x[1:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['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

N = 1
observations = []
def solve(x, y=None):
    return x[:-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['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: Return the positional interior, excluding first and last elements.

Return the positional interior, excluding first and last 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

N = 1
observations = []
def solve(x, y=None):
    return x[1::2]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', '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

N = 1
observations = []
def solve(x, y=None):
    return list(dict.fromkeys(x[::2]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['b', '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: Select positions 0,2,4 and so on, retaining duplicates.

Select positions 0,2,4 and so on, 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

N = 1
observations = []
def solve(x, y=None):
    return x[::2]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), ['b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'c'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return x[1:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), ['b'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'c'])
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: Select positions 1,3,5 and so on.

Select positions 1,3,5 and so on. 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(x, y=None):
    return x[-1:]+x[:-1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'b', 'c', '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

N = 1
observations = []
def solve(x, y=None):
    return x[1:]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['a', 'b', 'c', '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: Move the first item to the end; empty input remains empty.

Move the first item to the end; empty input 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

N = 1
observations = []
def solve(x, y=None):
    return x[1:]+x[:1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['c', 'b', '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

N = 1
observations = []
def solve(x, y=None):
    return x[-1:]+x
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), ['a'])
check('two distinct elements', solve(['a', 'b']), ['b', 'a'])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), ['c', 'b', '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: Move the last item to the front; empty input remains empty.

Move the last item to the front; empty input 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

N = 1
observations = []
def solve(x, y=None):
    return [x[i:i+2] for i in range(0,len(x),2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [['a', 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [['b', 'a'], ['a', 'b'], ['b', 'c']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return [[x[i],x[(i+1)%len(x)]] for i in range(len(x))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [['a', 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [['b', 'a'], ['a', 'b'], ['b', 'c']])
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: Emit overlapping adjacent pairs, omitting an incomplete singleton.

Emit overlapping adjacent pairs, omitting an incomplete singleton. 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(x, y=None):
    return [[x[i],x[i+1]] for i in range(len(x)-1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [['a']])
check('two distinct elements', solve(['a', 'b']), [['a', 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [['b', 'a'], ['b', 'c']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return [x[i:i+2] for i in range(0,len(x)-1,2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [['a']])
check('two distinct elements', solve(['a', 'b']), [['a', 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [['b', 'a'], ['b', 'c']])
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: Split into nonoverlapping pairs and preserve a final singleton.

Split into nonoverlapping pairs and preserve a final singleton. 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(x, y=None):
    return [x[:i] for i in range(len(x))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [['a']])
check('two distinct elements', solve(['a', 'b']), [['a'], ['a', 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [['b'], ['b', 'a'], ['b', 'a', 'b'], ['b', 'a', 'b', 'c']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return [x[:i] for i in range(1,len(x))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [['a']])
check('two distinct elements', solve(['a', 'b']), [['a'], ['a', 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [['b'], ['b', 'a'], ['b', 'a', 'b'], ['b', 'a', 'b', 'c']])
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: Return all nonempty prefixes in increasing length, including the complete list.

Return all nonempty prefixes in increasing length, including the complete 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

N = 1
observations = []
def solve(x, y=None):
    return [x[i:] for i in range(1,len(x)+1)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [['a']])
check('two distinct elements', solve(['a', 'b']), [['a', 'b'], ['b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [['b', 'a', 'b', 'c'], ['a', 'b', 'c'], ['b', 'c'], ['c']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return [x[:i] for i in range(len(x))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [['a']])
check('two distinct elements', solve(['a', 'b']), [['a', 'b'], ['b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [['b', 'a', 'b', 'c'], ['a', 'b', 'c'], ['b', 'c'], ['c']])
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: Return all nonempty suffixes in increasing start-position order.

Return all nonempty suffixes in increasing start-position 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(x, y=None):
    return [[i+1,v] for i,v in enumerate(x)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [[0, 'a']])
check('two distinct elements', solve(['a', 'b']), [[0, 'a'], [1, 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [[0, 'b'], [1, 'a'], [2, 'b'], [3, 'c']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return [[x.index(v),v] for v in x]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [[0, 'a']])
check('two distinct elements', solve(['a', 'b']), [[0, 'a'], [1, 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [[0, 'b'], [1, 'a'], [2, 'b'], [3, 'c']])
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: Pair each element with its original zero-based position.

Pair each element with its original zero-based position. 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(x, y=None):
    return [[i,v] for i,v in enumerate(reversed(x))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [[0, 'a']])
check('two distinct elements', solve(['a', 'b']), [[1, 'b'], [0, 'a']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [[3, 'c'], [2, 'b'], [1, 'a'], [0, '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

N = 1
observations = []
def solve(x, y=None):
    return [[x.index(v),v] for v in reversed(x)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [[0, 'a']])
check('two distinct elements', solve(['a', 'b']), [[1, 'b'], [0, 'a']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [[3, 'c'], [2, 'b'], [1, 'a'], [0, '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: Visit elements in reverse order while retaining their original indices.

Visit elements in reverse order while retaining their original indices. 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(x, y=None):
    return [[i,v] for i,v in enumerate(sorted(x))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [[0, 'a']])
check('two distinct elements', solve(['a', 'b']), [[0, 'a'], [1, 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [[1, 'a'], [0, 'b'], [2, 'b'], [3, 'c']])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x, y=None):
    return [[x.index(v),v] for v in sorted(x)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [[0, 'a']])
check('two distinct elements', solve(['a', 'b']), [[0, 'a'], [1, 'b']])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [[1, 'a'], [0, 'b'], [2, 'b'], [3, 'c']])
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: Sort values lexically and retain original positions, preserving original order among equal values.

Sort values lexically and retain original positions, preserving original order among equal 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

N = 1
observations = []
def solve(x, y=None):
    return [i for i in range(len(x)) if i==0 or x[i]!=x[i-1]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [1, 2, 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

N = 1
observations = []
def solve(x, y=None):
    return [i for i in range(1,len(x)) if x[i] not in x[:i]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [])
check('two distinct elements', solve(['a', 'b']), [1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [1, 2, 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: Return indices whose element differs from its predecessor; position zero is not a change.

Return indices whose element differs from its predecessor; position zero is not a change. 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(x, y=None):
    return [i for i,v in enumerate(x) if v not in x[i+1:]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [0])
check('two distinct elements', solve(['a', 'b']), [0, 1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [0, 1, 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

N = 1
observations = []
def solve(x, y=None):
    return list(range(len(x)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('empty collection', solve([]), [])
check('singleton collection', solve(['a']), [0])
check('two distinct elements', solve(['a', 'b']), [0, 1])
check('nonadjacent duplicate and unsorted order', solve(['b', 'a', 'b', 'c']), [0, 1, 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: Return positions at which each distinct value first appears.

Return positions at which each distinct value first appears. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

split: open-access