#include #include using namespace std; using ll=long long; using mint=atcoder::modint998244353; #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} const int MAX=4000; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); // M(n,k) vector M(MAX+1,vector(MAX+1)); M[0][0]=1; for(int i=1;i<=MAX;i++)for(int j=1;j<=MAX;j++){ M[i][j]+=M[i-1][j-1]; if(i-j>=0)M[i][j]+=M[i-j][j]; } vector SM(MAX+1,vector(MAX+1)); for(int i=0;i<=MAX;i++){ SM[i][0]=M[i][0]; for(int j=1;j<=MAX;j++){ SM[i][j]=SM[i][j-1]+M[i][j]; } } // L(n,k) vector L(MAX+1,vector(MAX+1)); L[0][0]=1; for(int i=1;i<=MAX;i++)for(int j=1;j<=MAX;j++){ L[i][j]+=L[i-1][j-1]; if(i-j>=0)L[i][j]+=L[i-j][j]; } vector SL(MAX+1,vector(MAX+1)); for(int i=0;i<=MAX;i++){ SL[i][0]=L[i][0]; for(int j=1;j<=MAX;j++){ SL[i][j]=SL[i][j-1]+L[i][j]; } } int Q; cin>>Q; while(Q--){ int t,n,k; cin>>t>>n>>k; chmin(k,n); if(t==1)cout<