Dfs codeforces #635(div-2) C-problem

Continuing the discussion from Codeforces Round #635 (Div. 2) Problem C (Need Help):

Your solution looks fine on a cursory glance. For me too, it failed on a pretest. But it worked after I changed the variables to long long int (in C++). Can you try that once?

i tried , but its getting wa on test 7