Integer memindahkan solusi codeforces

#include<iostream>
#include<cmath>
using namespace std;

void solve()
{
	int x, y;
	double ans;
	cin >> x >> y;
	ans = sqrt(pow(0 - x, 2) + pow(0 - y, 2));
	if (x == 0 && y == 0)
		cout << 0 << "\n";
	else if (ans == (int)ans)
		cout << 1 << "\n";
	else
		cout << 2 << "\n";
}

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}
coder