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: #include<bits/stdc++.h>
using namespace std;
#define endl            "\n"
#define ll				long long int
#define f(n) 			for(int i=0;i<n;i++)
#define fo(n)			for(int j=0;j<n;j++)
#define foo(n)			for(int i=1;i<=n;i++)
#define ff 				first
#define ss 				second
#define pb 				push_back
#define pii 			pair<int,int>
#define vi 				vector<int>
#define vp 				vector<pii>
#define test            int tt; cin>>tt; while(tt--)
#define mod 			1000000007
void fastio()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("Input 1.txt", "r", stdin);
	freopen("Output 1.txt", "w", stdout);
#endif
}
bool check(ll n) {
	ll l = 0, r = n;
	ll ans = -1;
	while (l <= r) {
		ll a = (2 * l + r) / 3;
		ll b = (l + 2 * r) / 3;
		bool x = (a * a >= n);
		bool y = (b * b >= n);
		if (x == false && y == false) {
			l = b + 1;
		}
		else if ((x == true) && (y == true)) {
			ans = a;
			r = a - 1;
		}
		else {
			ans = b;
			l = a + 1;
			r = b - 1;
		}
	}
	return (ans * ans == n);
}

int main() {
	fastio();
	ll n;
	cin >> n;
	if (check(n)) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?