Question link:

https://www.spoj.com/problems/CNTPRIME/

my solution : (WA)

https://ideone.com/ybMN8P

I am getting WA . I am unable to figure out what is wrong in my solution.

I have used lazy propagation . while making the segment tree i m storing the value of 1 at leaves if the number is prime( to keep the count easy) or 0 if they are not prime. While updating the range i am adding 1 in [L,R] if the updated value is prime.

Can someone tell what’s wrong in my code.

Edit : **I got the error.** Ignore the post