Run error in some test cases


as array cannot hold greater than 100000 ,please tell me how do i correct the code

@samadsid7 hey abdul there is basically three logical error in your code
in prime function
do
ar[0]=ar[1]=0
and in the third loop you’re using int but you should apply ll
and update your main function as
ll n=declare the n according to constraints;
ll ar[n]={0};
prime(ar,n);
int key;
cin>>key;
ll count=0;
for(ll i=0;i<=n;i++)
{
if(ar[i]==1)
{
count+=1;
if(count==key)
{cout<<i;}

    }

}