Question link - https://hack.codingblocks.com/contests/c/473/760
My Solution - https://ide.codingblocks.com/#/s/24359
I used segmented sieve. I pre-computed primes till sqrt(b) and then marked the multiples of these primes in range [a,b]. Some test cases are showing WA and TLE.
Please Check