Prateek loves candy timelimit error

why is this code showing timelimit error even though I have don many optimizations in the sieve algorithm

Firstly use long long int instead of only int, and refer to the tutorial given in the online lectures for optimisation,