Deepak and Primes Failing 2 cases

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
void sieve(int p,ll n)
{
ll i;
vector prime;
p[2]=1;
p[0]=p[1]=0;
for(i=3;i<=1000000;i+=2)
{
p[i]=1;
}
for(i=3;i<=1000000;i+=2)
{
if(p[i]==1)
{
for(ll j=i
i;j<=1000000;j+=i)
{
p[j]=0;
}
}
}
for(i=0;i<=1000000;i++)
{
if(p[i]==1)
prime.push_back(i);
}
cout<<prime[n-1];

}
int main() {
ll i,n;
int p[1000000]={0};
cin>>n;
sieve(p,n);
return 0;
}

@shivansh.sm1 Constraints are
1<=n<=5000000
So increase the size of your array.

Refer this code for help: