Warning: For those getting wrong answers


#1

Your answers might be wrong because judge is using 1 based indexing and not 0 based, so to check valid position check
i>0 && i<=A && j>0 && j<=B

you might be doing i> =0 && i<A like this


#2

thanks bro
it helped me