How Codechef test the programme because its tuff for me to debug my code

please help in debugging the code its giving the correct answer for test cases I check for please help it is the problem from sept long challenge 2019
question :long challenge sept icin
my code:

Yours seems to work for small testcases, but fails for larger ones - overflow is the most likely.

This line is suspicious:


1 Like

Good point by @ssjgz . The other thing that you can keep in mind is whenever there are any subtractions during MOD, the result might become negative and C++ might return a negative mod. So at the end, you might have to do this:

if (mount < 0) {mount += MOD;}


that for when both values of a and c are grater than b than we can easily multiply the ranges so I calculated Them in the starting
for eg . A=100,B=50,C=100
then for values of a>50 and c>50 can pair up with any value of c thus there are total
5050B values

exactly where I m very curious why I m getting wA in the end