Count total Ordered_pairs
for ( auto entry : m ) { int X = entry . first ; int Y = entry . second ; for ( int j = 1 ; j <= Y ; j ++ ) { if ( m [ j ] >= X ) orderedPairs ++ ; } } return orderedPairs ; }