Problem 1782 · Hard
Count pairs by degree sum with two pointers, then subtract the pairs whose shared edges were double-counted.
Open the interactive visualisation