from math import (
    comb,
    copysign,
    fmod,
    gcd,
    hypot,
    lcm,
    log,
    perm,
    pow as fpow,
    remainder,
)
from operator import (
    add,
    and_,
    eq,
    floordiv,
    ge,
    gt,
    is_,
    le,
    lshift,
    lt,
    mod,
    mul,
    ne,
    neg,
    or_,
    rshift,
    sub,
    truediv,
    xor,
)


def percent(a, b, /):
    return (b - a) / a * 100


BINARY_OPERATORS = {
    '!=': ne,
    '%%': percent,
    '%': mod,
    '&': and_,
    '*': mul,
    '**': pow,
    '+': add,
    '-': sub,
    '/': truediv,
    '//': floordiv,
    '<': lt,
    '<<': lshift,
    '<=': le,
    '==': eq,
    '>': gt,
    '>=': ge,
    '>>': rshift,
    'C': comb,
    'P': perm,
    '^': xor,
    'cs': copysign,
    'fmod': fmod,
    'fpow': fpow,
    'gcd': gcd,
    'hypot': hypot,
    'is': is_,
    'lcm': lcm,
    'log': log,
    'rem': remainder,
    '|': or_,
    '~': neg,
    '٪': mod,
    '٪٪': percent,
}
