Calculate ( n C r )
def nCr ( n , r ) : NEW_LINE INDENT return ( ( factorial [ n ] * invmod ( ( factorial [ r ] * factorial [ n - r ] ) % mod ) ) % mod ) NEW_LINE DEDENT def CountWays ( n , k ) : NEW_LINE INDENT StoreFactorials ( n ) NEW_LINE DEDENT