Calculate n choose r.

    :param n: n
    :type n : int
    :param r: r
    :type r :int
    :return: n choose r as int

def ncr(n, r):
    """
    Calculate n choose r.

    :param n: n
    :type n : int
    :param r: r
    :type r :int
    :return: n choose r as int
    """
    r = min(r, n - r)
    numer = reduce(op.mul, range(n, n - r, -1), 1)
    denom = reduce(op.mul, range(1, r + 1), 1)
    return numer // denom