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

N = 1
observations = []
def solve(convs):
    def activity(c):
        return max(c['last_msg'], c['draft_ts'] or 0)
    pinned = sorted((c for c in convs if c['pinned'] is not None), key=lambda c: c['pinned'])
    rest = sorted((c for c in convs if c['pinned'] is None), key=lambda c: (activity(c), c['id']))
    return [c['id'] for c in pinned + rest]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 21, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 4, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 21, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 91, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 2: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 22, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 22, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 92, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 3: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 23, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 6, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 23, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 93, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 4: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 24, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 24, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 94, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 5: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 25, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': None}],), ['z', 'c', 'm']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 25, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 95, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(convs):
    def activity(c):
        return max(c['last_msg'], c['draft_ts'] or 0)
    pinned = sorted((c for c in convs if c['pinned'] is not None), key=lambda c: c['pinned'])
    rest = sorted((c for c in convs if c['pinned'] is None), key=lambda c: -activity(c))
    return [c['id'] for c in pinned + rest]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 21, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 4, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 21, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 91, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 2: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 22, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 22, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 92, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 3: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 23, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 6, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 23, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 93, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 4: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 24, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 24, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 94, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 5: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 25, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': None}],), ['z', 'c', 'm']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 25, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 95, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The least active conversations are listed first, or ties follow input order.

convs {id, pinned (rank or None), last_msg, last_silent, draft_ts (or None)}. Pinned conversations come first by pin rank (rank 0 is a valid pin). The rest are ordered by activity descending, then id ascending, where activity is the later of the last real message and the local draft; silent events (avatar or topic changes) never count.

split: open-access


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

