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

N = 1
observations = []
def solve(x):
    base = 40 if x['call_type'] in ('hall', 'both') else 25
    if x['accessible']:
        base = base * 3 // 2
    pax = x['boarding'] + x['alighting']
    dwell = base + 10 * pax
    dwell = min(dwell, 150)
    nudge = x['reopen_count'] >= 3
    if nudge:
        dwell = 20
    return {'dwell_ds': dwell, 'nudge': nudge}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('regression: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('control 69', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 1, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('regression: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 1', {'call_type': 'both', 'boarding': 6, 'alighting': 3, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 4', {'call_type': 'hall', 'boarding': 5, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 100, 'nudge': False}), ('control 7', {'call_type': 'both', 'boarding': 5, 'alighting': 1, 'reopen_count': 4, 'accessible': True}, {'dwell_ds': 20, 'nudge': True})], [('regression: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('sampled regression 11', {'call_type': 'car', 'boarding': 0, 'alighting': 3, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 45, 'nudge': False}), ('regression: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('boundary: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('control 12', {'call_type': 'car', 'boarding': 0, 'alighting': 4, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 15', {'call_type': 'hall', 'boarding': 2, 'alighting': 5, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 100, 'nudge': False}), ('control 18', {'call_type': 'car', 'boarding': 8, 'alighting': 7, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 150, 'nudge': False})], [('regression: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('sampled regression 23', {'call_type': 'hall', 'boarding': 7, 'alighting': 3, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 130, 'nudge': False}), ('control 69', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 1, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('boundary: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 26', {'call_type': 'both', 'boarding': 3, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 110, 'nudge': False}), ('control 29', {'call_type': 'both', 'boarding': 1, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 32', {'call_type': 'both', 'boarding': 8, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('sampled regression 41', {'call_type': 'hall', 'boarding': 0, 'alighting': 5, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 80, 'nudge': False}), ('boundary: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('regression: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('sampled regression 34', {'call_type': 'hall', 'boarding': 3, 'alighting': 5, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 110, 'nudge': False}), ('control 37', {'call_type': 'hall', 'boarding': 4, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 40', {'call_type': 'car', 'boarding': 1, 'alighting': 8, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('sampled regression 58', {'call_type': 'both', 'boarding': 7, 'alighting': 1, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('control 69', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 1, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('regression: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 45', {'call_type': 'both', 'boarding': 6, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 48', {'call_type': 'hall', 'boarding': 3, 'alighting': 8, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 140, 'nudge': False}), ('sampled regression 51', {'call_type': 'hall', 'boarding': 2, 'alighting': 4, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 90, 'nudge': False})]]
for label, args, expected in fixtures[N-1]:
    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(x):
    base = 40 if x['call_type'] in ('hall', 'both') else 25
    if x['accessible']:
        base = base * 3 // 2
    pax = x['boarding'] + x['alighting']
    dwell = base + 10 * (pax - 1)
    dwell = min(dwell, 150)
    nudge = x['reopen_count'] >= 3
    if nudge:
        dwell = 20
    return {'dwell_ds': dwell, 'nudge': nudge}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('regression: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('control 69', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 1, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('regression: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 1', {'call_type': 'both', 'boarding': 6, 'alighting': 3, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 4', {'call_type': 'hall', 'boarding': 5, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 100, 'nudge': False}), ('control 7', {'call_type': 'both', 'boarding': 5, 'alighting': 1, 'reopen_count': 4, 'accessible': True}, {'dwell_ds': 20, 'nudge': True})], [('regression: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('sampled regression 11', {'call_type': 'car', 'boarding': 0, 'alighting': 3, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 45, 'nudge': False}), ('regression: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('boundary: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('control 12', {'call_type': 'car', 'boarding': 0, 'alighting': 4, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 15', {'call_type': 'hall', 'boarding': 2, 'alighting': 5, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 100, 'nudge': False}), ('control 18', {'call_type': 'car', 'boarding': 8, 'alighting': 7, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 150, 'nudge': False})], [('regression: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('sampled regression 23', {'call_type': 'hall', 'boarding': 7, 'alighting': 3, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 130, 'nudge': False}), ('control 69', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 1, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('boundary: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 26', {'call_type': 'both', 'boarding': 3, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 110, 'nudge': False}), ('control 29', {'call_type': 'both', 'boarding': 1, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 32', {'call_type': 'both', 'boarding': 8, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('sampled regression 41', {'call_type': 'hall', 'boarding': 0, 'alighting': 5, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 80, 'nudge': False}), ('boundary: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('regression: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('sampled regression 34', {'call_type': 'hall', 'boarding': 3, 'alighting': 5, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 110, 'nudge': False}), ('control 37', {'call_type': 'hall', 'boarding': 4, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 40', {'call_type': 'car', 'boarding': 1, 'alighting': 8, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('sampled regression 58', {'call_type': 'both', 'boarding': 7, 'alighting': 1, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('control 69', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 1, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('regression: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 45', {'call_type': 'both', 'boarding': 6, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 48', {'call_type': 'hall', 'boarding': 3, 'alighting': 8, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 140, 'nudge': False}), ('sampled regression 51', {'call_type': 'hall', 'boarding': 2, 'alighting': 4, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 90, 'nudge': False})]]
for label, args, expected in fixtures[N-1]:
    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:
Every stop is ten deciseconds longer than stipulated, or shorter when nobody moves.

Dwell time in deciseconds: base 40 for a hall call stop (or a stop with both hall and car calls), 25 for a car-call-only stop. Accessible mode extends the base by half (integer). Every passenger beyond the first adds 10. The result is capped at 150. From the third reopen onward the door nudges with a fixed dwell of 20.

split: open-access


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

N = 1
observations = []
def solve(x):
    base = 40 if x['call_type'] in ('hall', 'both') else 25
    if x['accessible']:
        base = base * 3 // 2
    pax = x['boarding'] + x['alighting']
    dwell = base + 10 * max(pax - 1, 0)
    dwell = dwell
    nudge = x['reopen_count'] >= 3
    if nudge:
        dwell = 20
    return {'dwell_ds': dwell, 'nudge': nudge}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 18', {'call_type': 'car', 'boarding': 8, 'alighting': 7, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 1', {'call_type': 'both', 'boarding': 6, 'alighting': 3, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 4', {'call_type': 'hall', 'boarding': 5, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 100, 'nudge': False}), ('control 7', {'call_type': 'both', 'boarding': 5, 'alighting': 1, 'reopen_count': 4, 'accessible': True}, {'dwell_ds': 20, 'nudge': True})], [('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 80', {'call_type': 'both', 'boarding': 7, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('boundary: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('control 12', {'call_type': 'car', 'boarding': 0, 'alighting': 4, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 15', {'call_type': 'hall', 'boarding': 2, 'alighting': 5, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 100, 'nudge': False}), ('sampled regression 18', {'call_type': 'car', 'boarding': 8, 'alighting': 7, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 150, 'nudge': False})], [('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 59', {'call_type': 'both', 'boarding': 4, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('boundary: third reopen', {'call_type': 'hall', 'boarding': 2, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 23', {'call_type': 'hall', 'boarding': 7, 'alighting': 3, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 130, 'nudge': False}), ('control 26', {'call_type': 'both', 'boarding': 3, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 110, 'nudge': False}), ('control 29', {'call_type': 'both', 'boarding': 1, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 33', {'call_type': 'hall', 'boarding': 6, 'alighting': 5, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('boundary: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('control 34', {'call_type': 'hall', 'boarding': 3, 'alighting': 5, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 110, 'nudge': False}), ('control 37', {'call_type': 'hall', 'boarding': 4, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 40', {'call_type': 'car', 'boarding': 1, 'alighting': 8, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('boundary: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('control 45', {'call_type': 'both', 'boarding': 6, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 48', {'call_type': 'hall', 'boarding': 3, 'alighting': 8, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 140, 'nudge': False}), ('control 51', {'call_type': 'hall', 'boarding': 2, 'alighting': 4, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 90, 'nudge': False})]]
for label, args, expected in fixtures[N-1]:
    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(x):
    base = 40 if x['call_type'] in ('hall', 'both') else 25
    if x['accessible']:
        base = base * 3 // 2
    pax = x['boarding'] + x['alighting']
    dwell = base + 10 * max(pax - 1, 0)
    dwell = min(base, 150) + 10 * max(pax - 1, 0)
    nudge = x['reopen_count'] >= 3
    if nudge:
        dwell = 20
    return {'dwell_ds': dwell, 'nudge': nudge}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 18', {'call_type': 'car', 'boarding': 8, 'alighting': 7, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 1', {'call_type': 'both', 'boarding': 6, 'alighting': 3, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 4', {'call_type': 'hall', 'boarding': 5, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 100, 'nudge': False}), ('control 7', {'call_type': 'both', 'boarding': 5, 'alighting': 1, 'reopen_count': 4, 'accessible': True}, {'dwell_ds': 20, 'nudge': True})], [('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 80', {'call_type': 'both', 'boarding': 7, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('boundary: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('control 12', {'call_type': 'car', 'boarding': 0, 'alighting': 4, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 15', {'call_type': 'hall', 'boarding': 2, 'alighting': 5, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 100, 'nudge': False}), ('sampled regression 18', {'call_type': 'car', 'boarding': 8, 'alighting': 7, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 150, 'nudge': False})], [('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 59', {'call_type': 'both', 'boarding': 4, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('boundary: third reopen', {'call_type': 'hall', 'boarding': 2, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 23', {'call_type': 'hall', 'boarding': 7, 'alighting': 3, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 130, 'nudge': False}), ('control 26', {'call_type': 'both', 'boarding': 3, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 110, 'nudge': False}), ('control 29', {'call_type': 'both', 'boarding': 1, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 33', {'call_type': 'hall', 'boarding': 6, 'alighting': 5, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('boundary: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('control 34', {'call_type': 'hall', 'boarding': 3, 'alighting': 5, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 110, 'nudge': False}), ('control 37', {'call_type': 'hall', 'boarding': 4, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 40', {'call_type': 'car', 'boarding': 1, 'alighting': 8, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 56', {'call_type': 'car', 'boarding': 6, 'alighting': 8, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 150, 'nudge': False}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('boundary: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('control 45', {'call_type': 'both', 'boarding': 6, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 48', {'call_type': 'hall', 'boarding': 3, 'alighting': 8, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 140, 'nudge': False}), ('control 51', {'call_type': 'hall', 'boarding': 2, 'alighting': 4, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 90, 'nudge': False})]]
for label, args, expected in fixtures[N-1]:
    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:
Crowded stops hold the car far beyond the maximum dwell.

Dwell time in deciseconds: base 40 for a hall call stop (or a stop with both hall and car calls), 25 for a car-call-only stop. Accessible mode extends the base by half (integer). Every passenger beyond the first adds 10. The result is capped at 150. From the third reopen onward the door nudges with a fixed dwell of 20.

split: open-access


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

N = 1
observations = []
def solve(x):
    base = 40 if x['call_type'] in ('hall', 'both') else 25
    if x['accessible']:
        base = base * 3 // 2
    pax = x['boarding'] + x['alighting']
    dwell = base + 10 * max(pax - 1, 0)
    dwell = min(dwell, 150)
    nudge = x['reopen_count'] > 3
    if nudge:
        dwell = 20
    return {'dwell_ds': dwell, 'nudge': nudge}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: third reopen', {'call_type': 'hall', 'boarding': 2, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 12', {'call_type': 'car', 'boarding': 0, 'alighting': 4, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 1', {'call_type': 'both', 'boarding': 6, 'alighting': 3, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 4', {'call_type': 'hall', 'boarding': 5, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 100, 'nudge': False}), ('control 7', {'call_type': 'both', 'boarding': 5, 'alighting': 1, 'reopen_count': 4, 'accessible': True}, {'dwell_ds': 20, 'nudge': True})], [('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 39', {'call_type': 'car', 'boarding': 3, 'alighting': 3, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('boundary: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 12', {'call_type': 'car', 'boarding': 0, 'alighting': 4, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 15', {'call_type': 'hall', 'boarding': 2, 'alighting': 5, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 100, 'nudge': False}), ('control 18', {'call_type': 'car', 'boarding': 8, 'alighting': 7, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 150, 'nudge': False})], [('regression: third reopen', {'call_type': 'hall', 'boarding': 2, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('boundary: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('control 23', {'call_type': 'hall', 'boarding': 7, 'alighting': 3, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 130, 'nudge': False}), ('control 26', {'call_type': 'both', 'boarding': 3, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 110, 'nudge': False}), ('sampled regression 29', {'call_type': 'both', 'boarding': 1, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 28', {'call_type': 'car', 'boarding': 1, 'alighting': 3, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 34', {'call_type': 'hall', 'boarding': 3, 'alighting': 5, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 110, 'nudge': False}), ('control 37', {'call_type': 'hall', 'boarding': 4, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 40', {'call_type': 'car', 'boarding': 1, 'alighting': 8, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: third reopen', {'call_type': 'hall', 'boarding': 2, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 54', {'call_type': 'both', 'boarding': 2, 'alighting': 7, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 45', {'call_type': 'both', 'boarding': 6, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 48', {'call_type': 'hall', 'boarding': 3, 'alighting': 8, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 140, 'nudge': False}), ('control 51', {'call_type': 'hall', 'boarding': 2, 'alighting': 4, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 90, 'nudge': False})]]
for label, args, expected in fixtures[N-1]:
    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(x):
    base = 40 if x['call_type'] in ('hall', 'both') else 25
    if x['accessible']:
        base = base * 3 // 2
    pax = x['boarding'] + x['alighting']
    dwell = base + 10 * max(pax - 1, 0)
    dwell = min(dwell, 150)
    nudge = x['reopen_count'] >= 3 and pax > 0
    if nudge:
        dwell = 20
    return {'dwell_ds': dwell, 'nudge': nudge}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: third reopen', {'call_type': 'hall', 'boarding': 2, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 12', {'call_type': 'car', 'boarding': 0, 'alighting': 4, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 1', {'call_type': 'both', 'boarding': 6, 'alighting': 3, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 4', {'call_type': 'hall', 'boarding': 5, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 100, 'nudge': False}), ('control 7', {'call_type': 'both', 'boarding': 5, 'alighting': 1, 'reopen_count': 4, 'accessible': True}, {'dwell_ds': 20, 'nudge': True})], [('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 39', {'call_type': 'car', 'boarding': 3, 'alighting': 3, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: accessible busy hall stop', {'call_type': 'hall', 'boarding': 5, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 130, 'nudge': False}), ('boundary: nobody boards or alights', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 25, 'nudge': False}), ('boundary: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('sampled regression 12', {'call_type': 'car', 'boarding': 0, 'alighting': 4, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 15', {'call_type': 'hall', 'boarding': 2, 'alighting': 5, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 100, 'nudge': False}), ('control 18', {'call_type': 'car', 'boarding': 8, 'alighting': 7, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 150, 'nudge': False})], [('regression: third reopen', {'call_type': 'hall', 'boarding': 2, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: crowd exceeds the cap', {'call_type': 'hall', 'boarding': 8, 'alighting': 8, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 150, 'nudge': False}), ('boundary: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('control 23', {'call_type': 'hall', 'boarding': 7, 'alighting': 3, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 130, 'nudge': False}), ('control 26', {'call_type': 'both', 'boarding': 3, 'alighting': 3, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 110, 'nudge': False}), ('sampled regression 29', {'call_type': 'both', 'boarding': 1, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 28', {'call_type': 'car', 'boarding': 1, 'alighting': 3, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: single passenger', {'call_type': 'hall', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 40, 'nudge': False}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 34', {'call_type': 'hall', 'boarding': 3, 'alighting': 5, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 110, 'nudge': False}), ('control 37', {'call_type': 'hall', 'boarding': 4, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 40', {'call_type': 'car', 'boarding': 1, 'alighting': 8, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True})], [('regression: third reopen', {'call_type': 'hall', 'boarding': 2, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('regression: third reopen with nobody moving', {'call_type': 'car', 'boarding': 0, 'alighting': 0, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('sampled regression 54', {'call_type': 'both', 'boarding': 2, 'alighting': 7, 'reopen_count': 3, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('boundary: stop with hall and car calls', {'call_type': 'both', 'boarding': 1, 'alighting': 1, 'reopen_count': 0, 'accessible': False}, {'dwell_ds': 50, 'nudge': False}), ('boundary: accessible car call stop', {'call_type': 'car', 'boarding': 1, 'alighting': 0, 'reopen_count': 0, 'accessible': True}, {'dwell_ds': 37, 'nudge': False}), ('control 45', {'call_type': 'both', 'boarding': 6, 'alighting': 0, 'reopen_count': 4, 'accessible': False}, {'dwell_ds': 20, 'nudge': True}), ('control 48', {'call_type': 'hall', 'boarding': 3, 'alighting': 8, 'reopen_count': 2, 'accessible': False}, {'dwell_ds': 140, 'nudge': False}), ('control 51', {'call_type': 'hall', 'boarding': 2, 'alighting': 4, 'reopen_count': 1, 'accessible': False}, {'dwell_ds': 90, 'nudge': False})]]
for label, args, expected in fixtures[N-1]:
    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 door keeps reopening on the third obstruction instead of nudging.

Dwell time in deciseconds: base 40 for a hall call stop (or a stop with both hall and car calls), 25 for a car-call-only stop. Accessible mode extends the base by half (integer). Every passenger beyond the first adds 10. The result is capped at 150. From the third reopen onward the door nudges with a fixed dwell of 20.

split: open-access


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

N = 1
observations = []
def solve(x):
    r = x['rated_kg']
    w = x['load_kg']
    if w * 100 >= r * 110:
        return {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}
    full = w * 100 >= r * 80
    nuisance = w * 100 < r * 10 and len(x['car_calls']) > 3
    return {'mode': 'bypass' if full else 'normal', 'depart': True, 'serve_hall': not full, 'cancel_car_calls': nuisance}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 7', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': [7, 6, 9, 4]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 1', {'rated_kg': 1000, 'load_kg': 800, 'car_calls': [0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 4', {'rated_kg': 1000, 'load_kg': 0, 'car_calls': [1, 6]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 10', {'rated_kg': 630, 'load_kg': 504, 'car_calls': [3, 6, 2, 8, 5, 7]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False})], [('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 12', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [6, 7, 4, 3, 9, 0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 15', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [7, 4, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 18', {'rated_kg': 450, 'load_kg': 45, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 78', {'rated_kg': 630, 'load_kg': 694, 'car_calls': [5, 4]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: empty car with four calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 23', {'rated_kg': 675, 'load_kg': 539, 'car_calls': [0, 7, 5, 9, 8, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 26', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [9, 6, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 29', {'rated_kg': 675, 'load_kg': 66, 'car_calls': [3, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 65', {'rated_kg': 450, 'load_kg': 496, 'car_calls': [6, 0, 7]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 34', {'rated_kg': 1275, 'load_kg': 126, 'car_calls': [7, 3, 1, 0, 2, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 37', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 40', {'rated_kg': 450, 'load_kg': 30, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 59', {'rated_kg': 675, 'load_kg': 750, 'car_calls': [2, 3, 6]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 45', {'rated_kg': 630, 'load_kg': 464, 'car_calls': [8, 7, 5, 9, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 48', {'rated_kg': 675, 'load_kg': 153, 'car_calls': [1, 7, 4, 5, 6, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 51', {'rated_kg': 450, 'load_kg': 330, 'car_calls': [6, 0, 7, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})]]
for label, args, expected in fixtures[N-1]:
    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(x):
    r = x['rated_kg']
    w = x['load_kg']
    if w > r + 110:
        return {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}
    full = w * 100 >= r * 80
    nuisance = w * 100 < r * 10 and len(x['car_calls']) > 3
    return {'mode': 'bypass' if full else 'normal', 'depart': True, 'serve_hall': not full, 'cancel_car_calls': nuisance}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 7', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': [7, 6, 9, 4]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 1', {'rated_kg': 1000, 'load_kg': 800, 'car_calls': [0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 4', {'rated_kg': 1000, 'load_kg': 0, 'car_calls': [1, 6]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 10', {'rated_kg': 630, 'load_kg': 504, 'car_calls': [3, 6, 2, 8, 5, 7]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False})], [('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 12', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [6, 7, 4, 3, 9, 0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 15', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [7, 4, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 18', {'rated_kg': 450, 'load_kg': 45, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 78', {'rated_kg': 630, 'load_kg': 694, 'car_calls': [5, 4]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: empty car with four calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 23', {'rated_kg': 675, 'load_kg': 539, 'car_calls': [0, 7, 5, 9, 8, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 26', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [9, 6, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 29', {'rated_kg': 675, 'load_kg': 66, 'car_calls': [3, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 65', {'rated_kg': 450, 'load_kg': 496, 'car_calls': [6, 0, 7]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 34', {'rated_kg': 1275, 'load_kg': 126, 'car_calls': [7, 3, 1, 0, 2, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 37', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 40', {'rated_kg': 450, 'load_kg': 30, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just over 110 percent', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': []}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 22', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [9, 7, 3]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 59', {'rated_kg': 675, 'load_kg': 750, 'car_calls': [2, 3, 6]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 45', {'rated_kg': 630, 'load_kg': 464, 'car_calls': [8, 7, 5, 9, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 48', {'rated_kg': 675, 'load_kg': 153, 'car_calls': [1, 7, 4, 5, 6, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 51', {'rated_kg': 450, 'load_kg': 330, 'car_calls': [6, 0, 7, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})]]
for label, args, expected in fixtures[N-1]:
    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:
A car loaded exactly to the overload limit refuses to depart, or a heavy overload departs.

Overload (load above 110% of rating) keeps the car at the floor: no departure, no hall service, no cancellation. Otherwise the car departs; at 80% or more it runs in bypass (ignores hall calls). Anti-nuisance cancels all car calls when the load is below 10% of rating and more than three car calls are registered. Percentages are exact integer comparisons.

split: open-access


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

N = 1
observations = []
def solve(x):
    r = x['rated_kg']
    w = x['load_kg']
    if w * 100 > r * 110:
        return {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}
    full = w * 100 > r * 80
    nuisance = w * 100 < r * 10 and len(x['car_calls']) > 3
    return {'mode': 'bypass' if full else 'normal', 'depart': True, 'serve_hall': not full, 'cancel_car_calls': nuisance}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 24', {'rated_kg': 630, 'load_kg': 504, 'car_calls': [4, 9, 2, 7, 5, 6]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 3', {'rated_kg': 450, 'load_kg': 321, 'car_calls': [9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 1', {'rated_kg': 1000, 'load_kg': 800, 'car_calls': [0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 4', {'rated_kg': 1000, 'load_kg': 0, 'car_calls': [1, 6]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 7', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': [7, 6, 9, 4]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False})], [('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 1', {'rated_kg': 1000, 'load_kg': 800, 'car_calls': [0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 30', {'rated_kg': 675, 'load_kg': 524, 'car_calls': [3, 6, 7, 2, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: empty car with four calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 12', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [6, 7, 4, 3, 9, 0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 15', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [7, 4, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 18', {'rated_kg': 450, 'load_kg': 45, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 75', {'rated_kg': 450, 'load_kg': 360, 'car_calls': [2, 5]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 48', {'rated_kg': 675, 'load_kg': 153, 'car_calls': [1, 7, 4, 5, 6, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: empty car with four calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 23', {'rated_kg': 675, 'load_kg': 539, 'car_calls': [0, 7, 5, 9, 8, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 26', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [9, 6, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 29', {'rated_kg': 675, 'load_kg': 66, 'car_calls': [3, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 64', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [3, 7, 8, 4, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 3', {'rated_kg': 450, 'load_kg': 321, 'car_calls': [9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 34', {'rated_kg': 1275, 'load_kg': 126, 'car_calls': [7, 3, 1, 0, 2, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 37', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 40', {'rated_kg': 450, 'load_kg': 30, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 26', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [9, 6, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 30', {'rated_kg': 675, 'load_kg': 524, 'car_calls': [3, 6, 7, 2, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 45', {'rated_kg': 630, 'load_kg': 464, 'car_calls': [8, 7, 5, 9, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 48', {'rated_kg': 675, 'load_kg': 153, 'car_calls': [1, 7, 4, 5, 6, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 51', {'rated_kg': 450, 'load_kg': 330, 'car_calls': [6, 0, 7, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})]]
for label, args, expected in fixtures[N-1]:
    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(x):
    r = x['rated_kg']
    w = x['load_kg']
    if w * 100 > r * 110:
        return {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}
    full = (r - w) * 100 <= r * 80
    nuisance = w * 100 < r * 10 and len(x['car_calls']) > 3
    return {'mode': 'bypass' if full else 'normal', 'depart': True, 'serve_hall': not full, 'cancel_car_calls': nuisance}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 24', {'rated_kg': 630, 'load_kg': 504, 'car_calls': [4, 9, 2, 7, 5, 6]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 3', {'rated_kg': 450, 'load_kg': 321, 'car_calls': [9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('sampled regression 1', {'rated_kg': 1000, 'load_kg': 800, 'car_calls': [0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 4', {'rated_kg': 1000, 'load_kg': 0, 'car_calls': [1, 6]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 7', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': [7, 6, 9, 4]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False})], [('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 1', {'rated_kg': 1000, 'load_kg': 800, 'car_calls': [0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 30', {'rated_kg': 675, 'load_kg': 524, 'car_calls': [3, 6, 7, 2, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: empty car with four calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 12', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [6, 7, 4, 3, 9, 0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 15', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [7, 4, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 18', {'rated_kg': 450, 'load_kg': 45, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 75', {'rated_kg': 450, 'load_kg': 360, 'car_calls': [2, 5]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 48', {'rated_kg': 675, 'load_kg': 153, 'car_calls': [1, 7, 4, 5, 6, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: empty car with four calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 23', {'rated_kg': 675, 'load_kg': 539, 'car_calls': [0, 7, 5, 9, 8, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 26', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [9, 6, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 29', {'rated_kg': 675, 'load_kg': 66, 'car_calls': [3, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 64', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [3, 7, 8, 4, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 3', {'rated_kg': 450, 'load_kg': 321, 'car_calls': [9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 34', {'rated_kg': 1275, 'load_kg': 126, 'car_calls': [7, 3, 1, 0, 2, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 37', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 40', {'rated_kg': 450, 'load_kg': 30, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('sampled regression 26', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [9, 6, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 30', {'rated_kg': 675, 'load_kg': 524, 'car_calls': [3, 6, 7, 2, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 45', {'rated_kg': 630, 'load_kg': 464, 'car_calls': [8, 7, 5, 9, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 48', {'rated_kg': 675, 'load_kg': 153, 'car_calls': [1, 7, 4, 5, 6, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 51', {'rated_kg': 450, 'load_kg': 330, 'car_calls': [6, 0, 7, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})]]
for label, args, expected in fixtures[N-1]:
    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:
A car at exactly 80% keeps stopping for hall calls, or a lightly loaded car bypasses them.

Overload (load above 110% of rating) keeps the car at the floor: no departure, no hall service, no cancellation. Otherwise the car departs; at 80% or more it runs in bypass (ignores hall calls). Anti-nuisance cancels all car calls when the load is below 10% of rating and more than three car calls are registered. Percentages are exact integer comparisons.

split: open-access


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

N = 1
observations = []
def solve(x):
    r = x['rated_kg']
    w = x['load_kg']
    if w * 100 > r * 110:
        return {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}
    full = w * 100 >= r * 80
    nuisance = w * 100 < r * 10 and len(x['car_calls']) >= 3
    return {'mode': 'bypass' if full else 'normal', 'depart': True, 'serve_hall': not full, 'cancel_car_calls': nuisance}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('sampled regression 67', {'rated_kg': 1275, 'load_kg': 30, 'car_calls': [3, 6, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: light passenger with many calls', {'rated_kg': 1275, 'load_kg': 70, 'car_calls': [0, 1, 2, 3, 4, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 1', {'rated_kg': 1000, 'load_kg': 800, 'car_calls': [0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 4', {'rated_kg': 1000, 'load_kg': 0, 'car_calls': [1, 6]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 7', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': [7, 6, 9, 4]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False})], [('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: light passenger with many calls', {'rated_kg': 1275, 'load_kg': 70, 'car_calls': [0, 1, 2, 3, 4, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 47', {'rated_kg': 675, 'load_kg': 30, 'car_calls': [8, 2, 5, 1]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 12', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [6, 7, 4, 3, 9, 0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 15', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [7, 4, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 18', {'rated_kg': 450, 'load_kg': 45, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('sampled regression 67', {'rated_kg': 1275, 'load_kg': 30, 'car_calls': [3, 6, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 8', {'rated_kg': 1275, 'load_kg': 126, 'car_calls': [0, 8, 7, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: empty car with four calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 23', {'rated_kg': 675, 'load_kg': 539, 'car_calls': [0, 7, 5, 9, 8, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 26', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [9, 6, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 29', {'rated_kg': 675, 'load_kg': 66, 'car_calls': [3, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: light passenger with many calls', {'rated_kg': 1275, 'load_kg': 70, 'car_calls': [0, 1, 2, 3, 4, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 58', {'rated_kg': 450, 'load_kg': 30, 'car_calls': [6, 7, 9, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 34', {'rated_kg': 1275, 'load_kg': 126, 'car_calls': [7, 3, 1, 0, 2, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 37', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 40', {'rated_kg': 450, 'load_kg': 30, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('sampled regression 67', {'rated_kg': 1275, 'load_kg': 30, 'car_calls': [3, 6, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 9', {'rated_kg': 630, 'load_kg': 30, 'car_calls': [0, 9, 2, 7, 1, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 45', {'rated_kg': 630, 'load_kg': 464, 'car_calls': [8, 7, 5, 9, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 48', {'rated_kg': 675, 'load_kg': 153, 'car_calls': [1, 7, 4, 5, 6, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 51', {'rated_kg': 450, 'load_kg': 330, 'car_calls': [6, 0, 7, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})]]
for label, args, expected in fixtures[N-1]:
    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(x):
    r = x['rated_kg']
    w = x['load_kg']
    if w * 100 > r * 110:
        return {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False}
    full = w * 100 >= r * 80
    nuisance = w * 100 < r * 10 and len(x['car_calls']) > 3 and w == 0
    return {'mode': 'bypass' if full else 'normal', 'depart': True, 'serve_hall': not full, 'cancel_car_calls': nuisance}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('sampled regression 67', {'rated_kg': 1275, 'load_kg': 30, 'car_calls': [3, 6, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: light passenger with many calls', {'rated_kg': 1275, 'load_kg': 70, 'car_calls': [0, 1, 2, 3, 4, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 1', {'rated_kg': 1000, 'load_kg': 800, 'car_calls': [0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 4', {'rated_kg': 1000, 'load_kg': 0, 'car_calls': [1, 6]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 7', {'rated_kg': 1000, 'load_kg': 1101, 'car_calls': [7, 6, 9, 4]}, {'mode': 'overload', 'depart': False, 'serve_hall': False, 'cancel_car_calls': False})], [('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: light passenger with many calls', {'rated_kg': 1275, 'load_kg': 70, 'car_calls': [0, 1, 2, 3, 4, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 47', {'rated_kg': 675, 'load_kg': 30, 'car_calls': [8, 2, 5, 1]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: exactly 80 percent', {'rated_kg': 630, 'load_kg': 504, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('boundary: just under 80 percent', {'rated_kg': 630, 'load_kg': 503, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 12', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [6, 7, 4, 3, 9, 0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 15', {'rated_kg': 630, 'load_kg': 693, 'car_calls': [7, 4, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 18', {'rated_kg': 450, 'load_kg': 45, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('sampled regression 67', {'rated_kg': 1275, 'load_kg': 30, 'car_calls': [3, 6, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 8', {'rated_kg': 1275, 'load_kg': 126, 'car_calls': [0, 8, 7, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: empty car with four calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 23', {'rated_kg': 675, 'load_kg': 539, 'car_calls': [0, 7, 5, 9, 8, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 26', {'rated_kg': 675, 'load_kg': 540, 'car_calls': [9, 6, 0]}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 29', {'rated_kg': 675, 'load_kg': 66, 'car_calls': [3, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: light passenger with many calls', {'rated_kg': 1275, 'load_kg': 70, 'car_calls': [0, 1, 2, 3, 4, 5]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 58', {'rated_kg': 450, 'load_kg': 30, 'car_calls': [6, 7, 9, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 34', {'rated_kg': 1275, 'load_kg': 126, 'car_calls': [7, 3, 1, 0, 2, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('control 37', {'rated_kg': 1000, 'load_kg': 100, 'car_calls': [0]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 40', {'rated_kg': 450, 'load_kg': 30, 'car_calls': []}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})], [('regression: empty car with three calls', {'rated_kg': 675, 'load_kg': 0, 'car_calls': [0, 1, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('boundary: fractional ten percent threshold', {'rated_kg': 675, 'load_kg': 67, 'car_calls': [0, 1, 2, 3, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('sampled regression 67', {'rated_kg': 1275, 'load_kg': 30, 'car_calls': [3, 6, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 9', {'rated_kg': 630, 'load_kg': 30, 'car_calls': [0, 9, 2, 7, 1, 4]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': True}), ('boundary: exactly 110 percent', {'rated_kg': 1000, 'load_kg': 1100, 'car_calls': []}, {'mode': 'bypass', 'depart': True, 'serve_hall': False, 'cancel_car_calls': False}), ('control 45', {'rated_kg': 630, 'load_kg': 464, 'car_calls': [8, 7, 5, 9, 2]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 48', {'rated_kg': 675, 'load_kg': 153, 'car_calls': [1, 7, 4, 5, 6, 3]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False}), ('control 51', {'rated_kg': 450, 'load_kg': 330, 'car_calls': [6, 0, 7, 9]}, {'mode': 'normal', 'depart': True, 'serve_hall': True, 'cancel_car_calls': False})]]
for label, args, expected in fixtures[N-1]:
    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:
Genuine car calls of a light passenger are cancelled, or prank calls survive.

Overload (load above 110% of rating) keeps the car at the floor: no departure, no hall service, no cancellation. Otherwise the car departs; at 80% or more it runs in bypass (ignores hall calls). Anti-nuisance cancels all car calls when the load is below 10% of rating and more than three car calls are registered. Percentages are exact integer comparisons.

split: open-access