Comparator function to sort in increasing order of second values in each pair
bool compare ( pair < int , int > f , pair < int , int > s ) { return f . second < s . second ; } struct hash_pair { template < class T1 , class T2 > size_t operator() ( const pair < T1 , T2 > & p ) const { auto hash1 = hash < T1 > { } ( p . first ) ; auto hash2 = hash < T2 > { } ( p . second ) ; return hash1 ^ hash2 ; } } ;