For this Question: Sid is super fond of making couples, so he used to play FLAMES in his childhood.
Today, he is engrossed in a similar problem. There are N girls numbered from 1 to N, and N boys numbered from 1 to N. He wants to make exactly N couples from these group of young adults. He only has one criterion in mind:
-> The absolute value of the difference between the number assigned to the boy and the number assigned to the girl in any couple must not be equal to X.

He is a super loyal guy, so a boy and a girl can appear in at most 1 couple. You need to find the number of ways in which he can form these N couples. As the answer can be huge, you need to report it modulo 1000000007.

Since the problem is trickier than he expected, he is willing to give a Chapo to the person who solves it. Can you get a Chapo?The first and the only line of input contains two integers N and X.

Constraints
2 <= N <= 1500
1 <= X <= N-1Output a single integer, the answer to this colourful problem, modulo 1000000007.Sample Input
4 1

Sample Output
5

Explanation
The following ways of couple formation are valid:-
1. {(1, 1), (2, 2), (3, 3), (4, 4)}
2. {(1, 1), (4, 2), (3, 3), (2, 4)}
3. {(1, 3), (2, 2), (3, 1), (4, 4)}
4. {(1, 3), (2, 4), (3, 1), (4, 2)}
5. {(1, 4), (3, 3), (4, 1), (2, 2)}, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 200005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

int add(int a, int b){
    return ((a + b) % MOD);
}

int mul(int a, int b){
    return ((a * b) % MOD);
}

signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n, k;
    cin >> n >> k;
    vector <int> a(n + 1);
    a[0] = 1;
    vector <int> used(n);
    for (int i = 0; i < n; ++i)
    {
        if (used[i])
            continue;
        used[i] = 1;
        vector <vector <int>> dp(n + 1, vector <int> (2)), ndp(n + 1, vector <int> (2));
        int mxlen = 0;
        dp[0][0] = 1;
        if (i - k >= 0)
            dp[1][0] = 1, mxlen = 1;
        if (i + k < n)
            dp[1][1] = 1, mxlen = 1;
        for (int j = i + 2 * k; j < n; j += 2 * k){
            used[j] = 1;
            mxlen++;
            for (int l = 0; l <= mxlen; ++l)
            {
                ndp[l][0] = add(dp[l][0], dp[l][1]);
                if (l)
                    ndp[l][0] = add(ndp[l][0], dp[l - 1][0]);
                if (l && j + k < n)
                    ndp[l][1] = add(dp[l - 1][0], dp[l - 1][1]);
            }
            swap(ndp, dp);
            for (int l = 0; l <= mxlen; l++)
            {
                ndp[l][0] = ndp[l][1] = 0;
            }
        }
        vector <int> na(n + 1);
        for (int x = 0; x <= n; ++x)
            for (int y = 0; y <= mxlen; ++y)
                if (x + y <= n)
                    na[x + y] = add(na[x + y], mul(a[x], add(dp[y][0], dp[y][1])));
        a = na;
    }
    vector <int> fact(n + 1, 1);
    for (int i = 1; i <= n; ++i){
        fact[i] = mul(fact[i - 1], i);
    }
    int ans = 0;
    for (int i = 0; i <= n; i++){
        // inclusion-exclusion
        ans = add(ans, MOD + (i % 2 == 0 ? 1 : -1) * mul(a[i], fact[n - i]));
    }
    cout << ans;
    return 0;
}



, In this Programming Language: C++, Now tell me if this Code is compilable or not?