can i know what the problem in the code is?
Only one case is giving correct
(a-b)%MOD = (a%MOD - b%MOD + MOD)%MOD
because (a>b) does not imply (a%MOD>b%MOD) so to keep everything positive, additional +MOD, which would be nullified by the whole (…)%MOD