I could get the first 2 test cases correctly but got WA (not TLE) for 3 and 4. Tried to think a lot but couldn't understand what is wrong here. Any help is appreciated. Thanks! Here is the logic I used for this question:
asked 04 Jul '17, 00:34

You have to tell him the count of numbers between A and B (A<=B)which are divisible by M. A number is divisible by m,it means that number is a multiple of m.Now you need to find the number of multiples of m in between A and B(both inclusive).We can say that number of multiples of m in between 1 and N is N/m. so to find number of multiples in between A and B,find number of multiples up to B and subtract number of multiples up to A1 and hence answer is B/m(A1)/m; here is my accepted solution https://www.codechef.com/viewsolution/14370596 answered 04 Jul '17, 00:47
Thanks.. I saw the logic you (and many other people) used and it is perfectly understandable. What I tried to do was  If M lies b/w A and B, then no. of multiples will be B/M and if it lies before A, then no. of muktiples will be (BA)/M (+1 if either A or B is also a multiple). Could you take the time to tell what error did I make thinking this way? PS: I can't upvote your answer, but it was helpful (obviously) :)
(04 Jul '17, 01:14)
Your logic seems fine to me. I have been curious about your WA and had been debugging your code tbh. :p
(04 Jul '17, 01:17)
hey your code fails when (ba)/m!=b/ma/m and here is the test case 1 5 25 3
(04 Jul '17, 01:39)
Oh.. Yes! Missed this. Thanks for the help! @hruday968 @vijju123
(05 Jul '17, 00:56)
