Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
a = list(map(int,input().split()))
dp = [0] * (N+1)
dp[0] = abs(a[0])
for i in range(1, N):
    dp[i] = abs(a[i]-a[i-1])
dp[N] = abs(a[-1])

for i in range(N):
    ans = sum(dp)
    ans -= dp[i]+dp[i+1]
    if i == 0:
        ans += abs(a[i+1])
    elif i == N-1:
        ans += abs(a[i-1])
    else:
        ans += abs(a[i+1] - a[i-1])
    print(ans)


Fixed submission:
import numpy as np

N = int(input())
a = list(map(int,input().split()))
dp = [0] * (N+1)
dp[0] = abs(a[0])
for i in range(1, N):
    dp[i] = abs(a[i]-a[i-1])
dp[N] = abs(a[-1])
result = sum(dp)
for i in range(N):
    ans = result
    ans -= dp[i]+dp[i+1]
    if i == 0:
        ans += abs(a[i+1])
    elif i == N-1:
        ans += abs(a[i-1])
    else:
        ans += abs(a[i+1] - a[i-1])
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list(map(int,input().split()))

for i in range(N):
    A_new = A[:i] + A[i+1:]
    A_new_new = np.diff(A_new)
    A_new_new = list(map(lambda n:abs(n), A_new_new))
    ans = abs(A_new[0]) + sum(A_new_new) + abs(A_new[-1])
    print(ans)


Fixed submission:
import numpy as np

N = int(input())
a = list(map(int,input().split()))
dp = [0] * (N+1)
dp[0] = abs(a[0])
for i in range(1, N):
    dp[i] = abs(a[i]-a[i-1])
dp[N] = abs(a[-1])
result = sum(dp)
for i in range(N):
    ans = result
    ans -= dp[i]+dp[i+1]
    if i == 0:
        ans += abs(a[i+1])
    elif i == N-1:
        ans += abs(a[i-1])
    else:
        ans += abs(a[i+1] - a[i-1])
    print(ans)
Buggy python submission (verdict: Runtime Error):
import collections

blue = int(input())
blue_string = [input() for i in range(blue)]
blue_type = set(blue_string)
red = int(input())
red_string = [input() for i in range(red)]
red_type = set(red_string)
blue_number = len(blue_type)
result = [0]

for i in range(blue_number):
    blue_sort = blue_type[i]
    bulue_sort_count = blue_string.count(blue_sort)
    red_sort_count = red_string.count(blue_sort)
    result.append(bulue_sort_count - red_sort_count )
print(max(result))


Fixed submission:
import collections

blue = int(input())
blue_string = [input() for i in range(blue)]
blue_type = set(blue_string)
red = int(input())
red_string = [input() for i in range(red)]
red_type = set(red_string)
result = [0]

for i in blue_type:
    bulue_sort_count = blue_string.count(i)
    red_sort_count = red_string.count(i)
    result.append(bulue_sort_count - red_sort_count )
print(max(result))
Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split())
t = 1
if x == y:
    print(-1)
else:
    while True:
        if (x * t) % y != 0:
            print(x * t)
            break
        t += 1


Fixed submission:
x,y = map(int,input().split())
if x % y == 0:
    print(-1)
else:
    print(x)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A_u = np.cumsum(list(map(int,input().split())))
A_d = np.cumsum(list(map(int,input().split())))
ans = 0
if N == 1:
    print(A_u[0]+A_d[0])
    exit()
for i in range(N):
    if i == 0:
        ans = max(ans, A_u[i]+A[-1])
    else:
        ans = max(ans, A_u[i]+A_d[-1]-A_d[i-1])
print(ans)


Fixed submission:
import numpy as np

N = int(input())
A_u = np.cumsum(list(map(int,input().split())))
A_d = np.cumsum(list(map(int,input().split())))
ans = 0
if N == 1:
    print(A_u[0]+A_d[0])
    exit()
for i in range(N):
    if i == 0:
        ans = max(ans, A_u[i]+A_d[-1])
    else:
        ans = max(ans, A_u[i]+A_d[-1]-A_d[i-1])
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())
L = A + B
R = C + D
if L > R:
    print("Left")
elif L = R:
    print("Balanced")
else:
    print("Right")

Fixed submission:
A,B,C,D = map(int, input().split())
L = A + B
R = C + D
if L > R:
    print("Left")
