"""Safe bounds model. Not an exploit.

A buffer is a fixed number of positions. judge() reports whether a
requested write fits. It does not perform the write, and it has no
neighbor to change.

terminator is 0 or 1. A 1 means one extra position for a trailing null,
the way a C string needs room past its letters. This file is not a C
compiler. Running it prints nothing, because it only defines judge().
"""


def judge(capacity, payload, terminator):
    if payload < 0 or terminator not in (0, 1):
        return "rejected-input"
    need = payload + terminator
    if need > capacity:
        return "does-not-fit"
    return "fits"
