Deepak and Primes

please tell where my code is incorrect as one test case is not getting passed
the code is as follows:-
#include
using namespace std;
int main() {
long long int n1;
cin>>n1;

long long int n=50000000;

long long int primes[n]={0};

// marking odd numbers as prime
for(long long int i=3;i<=n;i+=2){
	primes[i]=1;
}
// taking odd numbers and marking their multiples as not prime
for(long long int i=3;i<=n;i+=2){
	for(long long int j=i*i;j<=n;j+=i){
		primes[j]=0;
	}
}
// case when n=2,1,0
primes[0]=primes[1]=0;
primes[2]=1;

// getting n1th prime no from the sieve
long long int count=0;
for(int i=0;i<=n;i++){
	if(primes[i]==1){
		count++;
	}
	if(count==n1){
		cout<<i;
		break;
	}
}
return 0;

}

I have edited your code now, try to submit it,

yes ! all thetestcases are passed. Can u please tell me why one testcase was not getting passed when I take n=50000000

Because in the question , maximum value of n was given to be 50,000,000, but since the array size needs to be greater than this, thts why to use tht value of n…

But in question the max value of n is 5,000,000 not 50,000,000

Yes, sry The extra zero was typed by mistake…The main point is that you need to take the size of array much greater here… thts why…