Buggy python submission (verdict: Runtime Error):
n=int(input())
fir=int(input())
sec=int(input())
max=sec
if(fir>sec):
    min=sec
elif(fir<=sec):
    min=fir
max_dif=sec-fir
for i in range(n-2):
    x=int(input())
    if x>max_num:
        max_num = x
        if max_dif < x-min:
            max_dif = x-min
    if x<min:
        min = x
        max_num=1
print(max_dif)

Fixed submission:
#ALDS1_1_D Maximum Profit
n=int(input())
A=[]
max_dif=-1*10**9
for i in range(n):
    A.append(int(input()))
min=A[0]
for i in range(n-1):
    if(A[i+1]-min>max_dif):
        max_dif=A[i+1]-min
    if(min>A[i+1]):
        min=A[i+1]
print(max_dif)

Buggy python submission (verdict: Runtime Error):
n=int(input())
fir=int(input())
sec=int(input())
max=sec
if(fir>sec):
    min=sec
elif(fir<=sec):
    min=fir
max_dif=sec-fir
for i in range(n-2):
    x=int(input())
    if x>max_num:
        max_num = x
        if max_dif < x-min:
            max_dif = x-min
    if x<min:
        min = x
        max_num=1
print(max_dif)

Fixed submission:
#ALDS1_1_D Maximum Profit
n=int(input())
A=[]
max_dif=-1*10**9
for i in range(n):
    A.append(int(input()))
min=A[0]
for i in range(n-1):
    if(A[i+1]-min>max_dif):
        max_dif=A[i+1]-min
    if(min>A[i+1]):
        min=A[i+1]
print(max_dif)

Buggy python submission (verdict: Runtime Error):
n=int(input())
fir=int(input())
sec=int(input())
max=sec
if(fir>sec):
    min=sec
elif(fir<=sec):
    min=fir
max_dif=sec-fir
for i in range(n-2):
    x=int(input())
    if x>max_num:
        max_num = x
        if max_dif < x-min:
            max_dif = x-min
    if x<min:
        min = x
        max_num=1
print(max_dif)

Fixed submission:
#ALDS1_1_D Maximum Profit
n=int(input())
A=[]
max_dif=-1*10**9
for i in range(n):
    A.append(int(input()))
min=A[0]
for i in range(n-1):
    if(A[i+1]-min>max_dif):
        max_dif=A[i+1]-min
    if(min>A[i+1]):
        min=A[i+1]
print(max_dif)

Buggy python submission (verdict: Runtime Error):
n=int(input())
fir=int(input())
sec=int(input())
max=sec
if(fir>sec):
    min=sec
elif(fir<=sec):
    min=fir
max_dif=sec-fir
if n>2:
    for i in range(n-2):
        x=int(input())
        if x>max_num:
            max_num = x
            if max_dif < x-min:
                max_dif = x-min
        if x<min:
            min = x
            max_num=1
print(max_dif)

Fixed submission:
#ALDS1_1_D Maximum Profit
n=int(input())
A=[]
max_dif=-1*10**9
for i in range(n):
    A.append(int(input()))
min=A[0]
for i in range(n-1):
    if(A[i+1]-min>max_dif):
        max_dif=A[i+1]-min
    if(min>A[i+1]):
        min=A[i+1]
print(max_dif)

Buggy python submission (verdict: Runtime Error):
n=int(input())
fir=int(input())
sec=int(input())
max_=sec
if(fir>sec):
    min_=sec
elif(fir<=sec):
    min_=fir
max_dif=sec-fir
if n>2:
    for i in range(n-2):
        x=int(input())
        if x>max_num:
            max_num = x
            if max_dif < x-min_:
                max_dif = x-min_
        if x<min_:
            min_ = x
            max_num=1
print(max_dif)

Fixed submission:
#ALDS1_1_D Maximum Profit
n=int(input())
A=[]
max_dif=-1*10**9
for i in range(n):
    A.append(int(input()))
min=A[0]
for i in range(n-1):
    if(A[i+1]-min>max_dif):
        max_dif=A[i+1]-min
    if(min>A[i+1]):
        min=A[i+1]
print(max_dif)

Buggy python submission (verdict: Runtime Error):
n=int(input())
fir=int(input())
sec=int(input())
max_=sec
if(fir>sec):
    min_=sec
elif(fir<=sec):
    min_=fir
max_dif=sec-fir
if n>2:
    for i in range(n-3):
        x=int(input())
        if x>max_num:
            max_num = x
            if max_dif < x-min_:
                max_dif = x-min_
        if x<min_:
            min_ = x
            max_num=1
print(max_dif)

Fixed submission:
#ALDS1_1_D Maximum Profit
n=int(input())
A=[]
max_dif=-1*10**9
for i in range(n):
    A.append(int(input()))
min=A[0]
for i in range(n-1):
    if(A[i+1]-min>max_dif):
        max_dif=A[i+1]-min
    if(min>A[i+1]):
        min=A[i+1]
print(max_dif)