func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const int MAXN = 1e3 + 10;   inline long long in() {     long long x = 0, flag = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) flag = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();     return x * flag;   }   int T;   int n, m;   long long ans;   long long fac[MAXN];   long long c[MAXN << 1][MAXN << 1];   long long dp[52][MAXN];   void prework() {     fac[0] = 1;     for (int i = 1; i <= 1000; i++) fac[i] = fac[i - 1] * 1LL * i % MOD;     c[0][0] = 1;     for (int i = 1; i <= 2000; i++) {       c[i][0] = 1;       for (int j = 1; j <= i; j++)         (c[i][j] = c[i - 1][j - 1] + c[i - 1][j]) %= MOD;     }     dp[0][0] = 1;     for (int i = 0; i <= 50; i++) {       for (int j = i * (i + 1) / 2; j <= 1000; j++) {         if (j + i <= 1000 && i != 0) (dp[i][j + i] += dp[i][j]) %= MOD;         if (j + i + 1 <= 1000) (dp[i + 1][j + i + 1] += dp[i][j]) %= MOD;       }     }   }   int main() {     T = in();     prework();     while (T--) {       ans = 0;       n = in(), m = in();       for (int i = m * (m + 1) / 2; i <= n; i++) {         if (dp[m][i] == 0) continue;         int res = n - i;         (ans += c[res + m][m] * fac[m] % MOD * dp[m][i] % MOD) %= MOD;       }       printf( %lld n , ans);     }     return 0;   }   