code: def binom_modulo(n, k, p):
      
      prod = 1
      for i in range(k):
          prod = (prod * (n - i) * inv(i + 1, p)) % p
      return prod
docs: Binomial coefficients for :math:`n \choose k`, modulo p
  
      :param n,k: non-negative integers
      :complexity: O(k)