class Solution:
    def isPerfectSquare(self, num: int) -> bool:
        if num < 2:
            return True
        lo, hi = 2, num // 2
        while lo <= hi:
            mid = (lo + hi) >> 1
            squared_num = mid * mid
            if squared_num == num:
                return True
            elif squared_num < num:
                lo = mid + 1
            else:
                hi = mid - 1
        return False


if __name__ == '__main__':
    s = Solution()
    res = s.isPerfectSquare(14)
    print(res)
c9b40456b5bb7a12aae3475ca8dd23e05f5f60e1
<mask token>

class Solution:
    <mask token>


<mask token>

class Solution:

    def isPerfectSquare(self, num: int) ->bool:
        if num < 2:
            return True
        lo, hi = 2, num // 2
        while lo <= hi:
            mid = lo + hi >> 1
            squared_num = mid * mid
            if squared_num == num:
                return True
            elif squared_num < num:
                lo = mid + 1
            else:
                hi = mid - 1
        return False


<mask token>

class Solution:

    def isPerfectSquare(self, num: int) ->bool:
        if num < 2:
            return True
        lo, hi = 2, num // 2
        while lo <= hi:
            mid = lo + hi >> 1
            squared_num = mid * mid
            if squared_num == num:
                return True
            elif squared_num < num:
                lo = mid + 1
            else:
                hi = mid - 1
        return False


if __name__ == '__main__':
    s = Solution()
    res = s.isPerfectSquare(14)
    print(res)

class Solution:
    def isPerfectSquare(self, num: int) -> bool:
        if num < 2:
            return True
        lo, hi = 2, num // 2
        while lo <= hi:
            mid = (lo + hi) >> 1
            squared_num = mid * mid
            if squared_num == num:
                return True
            elif squared_num < num:
                lo = mid + 1
            else:
                hi = mid - 1
        return False


if __name__ == '__main__':
    s = Solution()
    res = s.isPerfectSquare(14)
    print(res)