http://ideone.com/uzJr07 shouldn't this case time limit? a=536870914 b=2 ,, i just found out, please add this case as i used bitmask which shouldn't pass at all! also this case a=536870913 b=1 http://codeforces.net/contest/495/submission/9120923 Problem B Div2 Round 282
Do you mean problem B?
yes, i'm sorry fixed