Help me in solving SUPINC problem

My issue

include <bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t–){
long long n,k,x;
cin>>n;// length of array
cin>>k;// index at which x is occur
cin>>x;// //value of x
long long ans=pow(2,k-1);
if(x>=ans)cout<<“YES”<<endl;
else {

cout<<“NO”<<endl;

}

}

}

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    long long  n,k,x;
	    cin>>n;// length of array
	    cin>>k;// index at which x is occur
	    cin>>x;// //value of x
long long ans=pow(2,k-1);
if(x>=ans)cout<<"YES"<<endl;
else {
    
cout<<"NO"<<endl;




}


	}

}




Problem Link: Superincreasing Practice Coding Problem - CodeChef

@codechef2k26
plzz refer my c++ code for better understanding

#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;
}