elif L == R:
    print("Balanced")
else:
    print("Right")
Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
a = 0

s.sort()
t.sort()
t = t[::-1]

if len(s) < len(t):
    for i in range(len(s)):
        if s[i] < t[i]:
            print("Yes")
            break
        elif s[i] == t[i]:
            a += 1
            continue
        else:
            print("No")
            break
    if a == len(s):
        print("Yes")

else:
    for i in range(len(s)):
        if s[i] < t[i]:
            print("Yes")
            break
        elif s[i] == t[i]:
            a += 1
            continue
        else:
            print("No")
            break
    if a == len(s):
        print("No")


Fixed submission:
s = list(input())
t = list(input())
a = 0

s.sort()
t.sort()
t = t[::-1]

if len(s) < len(t):
    for i in range(len(s)):
        if s[i] < t[i]:
            print("Yes")
            break
        elif s[i] == t[i]:
            a += 1
            continue
        else:
            print("No")
            break
    if a == len(s):
        print("Yes")

else:
    for i in range(len(t)):
        if s[i] < t[i]:
            print("Yes")
            break
        elif s[i] == t[i]:
            a += 1
            continue
        else:
            print("No")
            break
    if a == len(t):
        print("No")
Buggy python submission (verdict: Runtime Error):
N = input()
sum = 0

for i in N:
    sum += int(i)
if int(N) % sum == 0:
    print("Yes")
else:
    print("No")


Fixed submission:
N,A,B = map(int, input().split())
if N * A >= B:
    print(B)
else:
    print(N * A)
Buggy python submission (verdict: Runtime Error):
N = input()
sum = 0

for i in N:
    sum += i
if N % sum == 0:
    print("Yes")
else:
    print("No")


Fixed submission:
N = input()
sum = 0

for i in N:
    sum += int(i)
if int(N) % sum == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
R = input()
G = input()
print(2 * G - R)

Fixed submission:
R = int(input())
G = int(input())
print(2 * G - R)
Buggy python submission (verdict: Runtime Error):
s = input()
if s[0] == 'Y' and s[1] == 'A' and s[2] == 'K' and s[3] == 'I':
    print('Yes')
    exit()
print('No')


Fixed submission:
s = input()
s_list = []
ans = ['Y', 'A', 'K', 'I']
for i in s:
    s_list.append(i)
s_list = s_list[:4]
if s_list == ans:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
if s[0] == 'Y' and s[1] == 'A' and s[2] == 'K' and s[3] == 'I':
    print('Yes')
else:
    print('No')


Fixed submission:
s = input()
s_list = []
ans = ['Y', 'A', 'K', 'I']
for i in s:
    s_list.append(i)
s_list = s_list[:4]
if s_list == ans:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
result = 0
for i in N:
    if int(i) == 9:
        result += 1
if result >= 1:
    print("Yes")
else:
    print("No")
    

Fixed submission:
N = input()
result = 0
for i in N:
    if int(i) == 9:
        result += 1
if result >= 1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import collections

N = int(input())
a = list(map(int,input().split()))
b = collections.Counter(a)
dp = [0] * (max(a)+1)
dp[0] = b[0] + b[1]
dp[1] = dp[0] + b[2]
for i in range(2, max(a)+1):
    dp[i] = dp[i-1] + b[i+1] - b[i-2]
print(max(dp))


Fixed submission:
import collections

N = int(input())
a = list(map(int,input().split()))
b = collections.Counter(a)
dp = [0] * (max(a)+1)
if len(b) == 1 and a[0] == 0:
    print(N)
    exit()
dp[0] = b[0] + b[1]
dp[1] = dp[0] + b[2]

for i in range(2, max(a)+1):
    dp[i] = dp[i-1] + b[i+1] - b[i-2]
print(max(dp))
Buggy python submission (verdict: Runtime Error):
x,a,b = map(int, input())
if abs(x -a) > abs(x - b):
    print("B")
else:
    print("A")


Fixed submission:
x,a,b = map(int, input().split())
if abs(x -a) >= abs(x - b):
    print("B")
else:
    print("A")
Buggy python submission (verdict: Runtime Error):
import collections

N = int(input())
A = list(map(int,input().split())), reverse = True
B = collections.Couter(A)
C = []
for a,c in B.items():
    C += [a] * c//2
C.sort()

if len(C) >= 2:
    print(C[-1]*C[-2])
