Help me in solving SUPINC problem this is my logic what wrong with it

My issue

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

int main()
{
// your code goes here
int t;
cin>>t;
while(t–)
{
long long n,idx,x;
cin>>n>>idx>>x;
idx=idx-1;
long long sum=((idx+1)*idx)/2;

    if(x>sum )
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    
    
    
    
    
    
}

}

My code

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

int main() 
{
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    long long  n,idx,x;
	    cin>>n>>idx>>x;
	    idx=idx-1;
	    long long  sum=((idx+1)*idx)/2;
	    
	   
	    if(x>sum )
	    {
	        cout<<"YES"<<endl;
	    }
	    else
	    {
	        cout<<"NO"<<endl;
	    }
	    
	    
	    
	    
	    
	    
	}

}

Problem Link: Superincreasing Practice Coding Problem - CodeChef

@anujjjj007
plzz refer the following 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;
}

thanks a lot