def opt_pol_2(state) -> int:
    """'50 or 100 or bust' policy.

    When capital is less than 50, implement a '50 or bust' policy; when
    greater than 50, implement '100 or 50' policy; when exactly 50, go
    all in.
    """
    if state < 50:
        return min(state, 50 - state)
    elif state == 50:
        return 50
    else:
        return min(state - 50, 100 - state)