fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4.  
  5. // Factorial Precomputation
  6. const int N=1e6+5;
  7. const long long MOD=1e9+7;
  8.  
  9. long long fact[N],invfact[N];
  10.  
  11. long long modpow(long long a,long long b){
  12. long long r=1;
  13. while(b){
  14. if(b&1) r=r*a%MOD;
  15. a=a*a%MOD;
  16. b>>=1;
  17. }
  18. return r;
  19. }
  20. ll modinv(ll a,ll MOD){
  21. return modpow(a, MOD - 2);
  22. }
  23. void init(){
  24. fact[0]=1;
  25. for(int i=1;i<N;i++)
  26. fact[i]=fact[i-1]*i%MOD;
  27.  
  28. invfact[N-1]=modpow(fact[N-1],MOD-2);
  29. for(int i=N-2;i>=0;i--)
  30. invfact[i]=invfact[i+1]*(i+1)%MOD;
  31. }
  32.  
  33.  
  34.  
  35. // Combination nCr
  36. long long nCr(int n,int r){
  37. if(r<0||r>n) return 0;
  38. return fact[n]*invfact[r]%MOD*invfact[n-r]%MOD;
  39. }
  40.  
  41. // Permutation nPr
  42. long long nPr(int n,int r){
  43. if(r<0||r>n) return 0;
  44. return fact[n]*invfact[n-r]%MOD;
  45. }
  46.  
  47.  
  48. int main(){
  49.  
  50. }
  51.  
  52.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty