Time trickles slowly but surely
All submissions for this problem are available.**Time knows neither friend nor foe. We never realize that we have it, yet we always lament that we never had enough of it.** Dread him, fear him, or run from him, Thanos has still arrived on Titan, where the Avengers once kept so close a watch. Unrestricted travel has now made it possible for him to appear wherever he wishes, and sensing that time is running out, he decides to act whenever he can. Although Doctor Strange and Tony Stark have disagreed in the past, they know that they must conceal their vulnerabilities and work together to stop Thanos. Doctor Strange, using the Time Stone, has foreseen the outcomes that may result from this point onwards. An outcome can be described by the **relative occurrence** value $R$, indicating how likely it is to occur. But considering the relative occurrence alone is not sufficient, as two outcomes may be dependent. Thus, Tony decides that one must consider the divisors of the **relative occurrence** $R$. Each divisor may contribute positively or negatively to the occurrence. But Quill who is known to goof up decides to simplify things, which will have ultimately lead to the downfall of the Time Stone. Quill decides that the **relative occurrence** $R$ should be replaced by the **sum of an alternating series** of the **divisors** of $R$ sorted in **descending order**. For example, if $R$ = 6, one should replace $R$ by **6 - 3 + 2 - 1 = 4**, and this is called the **alternate occurrence** $R$$'$. Spiderman swings in with another suggestion. To compare two outcomes **(A,B)**, one must consider the value of **A' - B'**, called the **paired alternate occurrence.** Thanos appears mysteriously and overhears the entire conversation. He wishes to compute the **paired alternate occurrence** for an ordered pair of outcomes **(A,B)** so that he may act strategically to gain the Time Stone. If you feel added time at this stage can be a huge bonus, what better way than to collect the time stone? ###Input Format: The first line of Input consists of $T$, the number of test cases. Each test case consists of two space separated integers $A$ and $B$, denoting the relative occurrences of each pair of integers. ###Output format: Print a single line for each test case, the value of the paired alternate occurrence of the **ordered pair (A,B).** ###Constraints: $1$ $\leq$ $T$ $\leq$ **105** $1$ $\leq$ $A$,$B$, $\leq$ **106** ###Sample Input: 1 6 4 ###Sample Output: 1 ###Explanation: The alternate occurrence of 6 is 6 - 3 + 2 - 1 = 4. The alternate occurrence of 4 is 4 - 2 + 1 = 3.
|Time Limit:||1 - 3 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, COB, FS|
Fetching successful submissions