Getting wrong answer in codechef luchtime

problem link: https://www.codechef.com/LTIME89B/problems/COPAR
code link: https://www.codepile.net/pile/zmpp0Lmd