Help me in solving SUPINC problem

My issue

include <bits/stdc++.h>

using namespace std;

int main() {
int t;
cin>>t;
while(t–){
long int n,k,x;
cin>>n>>k>>x;
vector v(k);
long int s=0;
v[0]=1;
for(int i=1;i<k;i++){
s+=v[i-1];
v[i]=s+1;
}
if(v[k-1]>x){
cout<<“NO\n”;
}
else{
cout<<“YES\n”;
}
}

}

// why isnt this code working for the following case?
//“1
//32 32 263508”

My code

#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    cin>>t;
    while(t--){
        long int n,k,x;
        cin>>n>>k>>x;
        vector<int> v(k);
        long int s=0;
        v[0]=1;
        for(int i=1;i<k;i++){
            s+=v[i-1];
            v[i]=s+1;
        }
        if(v[k-1]>x){
            cout<<"NO\n";
        }
        else{
            cout<<"YES\n";
        }
    }

}

Problem Link: Superincreasing Practice Coding Problem - CodeChef

@nikhil_zer0
Plzz refer my c++ code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long int n,k,x;
	    cin>>n>>k>>x;
	    long long int sm=0,pre=0,ch=0;
	    for(int i=1;i<=n;i++)
	    {
	        sm=pre+1LL;
	        
	        if(i==k)
	        {
	            if(x>=sm)
	            {
	                ch=1;
	                break;
	            }
	        }
	        if(sm>x)
	        break;
	        pre+=sm;
	    }
	    if(ch)
	    cout<<"Yes";
	    else
	    cout<<"No";
	    cout<<endl;
	}
	return 0;
}