else:
    print(0)


Fixed submission:
import collections

N = int(input())
A = list(map(int,input().split()))
B = collections.Counter(A)
C = []
for a,c in B.items():
    C += [a] * (c//2)
C.sort()

if len(C) >= 2:
    print(C[-1]*C[-2])
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
A = sorted(list(map(int,input().split())), reverse = True)
edge = []

for i in range(N):
    a = A[i]
    if A.count(a) >= 2 and a not in edge:
        edge.append(a)
        if len(edge) == 2:
            print(edge[0]*edge[1])
            exit()
        if A.count(a) >= 4:
            print(a*a)
            exit()
print(0)


Fixed submission:
import collections

N = int(input())
A = list(map(int,input().split()))
B = collections.Counter(A)
C = []
for a,c in B.items():
    C += [a] * (c//2)
C.sort()

if len(C) >= 2:
    print(C[-1]*C[-2])
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
if B <= C:
    print(0)
elif C < B <= D:
    print(B - C)
elif C < D <= B:
    print(D - C)
elif D <= A:
    print(0)

Fixed submission:
N = input()
list = []
for i in N:
    list.append(i)
list.reverse()
new = ''.join(list)
if new == N:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
A = []
B = []
for _ in range(M):
    a,b = map(int,input().split())
    if a == 1:
        if b in A:
            print('POSSIBLE')
            exit()
        else:
            B.append(b)
    if b == N:
        if a in B:
            print('POSSIBLE')
            exit()
        else:
            A.append(a)
print('IMPOSSIBLE')


Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
A = []
B = []
for _ in range(M):
    a,b = map(int,input().split())
    if a == 1:
        B.append(b)
    if b == N:
        A.append(a)
for a in A:
    if a in B:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = []
B = []
for _ in range(M):
    a,b = map(int,input().split())
    if a == 1:
        B.append(b)
    if b == N:
        A.appned(a)
for a in A:
    if a in B:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
ab = sorted([list(map(int,input().split())) for _ in range(M)])
C = []
for a, b in ab:
    if a == 1:
        C.append(b)
    else:
        break
if len(C) == 0:
    print('IMPOSSIBLE')
    exit()
for c in C:
    if [c,N] in ab:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
ab = sorted([list(map(int,input().split())) for _ in range(M)])
c = []
for a, b in ab:
    if a == 1:
        c.append(b)
    if b == N:
        if a in c:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")


Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]
ans = 1
seen = [0] * N
seen[0] = 1
now = a[0]

while True:
    if now == 1 or seen[now] == 1:
        print(-1)
        break
    if now == 2:
        print(ans)
        break
    now = a[now-1]
    seen[now] = 1
    ans += 1

Fixed submission:
N = int(input())
button_list = [int(input()) for i in range(N)]
button =  1
count = 0

while True:
    button = button_list[button-1]
    count += 1
    if button == 2:
        break
    if count == N:
        print(-1)
        exit()
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for _ in range(N)]
ans = 1
now = a[0]

while True:
    if now == 1:
        print(-1)
        break
    if now == 2:
        print(ans)
        break
    now = a[now-1]
    ans += 1

Fixed submission:
N = int(input())
button_list = [int(input()) for i in range(N)]
button =  1
count = 0

while True:
    button = button_list[button-1]
    count += 1
    if button == 2:
        break
    if count == N:
        print(-1)
        exit()
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
color = {}
f = 0
for a in A:
    if 1 <= a <= 399:
        color['g'] = 1
    elif 400 <= a <= 799:
        color['br'] = 1
    elif 800 <= a <= 1199:
        color['gr'] = 1
    elif 1200 <= a <= 1599:
        color['m'] = 1
    elif 1600 <= a <= 1999:
        color['b'] = 1
    elif 2000 <= a <= 2399:
        color['y'] = 1
    elif 2400 <= a <= 2799:
        color['o'] = 1
    elif 2800 <= a <= 3199:
        color['r'] = 1
    else:
        f += 1
print(max(1, len(color)), min(len(color)+f))


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
color = {}
f = 0
for a in A:
    if 1 <= a <= 399:
        color['g'] = 1
    elif 400 <= a <= 799:
        color['br'] = 1
    elif 800 <= a <= 1199:
        color['gr'] = 1
    elif 1200 <= a <= 1599:
        color['m'] = 1
    elif 1600 <= a <= 1999:
        color['b'] = 1
    elif 2000 <= a <= 2399:
        color['y'] = 1
    elif 2400 <= a <= 2799:
        color['o'] = 1
    elif 2800 <= a <= 3199:
        color['r'] = 1
    else:
        f += 1
