Buggy python submission (verdict: Time Limit Exceeded):
#coding: UTF-8
N=int(input())
p=[int(input()) for i in range(0,N)]
out=p[1]-p[0]
for i in range(0,N-1):
    buy=p[i]
    sell=p[i+1]
    for j in range(i+2,N):
        if p[j]>sell:
            sell=p[j]
    if sell-buy>out:
        out=sell-buy
print(out)

Fixed submission:
#coding: UTF-8
N=int(input())
p=[int(input()) for i in range(0,N)]
maxv=p[1]-p[0]
buy=p[0]
for i in range(1,N):
    if p[i]-buy>maxv:
        maxv=p[i]-buy
    if p[i]<buy:
        buy=p[i]
print(maxv)

Buggy python submission (verdict: Runtime Error):
raw_data = raw_input()

data = raw_data.split('\n')

n = data.pop(0)

max_v = 1000000000
min_v = -1000000000
for i, r in enumerate(data):
    max_v = max(max_v, r - min_v)
    min_v = min(min_v, r)

print(max_v) 

Fixed submission:
n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)

Buggy python submission (verdict: Runtime Error):
max_v = 1000000000
min_v = -1000000000

with open('in1.txt', 'r') as f:
    raw_data = f.readline()
    n = raw_data

    for r in f:
        max_v = max(max_v, r - min_v)
        min_v = min(min_v, r)
    
print(max_v)

Fixed submission:
n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)

Buggy python submission (verdict: Runtime Error):
max_v = 1000000000
min_v = -1000000000

n = input()
data = []
for i in range(N):
    data.append(input())

for r in data:
    max_v = max(max_v, r - min_v)                                               
    min_v = min(min_v, r)
    
print(max_v)

Fixed submission:
n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)

Buggy python submission (verdict: Runtime Error):
max_v = 1000000000
min_v = -1000000000

N = input()
data = []
for i in range(N):
    data.append(input())

for r in data:
    max_v = max(max_v, r - min_v)                                               
    min_v = min(min_v, r)
    
print(max_v)

Fixed submission:
n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)

Buggy python submission (verdict: Runtime Error):
max_v = 1000000000
min_v = -1000000000

N = input()
data = []
for i in range(N):
    data.append(input())

for r in data:
    max_v = max(max_v, r - min_v)                                               
    min_v = min(min_v, r)
    
print(N)

Fixed submission:
n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)

Buggy python submission (verdict: Runtime Error):
max_v = 1000000000
min_v = -1000000000

N = input()
data = []
for i in range(N):
    data.append(input())

for r in data:
    max_v = max(max_v, r - min_v)                                               
    min_v = min(min_v, r)
    
print(3)

Fixed submission:
n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)