結果
| 問題 | No.3276 Make Smaller Popcount | 
| コンテスト | |
| ユーザー |  titia | 
| 提出日時 | 2025-09-22 06:33:38 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 530 ms / 2,000 ms | 
| コード長 | 348 bytes | 
| コンパイル時間 | 360 ms | 
| コンパイル使用メモリ | 82,160 KB | 
| 実行使用メモリ | 77,484 KB | 
| 最終ジャッジ日時 | 2025-09-22 06:33:47 | 
| 合計ジャッジ時間 | 8,330 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 28 | 
ソースコード
import sys
input = sys.stdin.readline
T=int(input())
for tests in range(T):
    N=int(input())
    x=N.bit_count()
    for i in range(60):
        y=(1<<i)
        k=N & (y-1)
        plus=y-k
        xx=(N+plus).bit_count()
        #print(N,plus,x,xx)
        if xx<x:
            print(plus)
            break
    else:
        print(-1)
            
            
            
        