print(max(1, len(color)), len(color)+f)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input()))
color = {}
f = 0
for a in A:
    if 1 <= a <= 399:
        color['g'] = 1
    elif 400 <= a <= 799:
        color['br'] = 1
    elif 800 <= a <= 1199:
        color['gr'] = 1
    elif 1200 <= a <= 1599:
        color['m'] = 1
    elif 1600 <= a <= 1999:
        color['b'] = 1
    elif 2000 <= a <= 2399:
        color['y'] = 1
    elif 2400 <= a <= 2799:
        color['o'] = 1
    elif 2800 <= a <= 3199:
        color['r'] = 1
    else:
        f += 1
print(max(1, len(color)), min(8, len(color)+f))        


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
color = {}
f = 0
for a in A:
    if 1 <= a <= 399:
        color['g'] = 1
    elif 400 <= a <= 799:
        color['br'] = 1
    elif 800 <= a <= 1199:
        color['gr'] = 1
    elif 1200 <= a <= 1599:
        color['m'] = 1
    elif 1600 <= a <= 1999:
        color['b'] = 1
    elif 2000 <= a <= 2399:
        color['y'] = 1
    elif 2400 <= a <= 2799:
        color['o'] = 1
    elif 2800 <= a <= 3199:
        color['r'] = 1
    else:
        f += 1
print(max(1, len(color)), len(color)+f)
Buggy python submission (verdict: Runtime Error):
import math

