Getting WA for subtask 2 (Not All Flavours)

question https://www.codechef.com/LRNDSA02/problems/NOTALLFL
my solution is this https://www.codechef.com/viewsolution/33083062