Editorial
The bitwise OR operation cannot turn a bit that has become 1 back to 0. Therefore, any bit that is already 1 in must also be 1 in . That is, is required. Also, if pressing a certain button includes a bit in that is not in , that bit will be turned on, and it can never become ultimately. Therefore, the only usable buttons are those satisfying . Now, we need to turn on each bit that is 1 in but 0 in . For each bit, if there is at least one button that includes that bit and satisfies , we just need to press that button. Since the range of integers is up to , there are only 30 bits to check. By looking at each button and saving one button that can turn on each bit, it can be solved in . The number of selected buttons is less than or equal to the number of required bits, which is at most 30, so it always satisfies the 100 times limit.