Help needed in this problem

Can anyone tell the approach? I referred to the editorial, but could not understand very well.Problem Link

You should clarify which part of the editorial you don’t understand

1 Like

Thank you @galencolin , I was facing problem understanding this statement -“For all k(1 ≤ k ≤ N), the number of times X is divided by 2 is equal to the number of
times ak/2 is divided by 2”, but I have solved this now :slightly_smiling_face: