Why is it giving wrong ans? Help me, m new

https://www.codechef.com/viewsolution/37112421