Buggy python submission (verdict: Time Limit Exceeded):
n,t=map(int,input().split())
a=list(map(int,input().split()))
saisyo=min(a)
saidai=0
count=0

for i in range(n-1):
    x=a.pop()
    if x==saisyo:
        saisyo=min(a)
    elif x-saisyo>=saidai:
        mouke=x-saisyo
        if mouke>saidai:
            saidai=mouke
            count=1
        elif mouke==saidai:
            count+=1
    
print(count)

Fixed submission:
n,t=map(int,input().split())
a=list(map(int,input().split()))
saisyo=a[0]
saidai=0
count=0
for i in range(n):
    if a[i]<saisyo:saisyo=a[i]
    else:
        if a[i]-saisyo>saidai:
            saidai=a[i]-saisyo
            count=1
        elif a[i]-saisyo==saidai:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n,t=map(int,input().split())
a=input().split()
for i in range(n):
    a[i]=int(a[i])

saisyo=min(a)
saidai=0
count=0

for i in range(n-1):
    x=a.pop()
    if x==saisyo:
        saisyo=min(a)
    elif x-saisyo>=saidai:
        mouke=x-saisyo
        if mouke>saidai:
            saidai=mouke
            count=1
        elif mouke==saidai:
            count+=1
    
print(count)

Fixed submission:
n,t=map(int,input().split())
a=list(map(int,input().split()))
saisyo=a[0]
saidai=0
count=0
for i in range(n):
    if a[i]<saisyo:saisyo=a[i]
    else:
        if a[i]-saisyo>saidai:
            saidai=a[i]-saisyo
            count=1
        elif a[i]-saisyo==saidai:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n,t=map(int,input().split())
a=input().split()
for i in range(n):
    a[i]=int(a[i])

saisyo=min(a)
saidai=0
count=0

for i in range(n-1):
    x=a.pop()
    if x==saisyo:
        saisyo=min(a)
    elif x>saisyo:
        mouke=x-saisyo
        if mouke>saidai:
            saidai=mouke
            count=1
        elif mouke==saidai:
            count+=1
    
print(count)

Fixed submission:
n,t=map(int,input().split())
a=list(map(int,input().split()))
saisyo=a[0]
saidai=0
count=0
for i in range(n):
    if a[i]<saisyo:saisyo=a[i]
    else:
        if a[i]-saisyo>saidai:
            saidai=a[i]-saisyo
            count=1
        elif a[i]-saisyo==saidai:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n,t=map(int,input().split())
a=input().split()
for i in range(n):
    a[i]=int(a[i])
    
big=max(a)

def calc(a,i,saidai):
    if a[i]+saidai>big:return 0
    x=a[i]
    if i==len(a)-1:return 0
    else:return max(a[i+1:])-x

saidai=0
count=0
for i in range(n):
    ans=calc(a,i,saidai)
    if saidai<ans:
        saidai=ans
        count=1
    elif saidai==ans:count+=1
    
print(count)

Fixed submission:
n,t=map(int,input().split())
a=list(map(int,input().split()))
saisyo=a[0]
saidai=0
count=0
for i in range(n):
    if a[i]<saisyo:saisyo=a[i]
    else:
        if a[i]-saisyo>saidai:
            saidai=a[i]-saisyo
            count=1
        elif a[i]-saisyo==saidai:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n,t=map(int,input().split())
a=input().split()
for i in range(n):
    a[i]=int(a[i])

def calc(a,i):
    x=a[i]
    if i==len(a)-1:return 0
    else:
        nokori=a[i+1:]
        return max(nokori)-x

saidai=0
count=0
for i in range(n):
    ans=calc(a,i)
    if saidai<ans:
        saidai=ans
        count=1
    elif saidai==ans:count+=1
    
print(count)

Fixed submission:
n,t=map(int,input().split())
a=list(map(int,input().split()))
saisyo=a[0]
saidai=0
count=0
for i in range(n):
    if a[i]<saisyo:saisyo=a[i]
    else:
        if a[i]-saisyo>saidai:
            saidai=a[i]-saisyo
            count=1
        elif a[i]-saisyo==saidai:
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n,t=map(int,input().split())
a=input().split()
for i in range(n):
    a[i]=int(a[i])

from collections import defaultdict
mouke=defaultdict(int)
def calc(a,i):
    x=a[i]
    if i==len(a)-1:return 0
    else:
        nokori=a[i+1:]
        return max(nokori)-x

saidai=0
for i in range(n):
    ans=calc(a,i)
    if saidai<ans:saidai=ans
    mouke[ans]+=1
    
print(mouke[saidai])

Fixed submission:
n,t=map(int,input().split())
a=list(map(int,input().split()))
saisyo=a[0]
saidai=0
count=0
for i in range(n):
    if a[i]<saisyo:saisyo=a[i]
    else:
        if a[i]-saisyo>saidai:
            saidai=a[i]-saisyo
            count=1
        elif a[i]-saisyo==saidai:
            count+=1
print(count)