Idk why i am getting Tle in this please help

#include
#include
using namespace std;
#define ll long long int
void PrimeSieve(int *arr,int *v)
{
for (long long int i = 2; i <= 1000000; i += 2)
{
arr[i] = 1;
}
v[1]=2;
int x=1;
for (long long int i = 3; i <= 1000000; i += 2)
{
if (arr[i] == 0)
{
x++;
v[x]=i;
for (long long int j = i * i; j < 1000000; j = j + i)
{
arr[j] = 1;
}
}
}
arr[2] = 0;
arr[0] = arr[1] = 1;
}
int main()
{
ll n;
cin >> n;
while (n)
{
ll num;
cin >> num;
int arr[1000000] = {0};
int v[100000]={0};
PrimeSieve(arr,v);
cout <<v[num]<<endl;
n–;
}
}

Hi Pratham… pls save ur code on ide and send or u can refer my code https://ide.codingblocks.com/s/598504

here is mu code kindly check

i got my fault thank you

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.