I dont know why my solution is geting TLE!!!Please have a look http://www.codechef.com/viewsolution/6943810 I am implementing sieve of erasothenes to caclulate primes upto sqrt(10^9) and then applying these primes in the given segment to print all prime no's..then why it's giving TLE?? where is my code getting slow and how to correct that..Please help asked 21 May '15, 15:59

There are a few problems: answered 21 May '15, 18:50
Thanks for the suggestion pratku123, i tried both optimisations,still its getting TLE!!! Link to my updated solution http://www.codechef.com/viewsolution/6995848
(23 May '15, 09:03)

read about segmented sieve then give it a try using it. answered 23 May '15, 11:23

http://www.spoj.com/problems/PRINT/ this is a rather challenging version of the same problem you can try this as well.this would require segmented sieve. answered 23 May '15, 11:28
