#C6842. Can Split Into Powers of 2?

    ID: 50647 Type: Default 1000ms 256MiB

Can Split Into Powers of 2?

Can Split Into Powers of 2?

You are given a positive integer \(n\). Determine whether \(n\) can be split into two or more positive integers, each of which is a power of 2. In other words, check if there exists a representation:

[ n = 2^{a_1} + 2^{a_2} + \cdots + 2^{a_k}, \quad k \ge 2, \quad a_i \in \mathbb{Z}^{+} \cup {0} ]

This is possible if and only if \(n\) is not itself a power of 2. For example, if \(n = 10\) (binary 1010) then it can be split because it has more than one set bit. Conversely, if \(n = 16\) (binary 10000) it cannot be split as required because it has exactly one set bit.

Note: When \(n = 1\), it is impossible to split it into two or more positive powers of 2.

inputFormat

The first line contains an integer \(T\) denoting the number of test cases. Each of the following \(T\) lines contains one positive integer \(n\).

outputFormat

For each test case, output a single line containing YES if \(n\) can be split into two or more positive integers that are powers of 2, otherwise output NO.

## sample
3
10
11
15
YES

YES YES

</p>