Check if the current selling price is less than that of the previous transactions
while ( ! transaction . empty ( ) && prices [ sell - 1 ] > prices [ transaction . top ( ) . second - 1 ] ) { pair < int , int > p = transaction . top ( ) ;