wa in AND plz help

problem : SPOJ.com - Problem AND
solution : qJTOHy - Online C++ Compiler & Debugging Tool - Ideone.com

I am trying this question using tries Plz help how to rectify this code