def getDivisor(n):
    let = []
    i = 2
    while i * i <= n:
        if x % i == 0:
            let.append(i)
            let.append(x // i)
        i += 1
    let.sort()
    return let

def TwoPointer(arr, check, target):
    x, y = 0, len(arr) - 1
    while x <= y:
        if check[x]:
            x += 1
            continue
        elif check[y]:
            y -= 1
            continue

        tmp = arr[x] * arr[y]
        if tmp == target:
            check[x] = True
            check[y] = True
            return 1
        elif tmp < target:
            x += 1
        else:
            y -= 1
    return 0
           

for _ in range(int(input())):
    x, d = map(int, input().split())
    res = getDivisor(x)
    arr = []
    for v in res:
        if v % d == 0:
            arr.append(v)
    print(arr)
    if not arr:
        print("NO")
    else:
        cnt = 0
        check = [False] * len(arr)
        success = False
        for i in range(len(arr)):
            cnt += TwoPointer(arr, check, x)
            if cnt > 1:
                success = True
        if success:
            print("YES")
        else:
            print("NO")

이 정도인데 씨 ㅡ발 뭐가 문제임?

128 4 인풋에서

당연히 Yes 떠야하는데

왜 No임?????????????