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
simran07:
20170226 05:59:36
i hate when it gives tle due to cin cout....... 

cake_is_a_lie:
20170215 09:20:09
EDIT: FYI for C++ users


kg93999:
20170114 18:15:14
java = TLE


subodra_9:
20161225 20:47:13
100th =D ... #printf/scanf 

davidgalehouse:
20161013 03:12:26
Cool, for C# I can't even parse the input without a TLE. 

suvro_datta:
20160920 13:03:27
try this one with spoj input 4 16 output: 3 

manish3749:
20160820 20:17:45
to be hell with cin nd cout


mishra_sharad:
20160818 14:54:13
simple one...straightforward logic..AC in one go... 

mkfeuhrer:
20160612 11:48:48
terribly silly ...... use scanf/printf !! costed me WA! easy eucledian gcd 

jitendrakk:
20160612 11:37:32
Never using cin & cout again.. :( 
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 