Stuck on SEAGRP problem

Hi,

i am trying to solve the SEAGRP problem by using the Tutte matrix approach.
I get WA all the time and cannot really find the problem in my code.

My code looks as follows:

Any suggestions would be appreciated.

Here’s my code with comments- CodeChef: Practical coding for everyone.
What i could not understand was basically how the gaussian elimination was working and so i commented that particularly!

Hope it helps!
Other resources to help understanding- SEAGRP - Editorial - editorial - CodeChef Discuss
Tutte Matrix-Wikipedia
Gaussian Elimination- Wikipedia

Cheers!