from math import *
from collections import deque
from copy import deepcopy
import sys
def inp(): return sys.stdin.readline().rstrip("\r\n") def multi(): return map(int, input().split())
def strmulti(): return map(str, inp().split())
def lis(): return list(map(int, inp().split()))
def lcm(a, b): return (a * b) // gcd(a, b)
def ncr(n, r): return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))
def stringlis(): return list(map(str, inp().split()))
def out(var): sys.stdout.write(str(var)) def printlist(a):
print(' '.join(str(a[i]) for i in range(len(a))))
def isPrime(n):
if (n <= 1): return False
if (n <= 3): return True
if (n % 2 == 0 or n % 3 == 0): return False
i = 5
while (i * i <= n):
if (n % i == 0 or n % (i + 2) == 0):
return False
i = i + 6
return True
def google():
t = int(inp())
for T in range(t):
print("Case #" + str(T + 1) + ": ", end="")
solve()
def normal(x):
if(x==0):
t = int(inp())
else:
t=1
for T in range(t):
solve()
def solve():
x,y = map(int,input().split())
if(x==0 and y==0):
print(0)
elif((x**2+y**2)**(0.5)==floor((x**2+y**2)**(0.5))):
print(1)
else:
print(2)
return
normal(0)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll t;
cin>>t;
while(t--){
float a, b;
cin>>a>>b;
if(a== 0 && b== 0){
cout<<0<<endl;
continue;
}
float x= (a*a)+ (b*b);
ll y= x;
x= sqrt(x);
y= sqrt(y);
if(x== y){
cout<<1<<endl;
}
else{
cout<<2<<endl;
}
}
return 0;
}
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |
e-maze-in | Bricks Game |
Char Sum | Two Strings |
Anagrams | Prime Number |
Lexical Sorting Reloaded | 1514A - Perfectly Imperfect Array |
580A- Kefa and First Steps | 1472B- Fair Division |
996A - Hit the Lottery | MSNSADM1 Football |
MATCHES Playing with Matches | HRDSEQ Hard Sequence |
DRCHEF Doctor Chef | 559. Maximum Depth of N-ary Tree |
821. Shortest Distance to a Character | 1441. Build an Array With Stack Operations |
1356. Sort Integers by The Number of 1 Bits | 922. Sort Array By Parity II |
344. Reverse String | 1047. Remove All Adjacent Duplicates In String |
977. Squares of a Sorted Array | 852. Peak Index in a Mountain Array |