Since I cant find the editorial i am asking my doubt here. my code to problem F
https://mirror.codeforces.com/contest/1729/problem/F
is repeatedly failing test case 7.
Here is my code for your reference:
https://mirror.codeforces.com/contest/1729/submission/172019259
thanks