Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n-1):
    if(min > A[i]):
        for j in range(j,n-1):
            if(max < A[j+1]-A[i]):
                max = A[j+1]-A[i]
print(max)


Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n):
    if(max < A[i]-min):
        max = A[i]-min
    if(min > A[i]):
        min = A[i]

print(max)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n-2):
    if(min > A[i]):
        for j in range(j,n-1):
            if(max < A[j+1]-A[i]):
                max = A[j+1]-A[i]
print(max)


Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n):
    if(max < A[i]-min):
        max = A[i]-min
    if(min > A[i]):
        min = A[i]

print(max)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n-2):
    if(min > A[i]):
        for j in range(j,n-1):
            if(max < A[j+1]-A[i]):
                max = A[j+1]-A[i]
print(max)


Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n):
    if(max < A[i]-min):
        max = A[i]-min
    if(min > A[i]):
        min = A[i]

print(max)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n-1):
    if(min > A[i]):
        for j in range(j,n-1):
            if(max < A[j+1]-A[i]):
                max = A[j+1]-A[i]
print(max)


Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n):
    if(max < A[i]-min):
        max = A[i]-min
    if(min > A[i]):
        min = A[i]

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(n-1):
    if(max < A[i+1]-A[0]):
        max = A[i+1]-A[0]

for i in range(1,n-1):
    if(min > A[i]):
        for j in range(i,n-1):
            if(max < A[j+1]-A[i]):
                max = A[j+1]-A[i]
print(max)


Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n):
    if(max < A[i]-min):
        max = A[i]-min
    if(min > A[i]):
        min = A[i]

print(max)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(n-1):
    if(max < A[i+1]-A[0]):
        max = A[i+1]-A[0]

for i in range(1,n-1):
    if(min > A[i]):
        for j in range(i,n-1):
            if(max < A[j+1]-A[i]):
                max = A[j+1]-A[i]
print(max)


Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
max = A[1]-A[0]
min = A[0]

for i in range(1,n):
    if(max < A[i]-min):
        max = A[i]-min
    if(min > A[i]):
        min = A[i]

print(max)