Given a stream of financial transaction amounts, write a program to calculate the running median efficiently.