For this Question: Given a number N. Find whether the given number is a perfect square.

Note: Don't use the C++ library function sqrt(). 

Expected Time Complexity: O(log n)First line contains an integer N

Constraints
1 <= N <= 100000Print "YES" if x is a perfect square otherwise print "NO".Sample Input 1:
16

Output:
YES

Sample Input 2:
7

Output:
NO, I have written this Solution Code: x = int(input())

def is_perfect_square(n):
    x = n // 2
    y = set([x])
    while x * x != n:
        x = (x + (n // x)) // 2
        if x in y: return False
        y.add(x)
    return True

if(is_perfect_square(x)):
    print("YES")
else:
    print("NO")

, In this Programming Language: Python, Now tell me if this Code is compilable or not?