Given a stream of financial transaction amounts, write a program to calculate the running median efficiently.
Implement running_median(amounts), where amounts is an ordered list of integer amounts. Return a list containing the median after each amount is received. For an even number of amounts, return the arithmetic mean of the two middle values. Return an empty list for an empty input.
def running_median(amounts):