Help me in solving SUPINC problem

My code

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;cin>>t;
    while(t--){
        long long int n,x,k;cin>>n>>x>>k;
        long long int a[n+1];
        a[0]=0;
        a[1]=1;
        a[x]=k;
        long long int sum=0;
        for(int i=1;i<=x;i++){
            sum=sum+a[i-1];
            a[i]=sum+1;
            
        }
        if(k<=sum){cout<<"NO"<<endl;}
        else cout<<"YES"<<endl;
    }
}

Problem Link: Superincreasing Practice Coding Problem - CodeChef

You long longs are overflowing. You should try another apprach.