Can't find the the error even after testing a lot

Problem- HERE
My solution- HERE

Your value of MOD is wrong.

Still wrong answer.
new solution -HERE

Why did you change the long longs to ints?

Sorry I copy pasted old code from my IDE.
This solution also fails- HERE

The code fails for the Test Case

1
4 3
1 4
2 3
3 4

Correct Answer:- 1 4
Your Output:- 1 6

My AC code(using DFS):- CodeChef: Practical coding for everyone

2 Likes

Thanks.