Optimization of the given sieve

how to optimize this code??

@Codarikh
Share your current code using cb.lk/ide .