Help needed in one of the Kadane's problem (K-Concatenation)

All custom test cases are passing and the logic also seems correct but while submitting the code only one test case is passing. Can somebody review my code and give me hint on where i am going wrong? or give me some test cases to check on if code is working fine or not?

here is the link: https://www.codechef.com/viewsolution/38579387