H, W = map(int,input().split())
ans = math.inf
for i in range(1, H):
    a = i*W
    if H-i == 1:
        d = 1*(W//2)
        e = H*W-a-d
        small = min(a,d,e)
        large = max(a,d,e)
        ans = min(ans, large-small)
    else:
        b = ((H-i)//2) * W
        c = H*W-a-b
        d = (H-i) * (W//2)
        e = H*W-a-d
        small1 = min(a,b,c)
        large1 = max(a,b,c)
        small2 = min(a,d,e)
        large2 = max(a,d,e)
        ans = min(ans, large1-small1, large2-small2)
for j in range(1, W):
    a = j*H
    if W-j == 1:
        d = 1*(H//2)
        e = H*W-a-d
        small = min(a,d,e)
        large = max(a,d,e)
        ans = min(ans, large-small)
    else:
        b = ((W-j)//2) * H
        c = H*W-a-b
        d = (W-j) * (H//2)
        e = H*W-a-d
        small1 = min(a,b,c)
        large1 = max(a,b,c)
        small2 = min(a,d,e)
        large2 = max(a,d,e)
        ans = min(ans, large1-small2, large2-small2)
print(ans)


Fixed submission:
H, W = map(int,input().split())
ans = float('inf')
for i in range(1, H):
    a = i*W
    if H-i == 1:
        d = 1*(W//2)
        e = H*W-a-d
        small = min(a,d,e)
        large = max(a,d,e)
        ans = min(ans, large-small)
    else:
        b = ((H-i)//2) * W
        c = H*W-a-b
        d = (H-i) * (W//2)
        e = H*W-a-d
        small1 = min(a,b,c)
        large1 = max(a,b,c)
        small2 = min(a,d,e)
        large2 = max(a,d,e)
        ans = min(ans, large1-small1, large2-small2)
for j in range(1, W):
    a = j*H
    if W-j == 1:
        d = 1*(H//2)
        e = H*W-a-d
        small = min(a,d,e)
        large = max(a,d,e)
        ans = min(ans, large-small)
    else:
        b = ((W-j)//2) * H
        c = H*W-a-b
        d = (W-j) * (H//2)
        e = H*W-a-d
        small1 = min(a,b,c)
        large1 = max(a,b,c)
        small2 = min(a,d,e)
        large2 = max(a,d,e)
        ans = min(ans, large1-small2, large2-small2)
print(ans)
Buggy python submission (verdict: Runtime Error):
odd = input()
even =input()
even = str(0)+even
odd_list = []
even_list = []

for (a,b) in zip(odd,even):
    odd_list.append(a)
    even_list.append(b)
even_list.append("")
del even_list[0]

for i in range(len(odd_list)):
    print(odd_list[i],end = "")
    print(even_list[i],end = "")


Fixed submission:
a,b,c = map(int,input().split())
if b - a == c - b:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
power = 1

for i in range(1,N+1):
    power *= i

print(power % (10**9+7))


Fixed submission:
N = int(input())
power = 1

for i in range(1,N+1):
    power = power * i % 1000000007

print(power)
Buggy python submission (verdict: Runtime Error):
from functools import reduce
N = int(input())
A = list(range(2,N+1))
sqrt = N**(1/2)
idx = 0
if N == 1:
    print(1)
while True:
    p = A[idx]
    if p > sqrt:
        break
    check_numbers = A[idx+1:]
    for check_number in check_numbers:
        if check_number % p == 0:
            A.remove(check_number)
    idx += 1

ans = 1
B = [1] * 1001
for n in range(2, N+1):
    for a in A:
        if n == 1:
            break
        while True:
            if n % a == 0:
                B[a] += 1
                n //= a
            else:
                break
MOD = 10**9+7
print(reduce(lambda a,b: a*b , B)%MOD)


Fixed submission:
from functools import reduce
N = int(input())
A = list(range(2,N+1))
sqrt = N**(1/2)
idx = 0
if N == 1:
    print(1)
    exit()
while True:
    p = A[idx]
    if p > sqrt:
        break
    check_numbers = A[idx+1:]
    for check_number in check_numbers:
        if check_number % p == 0:
            A.remove(check_number)
    idx += 1

ans = 1
B = [1] * 1001
for n in range(2, N+1):
    for a in A:
        if n == 1:
            break
        while True:
            if n % a == 0:
                B[a] += 1
                n //= a
            else:
                break
MOD = 10**9+7
print(reduce(lambda a,b: a*b , B)%MOD)
Buggy python submission (verdict: Runtime Error):
K,S = map(int,input().split())
count=0

for x in range(K+1):
    for y in range(K+1):
        if 0 <= S-x-y <= K:
                count += 1

print(count)


Fixed submission:
s = list(input().split(",",2))
a = " ".join(s)
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
count=0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x + y + z == S:
                count += 1

print(count)


Fixed submission:
K,S = map(int,input().split())
count=0

for x in range(K+1):
    for y in range(K+1):
        if 0 <= S-x-y <= K:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int,input().split())))
if N % 2 == 0:
    for i in range(1, N//2+1):
        if A[(i-1)*2] == A[1+(i-1)*2] == 2*i-1:
            continue
        else:
            print(0)
            exit()
    print(2**(N//2))
else:
    if A[0] == 0 and A[1] != 0:
        for i in range(1, N//2+1):
            if A[2*i-1] == A[2*i] == 2*i:
                continue
            else:
                print(0)
                exit()
        print(2**(N//2))
    else:
        print(0)
        exit()


Fixed submission:
N = int(input())
A = sorted(list(map(int,input().split())))
MOD = 10**9+7
if N == 1:
    print(1)
    exit()
if N % 2 == 0:
    for i in range(1, N//2+1):
        if A[(i-1)*2] == A[1+(i-1)*2] == 2*i-1:
            pass
        else:
            print(0)
            exit()
    print(2**(N//2)%MOD)
else:
    if A[0] == 0 and A[1] != 0:
        for i in range(1, N//2+1):
            if A[2*i-1] == A[2*i] == 2*i:
                pass
            else:
                print(0)
                exit()
        print(2**(N//2)%MOD)
    else:
        print(0)
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())
count = 0

for i in range(a,b+1):
    if i % x == 0:
        count += 1
print(count)


Fixed submission:
a,b,x = map(int,input().split())

print(b//x - (a-1)//x)
Buggy python submission (verdict: Time Limit Exceeded):
N, T = map(int,input().split())
A = list(map(int,input().split()))
p = 0
ans = 0
for i in range(1, N):
    t = max(A[i:]) - A[i-1]
    if p == t:
        ans += 1
    elif p < t:
        p = t
        ans = 1
print(ans)


Fixed submission:
import numpy as np
N, T = map(int,input().split())
A = np.array(input().split(), dtype=np.int32)

A_mi = np.minimum.accumulate(A)
pro = A - A_mi

answer = sum(pro == max(pro))
print(answer)