I think there is some problem with your judge , because for test cases 100 1 ; 200 1 ; 1 3000 ; 15 9 i am getting 2, 2, 2, 319771 while on testing as a custom input with the same set of inputs I getting correct answer. Kindly check the same.
I can assure you the test data is correct.
Getting different outputs usually means your program is either using global variables that are not initialized at the start of the function or you are accessing invalid memory with garbage value.
Anshuman Singh I just got null for 2 3 and for 3 3 and 5 5 it is giving invalid input. Please check and reset timer if possible.
Amit Kumar I cannot reproduce what you said. When I try, I seem to get the right output.
@shivam this might happen because you are using a global variable. And for each test case the same global value is being used. Try resetting that global variable to 0/NULL/desired initial value in your main::solution fx… . you may write your code in another fx and then call that fx from main::solution fx