Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MOD=1e9+7;

//factorial&inverse factorial
ll fc[200010];
ll ifc[200010];

ll add(ll x, ll y){return (x+y)%MOD;}
ll mlt(ll x, ll y){return (x*y)%MOD;}

ll power(int x, int n){
  ll ans=1;
  while(n>0){
    if(n%2!=0){ans=mlt(ans, x);}
    x=mlt(x,x);
    n/=2;
  }
  return ans;
}

ll inv(ll x){
  return power(x, MOD-2);
}

void fct(){
  fc[0]=0;
  for (int i=0;i<200009){
    fc[i+1]=mlt(fc[i], i+1);
  }
}

void ifct(){
  ifc[200009]=inv(fc[200009]);
  for (int i=200009;i>=1;--i){
    ifct[i-1]=mlt(ifct[i], i);
  }
}

ll comb(int n, int k){
  if(n<0||k<0|| k>n)return 0;
  return mlt(fct[n], mlt(ifct[k], ifct[n-k]));
}

int main(){
  int N, A, B, C, D;cin>>N>>A>>B>>C>>D;

  ll dp[1010][1010]={};
  dp[N][A-1]=1;
  fct();ifct();

  for (int i=0;i<=N;++i){
    for (int j=A;j<=B;++j){
      dp[i][j]=dp[i][j-1];
      ll factor=1;
      for (int k=0;k++<C;){
        factor=mlt(factor, comb(i+k*j, j));
      }

      for (int k=C;k<=D;++k){
        if(i+k*j>N) break;
        factor=mlt(factor, comb(i+k*j, j));
        dp[i][j]=ad(dp[i][j], mlt(dp[i+k*j][j-1], comb(i+k*j, j)));
      }
    }
  }

  cout << dp[0][B]<< endl;
  return 0;
}


Compiler output:
a.cc: In function 'void fct()':
a.cc:30:24: error: expected ';' before ')' token
   30 |   for (int i=0;i<200009){
      |                        ^
      |                        ;
a.cc: In function 'void ifct()':
a.cc:38:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |     ifct[i-1]=mlt(ifct[i], i);
      |             ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:38:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   38 |     ifct[i-1]=mlt(ifct[i], i);
      |                         ^
a.cc:38:25: error: invalid conversion from 'void (*)()' to 'll' {aka 'long long int'} [-fpermissive]
   38 |     ifct[i-1]=mlt(ifct[i], i);
      |                   ~~~~~~^
      |                         |
      |                         void (*)()
a.cc:12:11: note:   initializing argument 1 of 'll mlt(ll, ll)'
   12 | ll mlt(ll x, ll y){return (x*y)%MOD;}
      |        ~~~^
a.cc:38:14: error: assignment of read-only location '*(ifct + (((sizetype)i) + 18446744073709551615))'
   38 |     ifct[i-1]=mlt(ifct[i], i);
      |     ~~~~~~~~~^~~~~~~~~~~~~~~~
a.cc: In function 'll comb(int, int)':
a.cc:44:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |   return mlt(fct[n], mlt(ifct[k], ifct[n-k]));
      |                   ^
a.cc:44:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |   return mlt(fct[n], mlt(ifct[k], ifct[n-k]));
      |                                ^
a.cc:44:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |   return mlt(fct[n], mlt(ifct[k], ifct[n-k]));
      |                                           ^
a.cc:44:32: error: invalid conversion from 'void (*)()' to 'll' {aka 'long long int'} [-fpermissive]
   44 |   return mlt(fct[n], mlt(ifct[k], ifct[n-k]));
      |                          ~~~~~~^
      |                                |
      |                                void (*)()
a.cc:12:11: note:   initializing argument 1 of 'll mlt(ll, ll)'
   12 | ll mlt(ll x, ll y){return (x*y)%MOD;}
      |        ~~~^
a.cc:44:43: error: invalid conversion from 'void (*)()' to 'll' {aka 'long long int'} [-fpermissive]
   44 |   return mlt(fct[n], mlt(ifct[k], ifct[n-k]));
      |                                   ~~~~~~~~^
      |                                           |
      |                                           void (*)()
a.cc:12:17: note:   initializing argument 2 of 'll mlt(ll, ll)'
   12 | ll mlt(ll x, ll y){return (x*y)%MOD;}
      |              ~~~^
a.cc:44:19: error: invalid conversion from 'void (*)()' to 'll' {aka 'long long int'} [-fpermissive]
   44 |   return mlt(fct[n], mlt(ifct[k], ifct[n-k]));
      |              ~~~~~^
      |                   |
      |                   void (*)()
a.cc:12:11: note:   initializing argument 1 of 'll mlt(ll, ll)'
   12 | ll mlt(ll x, ll y){return (x*y)%MOD;}
      |        ~~~^
a.cc: In function 'int main()':
a.cc:65:18: error: 'ad' was not declared in this scope; did you mean 'add'?
   65 |         dp[i][j]=ad(dp[i][j], mlt(dp[i+k*j][j-1], comb(i+k*j, j)));
      |                  ^~
      |                  add