Used this approach but still not working giving an tle error

I have used sieve’s approach. Do I need to use segmented sieve.?