結果
| 問題 | No.3276 Make Smaller Popcount | 
| コンテスト | |
| ユーザー |  detteiuu | 
| 提出日時 | 2025-09-19 21:32:07 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 574 ms / 2,000 ms | 
| コード長 | 349 bytes | 
| コンパイル時間 | 310 ms | 
| コンパイル使用メモリ | 82,396 KB | 
| 実行使用メモリ | 76,712 KB | 
| 最終ジャッジ日時 | 2025-09-19 21:32:50 | 
| 合計ジャッジ時間 | 17,692 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 28 | 
ソースコード
INF = 1<<60
for _ in range(int(input())):
    N = int(input())
    if N.bit_count() == 1:
        print(-1)
        continue
    cnt = 0
    for i in range(INF):
        if 1<<i & N:
            cnt += 1
        if cnt == 2:
            pre = N
            N &= ~((1<<(i+1))-1)
            N += 1<<(i+1)
            print(N-pre)
            break
            
            
            
        