WA On 3 Test Cases, Graph Problem (DSA Contest Problem 2)

Problem Link: https://www.codechef.com/LRNDSA08/problems/MARLA
Solution Link: https://pastebin.com/JL6wBs8T

In this problem, from what I have understood, we just have to find the largest connected component (components consist of the same numbers) and among the largest connected components choose the one with the least strength. My implementation is passing most of the test cases and failing only 3. Could someone please help me?

You are printing cnt instead of banks

These tests must be incredibly weak if that passed so many of them