If pair follow this condition insert the pair in vector ans
if ( v . get ( i ) * v . get ( j ) >= p * q / 4 && v . get ( i ) * v . get ( j ) <= p * q ) { pair < Integer , Integer > x = new pair < > ( ) ; x . first = v . get ( i ) ; x . second = v . get ( j ) ; ans . add ( x ) ; } } }