Buggy python submission (verdict: Time Limit Exceeded):
def Maximum_Profit(A,N):
    Max = A[1]-A[0]
    for i in range(N-1):
        for j in range(i+1,N):
            if (A[j]-A[i]) > Max :
                Max = A[j]-A[i]
    return Max

N = int(input())
A = [] 
for i in range (N):
    A.append(input())
A = list(map(int,A))
print(Maximum_Profit(A,N))


Fixed submission:
n = int(input())
numbers = []

minv = int(input())
num = int(input())

max_r = num - minv

if(minv > num):
    minv = num

for i in range(2,n):
    num = int(input())
    if(max_r <(num - minv)):
        max_r = num - minv

    if(minv > num):
        minv = num

print(max_r)

Buggy python submission (verdict: Time Limit Exceeded):
def Maximum_Profit(A,N):
    Max = A[1]-A[0]
    for i in range(N-1):
        for j in range(i+1,N):
            if (A[j]-A[i]) > Max :
                Max = A[j]-A[i]
    return Max

N = int(input())
A = [] 
for i in range (N):
    A.append(input())
A = list(map(int,A))
print(Maximum_Profit(A,N))


Fixed submission:
n = int(input())
numbers = []

minv = int(input())
num = int(input())

max_r = num - minv

if(minv > num):
    minv = num

for i in range(2,n):
    num = int(input())
    if(max_r <(num - minv)):
        max_r = num - minv

    if(minv > num):
        minv = num

print(max_r)

Buggy python submission (verdict: Time Limit Exceeded):
def Maximum_Profit(A,N):
    Max = A[1]-A[0]
    for i in range(N-1):
        for j in range(i+1,N):
            if (A[j]-A[i]) > Max :
                Max = A[j]-A[i]
    return Max

N = int(input())
A = [] 
for i in range (N):
    A.append(input())
A = list(map(int,A))
print(Maximum_Profit(A,N))


Fixed submission:
n = int(input())
numbers = []

minv = int(input())
num = int(input())

max_r = num - minv

if(minv > num):
    minv = num

for i in range(2,n):
    num = int(input())
    if(max_r <(num - minv)):
        max_r = num - minv

    if(minv > num):
        minv = num

print(max_r)

Buggy python submission (verdict: Time Limit Exceeded):
def Maximum_Profit(A,N):
    Max = A[1]-A[0]
    for i in range(N-1):
        for j in range(i+1,N):
            if (A[j]-A[i]) > Max :
                Max = A[j]-A[i]
    return Max

N = int(input())
A = [] 
for i in range (N):
    A.append(input())
A = list(map(int,A))
print(Maximum_Profit(A,N))


Fixed submission:
n = int(input())
numbers = []

minv = int(input())
num = int(input())

max_r = num - minv

if(minv > num):
    minv = num

for i in range(2,n):
    num = int(input())
    if(max_r <(num - minv)):
        max_r = num - minv

    if(minv > num):
        minv = num

print(max_r)

Buggy python submission (verdict: Time Limit Exceeded):
def Maximum_Profit(A,N):
    Max = A[1]-A[0]
    for i in range(N-1):
        for j in range(i+1,N):
            if (A[j]-A[i]) > Max :
                Max = A[j]-A[i]
    return Max

N = int(input())
A = [] 
for i in range (N):
    A.append(input())
A = list(map(int,A))
print(Maximum_Profit(A,N))


Fixed submission:
n = int(input())
numbers = []

minv = int(input())
num = int(input())

max_r = num - minv

if(minv > num):
    minv = num

for i in range(2,n):
    num = int(input())
    if(max_r <(num - minv)):
        max_r = num - minv

    if(minv > num):
        minv = num

print(max_r)

Buggy python submission (verdict: Time Limit Exceeded):


def Maximum_Profit(A,N):
    Max = A[1]-A[0]
    for i in range(N-1):
        for j in range(i+1,N):
            if (A[j]-A[i]) > Max :
                Max = A[j]-A[i]
    return Max

N = int(input())
A = [] 
for i in range (N):
    A.append(input())
A = list(map(int,A))
print(Maximum_Profit(A,N))


Fixed submission:
n = int(input())
numbers = []

minv = int(input())
num = int(input())

max_r = num - minv

if(minv > num):
    minv = num

for i in range(2,n):
    num = int(input())
    if(max_r <(num - minv)):
        max_r = num - minv

    if(minv > num):
        minv = num

print(max_r)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [] 
for i in range (N):
    A.append(input())
A = list(map(int,A))
Max = A[1]-A[0]
for i in range(N-1):
    for j in range(i+1,N):
        if (A[j]-A[i]) > Max :
            Max = A[j]-A[i]
print(Max)


Fixed submission:
n = int(input())
numbers = []

minv = int(input())
num = int(input())

max_r = num - minv

if(minv > num):
    minv = num

for i in range(2,n):
    num = int(input())
    if(max_r <(num - minv)):
        max_r = num - minv

    if(minv > num):
        minv = num

print(max_r)