Showing wrong ANSWER

idk why its giving wrong output.

@chemant077
Hello Hemant,
please save your code on coding blocks ide and share ur link here

@chemant077
Hello Hemant,
errors/modifications in ur code
a) answer can be very large so replaced int datatype of dp array to long long
b) changed return type of pairs function to long long
c) you were initialising dp array only once but actually you should intialise for each test case so i shifted the for loop(for initialisation) inside while loop.

here is ur corrected code-https://ide.codingblocks.com/s/175935

I hope you find this helpful.if u have any furthur query then please ask otherwise pls mark your doubt as resolved.

@chemant077,
Hello Hemant let me know ,if u still have any doubt in this problem

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.