Find all pairs with sum equals to " sum - arr [ i ] "
unordered_set < int > s ; for ( int j = i + 1 ; j < n ; j ++ ) { int x = sum - ( arr [ i ] + arr [ j ] ) ; if ( s . find ( x ) != s . end ( ) ) printf ( " % d ▁ % d ▁ % d STRNEWLINE " , x , arr [ i ] , arr [ j ] ) ; else s . insert ( arr [ j ] ) ; } } }