I have been trying to solve a question where the values were like :
num = (num*x) % m and this kept me giving WA
and when i did this :
num = (1LL*num*x) % m … I got an AC.
The number x was already smaller than m and was well in range of 10^5. I cant figure out why is this happening.
Please help as this thing has wasted many hours of mine in different questions and i cant figure it out.