Run time error in two test cases

Could you please check the code and tell me why am i getting a run time error in first two test cases?
code link: https://ide.codingblocks.com/s/226826

hello @kairavi.bajaj
check 5000 000 th prime number from internet and declare ur n and bitset size accordingly

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

i tried changing n and bitset size, but it gives TLE if i increase the size.

try thi s-> https://ide.codingblocks.com/s/235121

it worked…Thank you!
Can you explain the part where we have to print the nth prime no?
int k=2;
int count=0;
for(int r=k;r<=t;r++){
if(p[r]==1){
k=r;
count++;
}
if(count==n){
cout<<k;
break;
}

}

count variable is to store the count of prime number we encounter so far.

here running loop from r=2 to 5000 000th value.
the moment count==n print r.and break

okay… Thank you!!
Got it :+1: :+1: