結果
| 問題 | 
                            No.3253 Banned Product
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-09-04 02:36:11 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 358 bytes | 
| コンパイル時間 | 165 ms | 
| コンパイル使用メモリ | 81,988 KB | 
| 実行使用メモリ | 84,044 KB | 
| 最終ジャッジ日時 | 2025-09-05 05:29:13 | 
| 合計ジャッジ時間 | 3,690 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 1 TLE * 1 -- * 7 | 
ソースコード
"""
正しい(はず)
"""
from math import isqrt
def solve():
    n, k = map(int, input().split())
    while n:
        for d in range(1, isqrt(n)+1):
            if n%d==0 and d <= k and n//d <= k:
                break
        else:
            print(n)
            return
        n -= 1
    print(-1)
t = int(input())
for i in range(t):
    solve()