Hi I am getting TLE IN ONLY THE FIRST TEST CASE in the problem 'Prateek Loves Candy"

#include <iostream>
#define ll long long
#include<stdlib.h>

using namespace std;

void primeSeive(int *p)
{
    for(ll i = 2; i<1000003; i+=2){
        p[i]=0;
    }

    for(ll i = 3; i <= 1000003 ;i+= 2){
        if(p[i] == 1){
            for(ll j= i*i ; j <= 1000003 ; j = j+ 2*i){
                p[j] = 0;
            }
        }
    }

    p[2] =1;
    p[1] = p[0] = 0;

}

int main()
{   int n;
    int p[1000003] = {1};
    
    for(int i=0 ; i<1000003; i++){
        p[i]= 1;
    }
    primeSeive(p);
    ll int t;
    cin >> t;
    while (t--){
        cin>>n;
        int cnt =0,k;
        for(  k=2 ; k<1000003; k++){
            if(p[k]== 1){
                cnt++;
            }
        
            if(cnt == n){
                break;
            }
        }
        cout<<k<<endl;
        
    }
    return 0;
}

/*
I am not able to post the IDE link because somehow the Coding Blocks IDE doesn’t work on the computer. I just doesn’t take any keystrokes. All I can do is copy-paste the code from someone IDE to the coding blocks IDE and submit it.
*/