Sum of Pairwise GCDs — Solution & Editorial
For each d, count pairs whose gcd is a MULTIPLE of d = C(cnt-multiples, 2), then recover pairs with gcd EXACTLY d by a downward subtractive sieve; sum d·exact[d].
Complexity: O(V log V + N)
Watch out: The answer reaches ~105·C(N,2) ≈ 5×1014.