求大组合数。
ll fac[maxm], refac[maxm]; ll mypow(ll a, ll p, ll mo){ ll ret = 1; while(p){ if(p & 1) ret = ret * a % mo; a = a * a % mo; p >>= 1; } return ret; } void init(){ refac[0] = refac[1] = fac[0] = fac[1] = 1LL; for(int i = 2; i < mod; i ++) fac[i] = 1LL * fac[i - 1] * i % mod; refac[mod - 1] = mypow(fac[mod - 1], mod - 2, mod); for(int i = mod - 2; i > 0; i --) refac[i] = 1LL * refac[i + 1] * (i + 1) % mod; } ll comb(int a, int b){ if(a < b) return 0; return fac[a] * refac[b] % mod * refac[a - b] % mod; } ll lucas(ll n, ll m){ if(!m) return 1; return comb(n % mod, m % mod) * lucas(n/mod, m/mod) % mod; }