Buggy python submission (verdict: Runtime Error):
N = input()
a = []
for i in range(N):
    a.append(input())
max_profit = a[1] - a[0]
for i in range(2,N):
	if a[i] - a[i-1] > max_profit
		max_profit = a[i] - a[i-1]
print(max_profit)

Fixed submission:
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
max_profit = a[1] - a[0]
min_val = min(a[1],a[0])
for i in range(2,N):
	if a[i] < min_val:
		min_val = a[i]
	elif a[i] - min_val > max_profit:
		max_profit = a[i] - min_val
print(str(max_profit))

Buggy python submission (verdict: Runtime Error):
N = input()
a = []
for i in range(N):
    a.append(input())
max_profit = a[1] - a[0]
for i in range(2,N):
	if a[i] - a[i-1] > max_profit
		max_profit = a[i] - a[i-1]
print(str(max_profit))

Fixed submission:
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
max_profit = a[1] - a[0]
min_val = min(a[1],a[0])
for i in range(2,N):
	if a[i] < min_val:
		min_val = a[i]
	elif a[i] - min_val > max_profit:
		max_profit = a[i] - min_val
print(str(max_profit))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
for i in range(N):
    a.append(int(input())
max_profit = a[1] - a[0]
for i in range(2,N):
	if a[i] - a[i-1] > max_profit:
		max_profit = a[i] - a[i-1]
print(str(max_profit))

Fixed submission:
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
max_profit = a[1] - a[0]
min_val = min(a[1],a[0])
for i in range(2,N):
	if a[i] < min_val:
		min_val = a[i]
	elif a[i] - min_val > max_profit:
		max_profit = a[i] - min_val
print(str(max_profit))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
max_profit = a[1] - a[0]
min_val = min(a[1],a[0])
for i in range(2,N):
	if a[i] < min_val:
		min_val = a[i]
	else if a[i] - min_val > max_profit:
		max_profit = a[i] - min_val
print(str(max_profit))

Fixed submission:
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
max_profit = a[1] - a[0]
min_val = min(a[1],a[0])
for i in range(2,N):
	if a[i] < min_val:
		min_val = a[i]
	elif a[i] - min_val > max_profit:
		max_profit = a[i] - min_val
print(str(max_profit))

Buggy python submission (verdict: Runtime Error):
import sys

num = int(input())
input_line = sys.stdin.readlines()
inputnum = [int(x.strip()) for x in input_line]

diff = []
for j in range(num):
    for i in range(j):
        diff.append(inputnum[j] - inputnum[i])
print(max(*diff))

Fixed submission:
import sys

n = int(input())
r0 = int(input())
r1 = int(input())
mx = r1 - r0
mn = min(r1, r0)

for i in map(int, sys.stdin.readlines()):
    if mx < i - mn:
        mx = i - mn
    if mn > i:
        mn = i

print(mx)

Buggy python submission (verdict: Runtime Error):
n = int(input())

maxv = -2000000000

lst = [int(input()) for _ in range(n)]

minv = lst[0]

for i in range(n + 1):
   maxv = max([maxv, lst[i] - minv])
   minv = min([minv, lst[i])

print(maxv) 


Fixed submission:
n = int(input())
 
maxv = -2000000000
 
 
minv = int(input())
 
for i in range(1, n):
   cur = int(input())
   maxv = max([maxv, cur - minv])
   minv = min([minv, cur])
 
print(maxv)

Buggy python submission (verdict: Runtime Error):
n = int(input())

maxv = -2000000000

lst = [int(input()) for _ in range(n)]

minv = lst[0]

for i in range(1, n):
   maxv = max([maxv, lst[i] - minv])
   minv = min([minv, lst[i])

print(maxv)


Fixed submission:
n = int(input())
 
maxv = -2000000000
 
 
minv = int(input())
 
for i in range(1, n):
   cur = int(input())
   maxv = max([maxv, cur - minv])
   minv = min([minv, cur])
 
print(maxv)

Buggy python submission (verdict: Runtime Error):
n = int(input())
 
maxv = -2000000000
 
 
minv = int(intput())
 
for i in range(1, n):
   cur = int(input())
   maxv = max([maxv, cur - minv])
   minv = min([minv, cur])
 
print(maxv)


Fixed submission:
n = int(input())
 
maxv = -2000000000
 
 
minv = int(input())
 
for i in range(1, n):
   cur = int(input())
   maxv = max([maxv, cur - minv])
   minv = min([minv, cur])
 
print(maxv)