Skip to main content

Practice · 1 of 3

Overflow Pairs

CHALLENGE
Difficulty: advanced+25 XP

**Problem.** Line 1: n target. Then n values. Print the number of unordered pairs with a[i] + a[j] == target. **Constraints:** 1 ≤ n ≤ 200000; 1 ≤ a_i ≤ 2*10^9; target < 4*10^9. Values near 2e9 make 32-bit sums wrap negative.

Back to lesson: Practice: Bug Hunt