Need Help in the Problem D, in Educational Codeforces Round 8

So now that I have got your attention, I want help in this question, this is what I did, seriously guys, I have been in into this question for over a week now, please help!!!

Please , Don’t write Misleading titles.

Agree with @infinite_king

I know, bro, but that did work. At least now people are viewing the question, and maybe someone can help me now!!!

I understand your intention , but think about this , what if every one who see this and does a similar thing , then only the Clikbait title posts have views so more people will make Clikbait titles and this becomes a cycle.

Yup, I understand, it won’t happen again, mate!