Code Library Of Others/sgtlaugh/Lucas Theorem.cpp
void init(int prime){
        MOD = prime;
        fact[0] = 1, inv[MOD - 1] = MOD - 1;
        for (int i = 1; i < MOD; i++) fact[i] = ((long long)fact[i - 1] * i) % MOD;
        for (int i = MOD - 2; i >= 0; i--) inv[i] = ((long long)inv[i + 1] * (i + 1)) % MOD;
    }
/// Call once with the modulo prime
Call once with the modulo prime
Call once with the modulo prime
void init(int prime){
        MOD = prime;
        fact[0] = 1, inv[MOD - 1] = MOD - 1;
        for (int i = 1; i < MOD; i++) fact[i] = ((long long)fact[i - 1] * i) % MOD;
        for (int i = MOD - 2; i >= 0; i--) inv[i] = ((long long)inv[i + 1] * (i + 1)) % MOD;
    }
void init ( int prime ) { MOD = prime ; fact [ 0 ] = 1 , inv [ MOD - 1 ] = MOD - 1 ; for ( int i = 1 ; i < MOD ; i ++ ) fact [ i ] = ( ( long long ) fact [ i - 1 ] * i ) % MOD ; for ( int i = MOD - 2 ; i >= 0 ; i -- ) inv [ i ] = ( ( long long ) inv [ i + 1 ] * ( i + 1 ) ) % MOD ; }
Call once with the modulo prime
Call once with the modulo prime