Deepak and primes

#include
#define ll long long
using namespace std;
void prime_sieve(int p){
for(ll 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){
p[j]=0;
}
}
}
p[1]=p[0]=0;
p[2]=1;
}
int main() {
int p[500000]={0};
int n;
cin>>n;
int a[500000];
prime_sieve§;
for(ll i=0;i<=500000;i++){
if(p[i]==1){
for(ll j=0;j<=500000;j++){
a[j]=i;
}
}
}
cout<<a[n-1]<<endl;
return 0;
}
why it showing me TLE ??

@piyush_sharma please share your code using cb ide

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.