Problem:
There are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant is going on a travel from town 1 to town N, buying and selling apples.  Takahashi will begin the travel at town 1, with no apple in his possession. The actions that can be performed during the travel are as follows:    * _Move_ : When at town i (i < N), move to town i + 1.   * _Merchandise_ : Buy or sell an arbitrary number of apples at the current town. Here, it is assumed that one apple can always be bought and sold for A_i yen (the currency of Japan) at town i (1 ≦ i ≦ N), where A_i are distinct integers. Also, you can assume that he has an infinite supply of money.  For some reason, there is a constraint on merchandising apple during the travel: the sum of the number of apples bought and the number of apples sold during the whole travel, must be at most T. (Note that a single apple can be counted in both.)  During the travel, Takahashi will perform actions so that the _profit_ of the travel is maximized. Here, the profit of the travel is the amount of money that is gained by selling apples, minus the amount of money that is spent on buying apples. Note that we are not interested in apples in his possession at the end of the travel.  Aoki, a business rival of Takahashi, wants to trouble Takahashi by manipulating the market price of apples. Prior to the beginning of Takahashi's travel, Aoki can change A_i into another arbitrary non-negative integer A_i' for any town i, any number of times. The cost of performing this operation is |A_i - A_i'|. After performing this operation, different towns may have equal values of A_i.  Aoki's objective is to decrease Takahashi's expected profit by at least 1 yen. Find the minimum total cost to achieve it. You may assume that Takahashi's expected profit is initially at least 1 yen.

Incorrect submission (verdict: Wrong Answer):
def get_next_int():
    return int(float(input()))


def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])


def get_next_str():
    return input()


def get_next_strs(delim=" "):
    return tuple(input().split(delim))


def get_next_by_types(*value_types, delim=" "):
    return tuple([t(x) for t, x in zip(value_types, input().split(delim))])


def solve():
    N, T = get_next_ints()
    values = get_next_ints()

    r_values = reversed(values)

    count = 0
    max_val = 0
    max_diff = 0
    for value in r_values:
        if value >= max_val:
            max_val = value
            continue
        diff = max_val - value
        if diff > max_diff:
            max_diff = max_val - value
            count = 1
        elif diff == max_diff:
            count += 1
    print(count)

Fixed, accepted submission:
def get_next_int():
    return int(float(input()))


def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])


def get_next_str():
    return input()


def get_next_strs(delim=" "):
    return tuple(input().split(delim))


def get_next_by_types(*value_types, delim=" "):
    return tuple([t(x) for t, x in zip(value_types, input().split(delim))])


def solve():
    N, T = get_next_ints()
    values = get_next_ints()

    r_values = reversed(values)

    count = 0
    max_val = 0
    max_diff = 0
    for value in r_values:
        if value >= max_val:
            max_val = value
            continue
        diff = max_val - value
        if diff > max_diff:
            max_diff = max_val - value
            count = 1
        elif diff == max_diff:
            count += 1
    print(count)

solve()