N = 1
observations = []
def solve(convs):
    def activity(c):
        return max(c['last_msg'], c['draft_ts'] or 0)
    pinned = sorted((c for c in convs if c['pinned'] is not None), key=lambda c: -activity(c))
    rest = sorted((c for c in convs if c['pinned'] is None), key=lambda c: (-activity(c), c['id']))
    return [c['id'] for c in pinned + rest]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 21, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 4, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 21, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 91, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 2: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 22, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 22, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 92, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 3: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 23, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 6, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 23, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 93, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 4: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 24, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 24, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 94, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 5: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 25, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': None}],), ['z', 'c', 'm']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 25, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 95, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(convs):
    def activity(c):
        return max(c['last_msg'], c['draft_ts'] or 0)
    pinned = sorted((c for c in convs if c['pinned'] is not None), key=lambda c: (-activity(c), c['pinned']))
    rest = sorted((c for c in convs if c['pinned'] is None), key=lambda c: (-activity(c), c['id']))
    return [c['id'] for c in pinned + rest]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 21, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 4, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 21, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 91, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 2: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 22, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 22, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 92, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 3: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 23, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 6, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 23, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 93, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 4: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 24, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}],), ['c', 'm', 'z']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 24, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 94, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])], 5: [('silent topic change', ([{'id': 'a', 'pinned': None, 'last_msg': 10, 'last_silent': 99, 'draft_ts': None}, {'id': 'b', 'pinned': None, 'last_msg': 25, 'last_silent': 0, 'draft_ts': None}],), ['b', 'a']), ('pin rank zero', ([{'id': 'p0', 'pinned': 0, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'p1', 'pinned': 1, 'last_msg': 2, 'last_silent': 0, 'draft_ts': None}, {'id': 'x', 'pinned': None, 'last_msg': 50, 'last_silent': 0, 'draft_ts': None}],), ['p0', 'p1', 'x']), ('activity ties', ([{'id': 'm', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'c', 'pinned': None, 'last_msg': 7, 'last_silent': 0, 'draft_ts': None}, {'id': 'z', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': None}],), ['z', 'c', 'm']), ('draft bumps', ([{'id': 'd', 'pinned': None, 'last_msg': 5, 'last_silent': 0, 'draft_ts': 30}, {'id': 'e', 'pinned': None, 'last_msg': 25, 'last_silent': 0, 'draft_ts': None}],), ['d', 'e']), ('pins by rank not activity', ([{'id': 'old', 'pinned': 1, 'last_msg': 1, 'last_silent': 0, 'draft_ts': None}, {'id': 'new', 'pinned': 2, 'last_msg': 95, 'last_silent': 0, 'draft_ts': None}],), ['old', 'new']), ('silent without draft', ([{'id': 'q', 'pinned': None, 'last_msg': 4, 'last_silent': 60, 'draft_ts': None}, {'id': 'r', 'pinned': None, 'last_msg': 8, 'last_silent': 0, 'draft_ts': 2}],), ['r', 'q'])]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Pinned conversations reshuffle by activity instead of keeping the user's pin order.

convs {id, pinned (rank or None), last_msg, last_silent, draft_ts (or None)}. Pinned conversations come first by pin rank (rank 0 is a valid pin). The rest are ordered by activity descending, then id ascending, where activity is the later of the last real message and the local draft; silent events (avatar or topic changes) never count.

split: open-access


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

N = 1
observations = []
def solve(messages, me, marker, suppress_everyone):
    hits = []
    for seq, author, mentions in sorted(messages):
        if seq <= marker or author == me:
            continue
        if me in mentions or '@everyone' in mentions:
            hits.append(seq)
    return {'count': len(hits), 'jump': hits[0] if hits else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('suppressed everyone', ([[6, 'bo', ['@everyone']], [7, 'bo', ['me']], [8, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 7}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[10, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 2, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 2: [('suppressed everyone', ([[7, 'bo', ['@everyone']], [8, 'bo', ['me']], [9, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 8}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[11, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 3, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 3: [('suppressed everyone', ([[8, 'bo', ['@everyone']], [9, 'bo', ['me']], [10, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 9}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[12, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 4, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 4: [('suppressed everyone', ([[9, 'bo', ['@everyone']], [10, 'bo', ['me']], [11, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 10}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[13, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 5, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 5: [('suppressed everyone', ([[10, 'bo', ['@everyone']], [11, 'bo', ['me']], [12, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 11}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[14, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 6, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(messages, me, marker, suppress_everyone):
    hits = []
    for seq, author, mentions in sorted(messages):
        if seq <= marker or author == me:
            continue
        if me in mentions or (('@everyone' in mentions) != suppress_everyone):
            hits.append(seq)
    return {'count': len(hits), 'jump': hits[0] if hits else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('suppressed everyone', ([[6, 'bo', ['@everyone']], [7, 'bo', ['me']], [8, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 7}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[10, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 2, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 2: [('suppressed everyone', ([[7, 'bo', ['@everyone']], [8, 'bo', ['me']], [9, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 8}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[11, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 3, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 3: [('suppressed everyone', ([[8, 'bo', ['@everyone']], [9, 'bo', ['me']], [10, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 9}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[12, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 4, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 4: [('suppressed everyone', ([[9, 'bo', ['@everyone']], [10, 'bo', ['me']], [11, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 10}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[13, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 5, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 5: [('suppressed everyone', ([[10, 'bo', ['@everyone']], [11, 'bo', ['me']], [12, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 11}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[14, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 6, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Rooms that suppress @everyone still count it as a personal mention.

messages are [seq, author, mentions]. A message after the marker, not written by me, counts when it mentions me directly or mentions "@everyone" while the room does not suppress @everyone. Messages are evaluated in seq order and the jump target is the earliest counted seq. Result {count, jump}.

split: open-access


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

N = 1
observations = []
def solve(messages, me, marker, suppress_everyone):
    hits = []
    for seq, author, mentions in sorted(messages):
        if seq <= marker :
            continue
        if me in mentions or ('@everyone' in mentions and not suppress_everyone):
            hits.append(seq)
    return {'count': len(hits), 'jump': hits[0] if hits else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('suppressed everyone', ([[6, 'bo', ['@everyone']], [7, 'bo', ['me']], [8, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 7}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[10, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 2, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 2: [('suppressed everyone', ([[7, 'bo', ['@everyone']], [8, 'bo', ['me']], [9, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 8}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[11, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 3, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 3: [('suppressed everyone', ([[8, 'bo', ['@everyone']], [9, 'bo', ['me']], [10, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 9}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[12, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 4, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 4: [('suppressed everyone', ([[9, 'bo', ['@everyone']], [10, 'bo', ['me']], [11, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 10}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[13, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 5, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 5: [('suppressed everyone', ([[10, 'bo', ['@everyone']], [11, 'bo', ['me']], [12, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 11}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[14, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 6, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(messages, me, marker, suppress_everyone):
    hits = []
    for seq, author, mentions in sorted(messages):
        if seq <= marker or (author == me and '@everyone' not in mentions):
            continue
        if me in mentions or ('@everyone' in mentions and not suppress_everyone):
            hits.append(seq)
    return {'count': len(hits), 'jump': hits[0] if hits else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('suppressed everyone', ([[6, 'bo', ['@everyone']], [7, 'bo', ['me']], [8, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 7}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[10, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 2, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 2: [('suppressed everyone', ([[7, 'bo', ['@everyone']], [8, 'bo', ['me']], [9, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 8}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[11, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 3, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 3: [('suppressed everyone', ([[8, 'bo', ['@everyone']], [9, 'bo', ['me']], [10, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 9}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[12, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 4, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 4: [('suppressed everyone', ([[9, 'bo', ['@everyone']], [10, 'bo', ['me']], [11, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 10}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[13, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 5, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 5: [('suppressed everyone', ([[10, 'bo', ['@everyone']], [11, 'bo', ['me']], [12, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 11}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[14, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 6, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The user's own @everyone message counts as an unread mention.

messages are [seq, author, mentions]. A message after the marker, not written by me, counts when it mentions me directly or mentions "@everyone" while the room does not suppress @everyone. Messages are evaluated in seq order and the jump target is the earliest counted seq. Result {count, jump}.

split: open-access


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

N = 1
observations = []
def solve(messages, me, marker, suppress_everyone):
    hits = []
    for seq, author, mentions in messages:
        if seq <= marker or author == me:
            continue
        if me in mentions or ('@everyone' in mentions and not suppress_everyone):
            hits.append(seq)
    return {'count': len(hits), 'jump': hits[0] if hits else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('suppressed everyone', ([[6, 'bo', ['@everyone']], [7, 'bo', ['me']], [8, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 7}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[10, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 2, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 2: [('suppressed everyone', ([[7, 'bo', ['@everyone']], [8, 'bo', ['me']], [9, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 8}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[11, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 3, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 3: [('suppressed everyone', ([[8, 'bo', ['@everyone']], [9, 'bo', ['me']], [10, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 9}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[12, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 4, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 4: [('suppressed everyone', ([[9, 'bo', ['@everyone']], [10, 'bo', ['me']], [11, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 10}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[13, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 5, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 5: [('suppressed everyone', ([[10, 'bo', ['@everyone']], [11, 'bo', ['me']], [12, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 11}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[14, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 6, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(messages, me, marker, suppress_everyone):
    hits = []
    for seq, author, mentions in sorted(messages, key=lambda m: m[1]):
        if seq <= marker or author == me:
            continue
        if me in mentions or ('@everyone' in mentions and not suppress_everyone):
            hits.append(seq)
    return {'count': len(hits), 'jump': hits[0] if hits else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('suppressed everyone', ([[6, 'bo', ['@everyone']], [7, 'bo', ['me']], [8, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 7}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[10, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 2, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 2: [('suppressed everyone', ([[7, 'bo', ['@everyone']], [8, 'bo', ['me']], [9, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 8}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[11, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 3, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 3: [('suppressed everyone', ([[8, 'bo', ['@everyone']], [9, 'bo', ['me']], [10, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 9}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[12, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 4, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 4: [('suppressed everyone', ([[9, 'bo', ['@everyone']], [10, 'bo', ['me']], [11, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 10}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[13, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 5, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})], 5: [('suppressed everyone', ([[10, 'bo', ['@everyone']], [11, 'bo', ['me']], [12, 'cy', []]], 'me', 0, True), {'count': 1, 'jump': 11}), ('own everyone ping', ([[3, 'me', ['@everyone']], [4, 'bo', []]], 'me', 1, False), {'count': 0, 'jump': None}), ('out of order arrival', ([[14, 'bo', ['me']], [4, 'cy', ['me']]], 'me', 2, False), {'count': 2, 'jump': 4}), ('everyone allowed', ([[2, 'bo', ['@everyone']]], 'me', 1, False), {'count': 1, 'jump': 2}), ('already read', ([[1, 'bo', ['me']]], 'me', 6, False), {'count': 0, 'jump': None}), ('direct mention when suppressed', ([[7, 'bo', ['me', '@everyone']]], 'me', 3, True), {'count': 1, 'jump': 7})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The jump button targets a later mention because messages are scanned in arrival order.

messages are [seq, author, mentions]. A message after the marker, not written by me, counts when it mentions me directly or mentions "@everyone" while the room does not suppress @everyone. Messages are evaluated in seq order and the jump target is the earliest counted seq. Result {count, jump}.

split: open-access


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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = join_seq
    vis = [s for s in sorted(set(messages)) if s >= lo and (leave_seq is None or s <= leave_seq)]
    return {'visible': vis, 'initial_marker': join_seq - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = join_seq - 1 if history_visible else join_seq
    vis = [s for s in sorted(set(messages)) if s >= lo and (leave_seq is None or s <= leave_seq)]
    return {'visible': vis, 'initial_marker': join_seq - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Rooms configured to share history with new members still hide everything before the join.

messages are seqs (duplicates possible). A member sees seqs >= join_seq, or all seqs from 1 when the room shares history with new members; after leaving at leave_seq they see nothing after leave_seq (their own leave event included). The initial read marker is join_seq - 1, so only messages from the join onward are unread. Result {visible (sorted, unique), initial_marker}.

split: open-access


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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = 1 if history_visible else join_seq
    vis = [s for s in sorted(set(messages)) if s > lo and (leave_seq is None or s <= leave_seq)]
    return {'visible': vis, 'initial_marker': join_seq - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = 1 if history_visible else join_seq
    vis = [s for s in sorted(set(messages)) if (s >= lo if history_visible else s > lo) and (leave_seq is None or s <= leave_seq)]
    return {'visible': vis, 'initial_marker': join_seq - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The message that announces or accompanies the join is hidden from the joining member.

messages are seqs (duplicates possible). A member sees seqs >= join_seq, or all seqs from 1 when the room shares history with new members; after leaving at leave_seq they see nothing after leave_seq (their own leave event included). The initial read marker is join_seq - 1, so only messages from the join onward are unread. Result {visible (sorted, unique), initial_marker}.

split: open-access


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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = 1 if history_visible else join_seq
    vis = [s for s in sorted(set(messages)) if s >= lo and (leave_seq is None or s < leave_seq)]
    return {'visible': vis, 'initial_marker': join_seq - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = 1 if history_visible else join_seq
    vis = [s for s in sorted(set(messages)) if s >= lo and (leave_seq is None or (s <= leave_seq if history_visible else s < leave_seq))]
    return {'visible': vis, 'initial_marker': join_seq - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The member cannot see their own leave event.

messages are seqs (duplicates possible). A member sees seqs >= join_seq, or all seqs from 1 when the room shares history with new members; after leaving at leave_seq they see nothing after leave_seq (their own leave event included). The initial read marker is join_seq - 1, so only messages from the join onward are unread. Result {visible (sorted, unique), initial_marker}.

split: open-access


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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = 1 if history_visible else join_seq
    vis = [s for s in sorted(set(messages)) if s >= lo and (leave_seq is None or s <= leave_seq)]
    return {'visible': vis, 'initial_marker': join_seq}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = 1 if history_visible else join_seq
    vis = [s for s in sorted(set(messages)) if s >= lo and (leave_seq is None or s <= leave_seq)]
    return {'visible': vis, 'initial_marker': lo - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The first message after the join is already considered read.

messages are seqs (duplicates possible). A member sees seqs >= join_seq, or all seqs from 1 when the room shares history with new members; after leaving at leave_seq they see nothing after leave_seq (their own leave event included). The initial read marker is join_seq - 1, so only messages from the join onward are unread. Result {visible (sorted, unique), initial_marker}.

split: open-access


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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = 1 if history_visible else join_seq
    vis = [s for s in sorted(messages) if s >= lo and (leave_seq is None or s <= leave_seq)]
    return {'visible': vis, 'initial_marker': join_seq - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(messages, join_seq, leave_seq, history_visible):
    lo = 1 if history_visible else join_seq
    vis = [s for s in list(dict.fromkeys(messages)) if s >= lo and (leave_seq is None or s <= leave_seq)]
    return {'visible': vis, 'initial_marker': join_seq - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_CASES = {1: [('shared history', ([1, 2, 3, 5], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 5]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 4, None, False), {'initial_marker': 3, 'visible': []})], 2: [('shared history', ([1, 2, 3, 6], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 6]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 5, None, False), {'initial_marker': 4, 'visible': []})], 3: [('shared history', ([1, 2, 3, 7], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 7]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 6, None, False), {'initial_marker': 5, 'visible': []})], 4: [('shared history', ([1, 2, 3, 8], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 8]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 8], 7, None, False), {'initial_marker': 6, 'visible': [7, 8, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 7, None, False), {'initial_marker': 6, 'visible': []})], 5: [('shared history', ([1, 2, 3, 9], 3, None, True), {'initial_marker': 2, 'visible': [1, 2, 3, 9]}), ('join message visible', ([4, 5, 6], 5, None, False), {'initial_marker': 4, 'visible': [5, 6]}), ('leave event visible', ([5, 6, 7, 8], 5, 7, False), {'initial_marker': 4, 'visible': [5, 6, 7]}), ('duplicate deliveries', ([9, 7, 7, 9], 7, None, False), {'initial_marker': 6, 'visible': [7, 9]}), ('history visible after leave', ([1, 2, 3], 2, 2, True), {'initial_marker': 1, 'visible': [1, 2]}), ('nothing yet', ([], 8, None, False), {'initial_marker': 7, 'visible': []})]}
for _label, _args, _expected in _CASES[N]:
    check(_label, solve(*_args), _expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Duplicated deliveries appear twice in the visible history.

messages are seqs (duplicates possible). A member sees seqs >= join_seq, or all seqs from 1 when the room shares history with new members; after leaving at leave_seq they see nothing after leave_seq (their own leave event included). The initial read marker is join_seq - 1, so only messages from the join onward are unread. Result {visible (sorted, unique), initial_marker}.

split: open-access