Language: C++

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

//typedef long long LL;
typedef __int64 LL;

int N,A,B,C,D;
LL mod = 1e9 + 7;
LL con[1010][1010];
LL dp[1010][1010];
LL r[1010];

int main(){
	scanf("%d%d%d%d%d" , &N , &A , &B , &C , &D);
	con[0][0] = 1;
	repp(i,1,N+1){
		con[i][0] = con[i][i] = 1;
		repp(j,1,i){
			con[i][j] = (con[i-1][j-1] + con[i-1][j]) % mod;
		}
	}
	{
		int x = mod - 2;
		r[N] = 1;
		repp(i,2,N+1){
			(r[N] *= i) %= mod;
		}
		LL y = r[N];
		r[N] = 1;
		while(x > 0){
			if(x%2==1) (r[N] *= y) %= mod;
			(y *= y) %= mod;
			x /= 2;
		}
	}
	repm(i,N,0){
		r[i-1] = r[i] * i % mod;
	}
	dp[0][A-1] = 1;
	repp(i,0,N+1){
		repp(j,A,B+1){
			(dp[i][j] += dp[i][j-1]) %= mod;
			//printf("%d %d %I64lld\n" , i , j , dp[i][j]);
			if(i+j*C>N) continue;
			LL z = 1;
			repp(k,0,C){
				(z *= con[N-i-j*k][j]) %= mod;
			}
			repp(k,C,D){
				dp[i+j*k][j+1] += dp[i][j] * z % mod * r[k] % mod;
				if(i+j+j*k>N) break;
				(z *= con[N-i-j*k][j]) %= mod;
			}
			if(i+j*D<=N) dp[i+j*D][j+1] += dp[i][j] * z % mod * r[D] % mod;
		}
	}/*
	LL ans = 0;
	repp(j,A,B+1){
		(ans += dp[N][j][1]) %= mod;
	}
	printf("%lld\n" , ans);*/
	printf("%lld\n" , dp[N][B] + dp[N][B+1]);
	return 0;
}


Compiler output:
a.cc:25:9: error: '__int64' does not name a type; did you mean '__int64_t'?
   25 | typedef __int64 LL;
      |         ^~~~~~~
      |         __int64_t
a.cc:28:1: error: 'LL' does not name a type
   28 | LL mod = 1e9 + 7;
      | ^~
a.cc:29:1: error: 'LL' does not name a type
   29 | LL con[1010][1010];
      | ^~
a.cc:30:1: error: 'LL' does not name a type
   30 | LL dp[1010][1010];
      | ^~
a.cc:31:1: error: 'LL' does not name a type
   31 | LL r[1010];
      | ^~
a.cc: In function 'int main()':
a.cc:35:9: error: 'con' was not declared in this scope; did you mean 'cos'?
   35 |         con[0][0] = 1;
      |         ^~~
      |         cos
a.cc:39:69: error: 'mod' was not declared in this scope; did you mean 'modf'?
   39 |                         con[i][j] = (con[i-1][j-1] + con[i-1][j]) % mod;
      |                                                                     ^~~
      |                                                                     modf
a.cc:43:25: error: 'mod' was not declared in this scope; did you mean 'modf'?
   43 |                 int x = mod - 2;
      |                         ^~~
      |                         modf
a.cc:44:17: error: 'r' was not declared in this scope
   44 |                 r[N] = 1;
      |                 ^
a.cc:48:17: error: 'LL' was not declared in this scope
   48 |                 LL y = r[N];
      |                 ^~
a.cc:51:45: error: 'y' was not declared in this scope
   51 |                         if(x%2==1) (r[N] *= y) %= mod;
      |                                             ^
a.cc:52:26: error: 'y' was not declared in this scope
   52 |                         (y *= y) %= mod;
      |                          ^
a.cc:57:17: error: 'r' was not declared in this scope
   57 |                 r[i-1] = r[i] * i % mod;
      |                 ^
a.cc:57:37: error: 'mod' was not declared in this scope; did you mean 'modf'?
   57 |                 r[i-1] = r[i] * i % mod;
      |                                     ^~~
      |                                     modf
a.cc:59:9: error: 'dp' was not declared in this scope
   59 |         dp[0][A-1] = 1;
      |         ^~
a.cc:62:53: error: 'mod' was not declared in this scope; did you mean 'modf'?
   62 |                         (dp[i][j] += dp[i][j-1]) %= mod;
      |                                                     ^~~
      |                                                     modf
a.cc:65:25: error: 'LL' was not declared in this scope
   65 |                         LL z = 1;
      |                         ^~
a.cc:67:34: error: 'z' was not declared in this scope
   67 |                                 (z *= con[N-i-j*k][j]) %= mod;
      |                                  ^
a.cc:70:62: error: 'z' was not declared in this scope
   70 |                                 dp[i+j*k][j+1] += dp[i][j] * z % mod * r[k] % mod;
      |                                                              ^
a.cc:70:72: error: 'r' was not declared in this scope
   70 |                                 dp[i+j*k][j+1] += dp[i][j] * z % mod * r[k] % mod;
      |                                                                        ^
a.cc:74:67: error: 'z' was not declared in this scope
   74 |                         if(i+j*D<=N) dp[i+j*D][j+1] += dp[i][j] * z % mod * r[D] % mod;
      |                                                                   ^
a.cc:74:77: error: 'r' was not declared in this scope
   74 |                         if(i+j*D<=N) dp[i+j*D][j+1] += dp[i][j] * z % mod * r[D] % mod;
      |                                                                             ^