Getting TLE - SPOJ Problem : 4180. Pizza Location

Hi, Can someone give me some advice to optimize my solution.
Its getting TLE.I’m using bitmasking basically.

problem link : http://www.spoj.com/problems/PIZZALOC/

My solution : http://ideone.com/qPAasG

//