Deepak and primes

only one test case is failing…please tell me the test case
#include
#include
using namespace std;
#define ll long long
void nthprime(int *p)
{
// make all the odd numbers prime
for (int i = 3; i <= 500000; i += 2)
{
p[i] = 1;
}

for (ll i = 3; i <= 500000; i += 2)
{
    if (p[i] == 1)
    {
        for (ll j = i * i; j <= 500000; j = j + i)
        {
            // change all the divisors of all the odd numbers to not prime
            p[j] = 0;
        }
    }
}
// corner cases
p[0] = p[1] = 0;
p[2] = 1;

}
int main()
{
int n;
cin >> n;
int p[500000] = {0};
nthprime§;
vector prime;
for (int i = 0; i < 500000; i++)
{
if (p[i] == 1)
{
prime.push_back(i);
}
}
cout<<prime[n-1]<<endl; return 0;
}

hi @abhinavssr2003_eab0717682969e5c try
49999 --> ans is 611951

refer https://ide.codingblocks.com/s/668137

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.