Ram and Shyam are sitting next to each other, hoping to cheat on an exam. However, the examination board has prepared $p$ different sets of questions (numbered $0$ through $p-1$), which will be distributed to the students in the following way:
- The students are assigned roll numbers — pairwise distinct positive integers.
- If a student's roll number is $r$, this student gets the $((r-1)\%p)$-th set of questions.
Obviously, Ram and Shyam can cheat only if they get the same set of questions.
You are given the roll numbers of Ram and Shyam: $A$ and $B$ respectively. Find the number of values of $p$ for which they can cheat, or determine that there is an infinite number of such values.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first and only line of each test case contains two space-separated integers $A$ and $B$.

-----Output-----
For each test case, print a single line — the number of values of $p$ for which Ram and Shyam can cheat, or $-1$ if there is an infinite number of such values.

-----Constraints-----
- $1 \le T \le 100$
- $1 \le A, B \le 10^8$

-----Example Input-----
1
2 6

-----Example Output-----
3

-----Explanation-----
Example case 1: They can cheat for $p = 1$, $p = 2$ or $p = 4$.

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
for test in range(0,int(input())):
 A,B = map(int,input().split())
 diff = abs(A-B)
 count=0
 if not(A^B):
  print(-1)
 else:
  for i in range(1,int(diff**(1/2))+1):
   if diff%i==0:
    if diff/i==i:
     count+=1 
    else:
     count+=2
  print(count)

# cook your dish here
#import sys
#input=sys.stdin.readline
#m=int(input())
for nt in range(int(input())):
 a,b=list(map(int,input().split()))
 n=abs(a-b)
 cnt=0
 for i in range(1,int(n**(1/2))+1):
  if n%i==0:
   if n/i==i:
    cnt+=1 
   else:
    cnt+=2 
 print(cnt)
   
  


import math
for _ in range(int(input())):

 a,b = list(map(int,input().split()))

 diff = abs(a-b)



 count = 0

 for i in range(1,int(math.sqrt(diff))+1):

  if diff%i==0:

   if i==diff//i:
    count+=1
   else:
    count+=2
 
 print(count)


 



from math import sqrt

def get_factors(n):
 f = 0
 for i in range(1,int(sqrt(n))+1):
  if(n%i==0):
   f += 1
   if(i!=n//i):
    f += 1
 return f

T = int(input())
ans = []

for _ in range(T):
 A,B = [int(i) for i in input().split()]

 x = A-1
 y = B-1

 ans.append(get_factors(abs(x-y)))

for i in ans:
 print(i)


#just code here
def divisors(x):
 f=0
 for i in range(1,int(x**0.5)+1):
  if x%i==0:
   if (x//i)==i:
    f+=1
   else:
    f+=2
 return f
for _ in range(int(input())):
 a,b=map(int,input().split())
 print(divisors(abs(a-b)))