Need help MAXAND18

where i am going wrong.
https://www.codechef.com/viewsolution/34863704