Check if i - arr [ j ] exist in the array or not using set If yes , Then i can be represented as sum of arr [ j ] + ( i - arr [ j ] )
if ( s . find ( i - arr [ j ] ) != s . end ( ) && arr [ j ] != ( i - arr [ j ] ) ) count ++ ;