Buggy python submission (verdict: Time Limit Exceeded):
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=(min(A)-max(A))
    for i in range(n-1):
        for j in range(i+1,n):
            if Max<A[j]-A[i]:
                Max=A[j]-A[i]
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)


Fixed submission:
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=A[1]-A[0]
    Min=A[0]
    for j in range(1,n):
        Max=max(Max,A[j]-Min)
        Min=min(Min,A[j])
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)

Buggy python submission (verdict: Time Limit Exceeded):
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=(min(A)-max(A))
    for i in range(n-1):
        if Max<(max(A[i+1:])-A[i]):
            Max=(max(A[i+1:])-A[i])
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)



Fixed submission:
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=A[1]-A[0]
    Min=A[0]
    for j in range(1,n):
        Max=max(Max,A[j]-Min)
        Min=min(Min,A[j])
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)

Buggy python submission (verdict: Time Limit Exceeded):
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=(min(A)-max(A))
    for i in range(n-1):
        tmp=(max(A[i+1:])-A[i])
        if Max<tmp:
            Max=tmp
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)



Fixed submission:
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=A[1]-A[0]
    Min=A[0]
    for j in range(1,n):
        Max=max(Max,A[j]-Min)
        Min=min(Min,A[j])
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)

Buggy python submission (verdict: Runtime Error):
#16D8101012J 伊藤惇 dj Python3
import sys

def Maximum_Profit(n,A):
    Max=-sys.maxint-1
    for i in range(n-1):
        tmp=(max(A[i+1:])-A[i])
        if Max<tmp:
            Max=tmp
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)



Fixed submission:
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=A[1]-A[0]
    Min=A[0]
    for j in range(1,n):
        Max=max(Max,A[j]-Min)
        Min=min(Min,A[j])
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)

Buggy python submission (verdict: Time Limit Exceeded):
#16D8101012J 伊藤惇 dj Python3
import sys

def Maximum_Profit(n,A):
    Max=-sys.maxsize
    for i in range(n-1):
        tmp=(max(A[i+1:])-A[i])
        if Max<tmp:
            Max=tmp
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)



Fixed submission:
#16D8101012J 伊藤惇 dj Python3

def Maximum_Profit(n,A):
    Max=A[1]-A[0]
    Min=A[0]
    for j in range(1,n):
        Max=max(Max,A[j]-Min)
        Min=min(Min,A[j])
    return Max

if __name__ == "__main__":
    n=int(input())
    A=[]
    for i in range(n):
        A.append(int(input()))
    Max=Maximum_Profit(n,A)
    print(Max)