Getting Runtime error in 2 test cases

In this question, I am getting 2 test cases as runtime error, rest 4 test cases are giving correct answer.
the link of my code :

@sanjit_15
hello sanjit,
u are not computing sieve upto 5000 000th primr number.

check 5000 000th prime number.
declare ur sieve size and perform computation accordingly

Still, I am not getting how to solve…

@sanjit_15
see first check 5000 000 th prime number from internet . let say it is x.

Now ur sieve size should be atleat x+1. so declare ur ar array as ar[x+1];

now u should compute sieve upto x.
for(i=3;i<=x;i++){
logic- - ->
}
rest evrthing in ur code is correct

It is still throwing a segmentation fault even after making the changes
/bin/run.sh: line 4: 19 Segmentation fault (core dumped) ./exe < run.stdin > run.stdout 2> run.stderr
I have updated the code.

pls share ur updated code

the link of the updated code :

image

your code is passing all test cases .pls try to submit again