Why test case 1 2 run time error

#include
#include
#include
using namespace std;

int main() {
long long int n;
cin>>n;
std::vectorp;
p.push_back(2);
for(long long int j=3;j<1000000;j++){
int flag=0;
for(long long int i=2;i<=sqrt(j);i++){
if(j%i==0){
flag=1;
break;
}
}
if(flag==0){
p.push_back(j);

}
j=j+1;

}
cout<<p[n-1];

return 0;

}

Hello @dineshjani,

Please, share your code using Online Coding Blocks IDE.
STEPS:

  1. Paste your code at https://ide.codingblocks.com/
  2. Save your code there.
  3. Share the URL generated.

The way you have shared it may introduce syntax error.

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.