COMDIV  Number of common divisors
You will be given T (T<=10^6) pair of numbers. All you have to tell is the number of common divisors between two numbers in each pair.
Input
First line of input: T (Number of test cases)
In next T lines, each have one pair A B (0 < A, B <= 10^6)
Output
One integer describing number of common divisors between two numbers.
Example
Input: 3
100000 100000
12 24
747794 238336
Output: 36
6
2
hide comments
mdsharique:
20151221 07:59:47
atlast AC after several TLE 

Prateek Agarwal:
20151212 14:34:40
Very Tight Time limit. AC in c++ but TLE in python.


ram_1897:
20150925 09:21:26
use euclidean algorithm to compute gcd :) 

Abdulsalam Abdo Helal:
20150915 14:30:30
scanf and prinf is recommended to pass time


Abishek:
20150910 10:00:03
fast i/o and basic math ! 

Medo:
20150820 16:03:11
If you are sure of your complexity. Change to Printf scanf, and make sure all your variables are declared as int not long long. 

prakash_reddy:
20150818 15:56:38
Nice problem.... :) 

sy_117:
20150815 16:04:40
AC in first go.....Basic Math nothing else! 

Indian Cyber Army (IndiShell):
20150808 11:16:29
My code is running perfectly on Dev C++ but here its showing runtime error with floating point exception. I have used long long int. can you please point out the error to me.


Sue:
20150625 11:55:55
AC in the first go ~

Added by:  Mir Wasi Ahmed 
Date:  20101031 
Time limit:  0.600s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  Own problem, used in UODA TST 