Buggy python submission (verdict: Time Limit Exceeded):
# import pdb
n = int(raw_input())

list = []
for x in xrange(n):
  list.append(int(raw_input()))

max = -10000000000000
for x in xrange(0, n - 1):
  for y in xrange(x + 1, n):
    # pdb.set_trace()
    temp = list[y] - list[x]
    if temp > max:
      max = temp

print max

Fixed submission:
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]

minv = num_list[0]
maxv = -1000000000

for i in xrange(1, n):
  tmp = num_list[i] - minv
  maxv = tmp if tmp > maxv else maxv
  minv = num_list[i] if minv > num_list[i] else minv
  # print "i = %d, tmp = %d, maxv = %d, minv = %d" % (i, tmp, maxv, minv)

print maxv

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
num_list = []
for i in xrange(n):
  num_list.append(int(raw_input()))
#print num_list

max = 1 - pow(10, 9)

for i in range(n - 1):
  for j in range(i + 1, n):
    tmp = num_list[j] - num_list[i]
#    print "i = %d, j = %d, tmp = %d" % (i, j, tmp)
    if tmp > max:
      max = tmp

print max

Fixed submission:
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]

minv = num_list[0]
maxv = -1000000000

for i in xrange(1, n):
  tmp = num_list[i] - minv
  maxv = tmp if tmp > maxv else maxv
  minv = num_list[i] if minv > num_list[i] else minv
  # print "i = %d, tmp = %d, maxv = %d, minv = %d" % (i, tmp, maxv, minv)

print maxv

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]
#print num_list

ans = 1 - pow(10, 9)

for i in range(n - 1):
  max_num = max(num_list[i+1:])
  tmp = max_num - num_list[i]
  if tmp > ans:
    ans = tmp

print ans

Fixed submission:
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]

minv = num_list[0]
maxv = -1000000000

for i in xrange(1, n):
  tmp = num_list[i] - minv
  maxv = tmp if tmp > maxv else maxv
  minv = num_list[i] if minv > num_list[i] else minv
  # print "i = %d, tmp = %d, maxv = %d, minv = %d" % (i, tmp, maxv, minv)

print maxv

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]
#print num_list

ans = 1 - pow(10, 9)
chk = num_list[0]

for i in range(1, n):
  if num_list[i] >= chk:
    continue
  max_num = max(num_list[i+1:])
  tmp = max_num - num_list[i]
  if tmp > ans:
    ans = tmp

print ans

Fixed submission:
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]

minv = num_list[0]
maxv = -1000000000

for i in xrange(1, n):
  tmp = num_list[i] - minv
  maxv = tmp if tmp > maxv else maxv
  minv = num_list[i] if minv > num_list[i] else minv
  # print "i = %d, tmp = %d, maxv = %d, minv = %d" % (i, tmp, maxv, minv)

print maxv

Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]
#print num_list

ans = max(num_list[1:]) - num_list[0]
chk = num_list[0]
# print "ans=%d, chk=%d" % (ans, chk)

for i in range(1, n - 1):
  if num_list[i] >= chk:
    continue
  max_num = max(num_list[i+1:])
  # print max_num
  tmp = max_num - num_list[i]
  if tmp > ans:
    ans = tmp
  # print "i = %d, tmp = %d, ans = %d" % (i, tmp, ans)

print ans

Fixed submission:
n = int(raw_input())
num_list = [int(raw_input()) for i in xrange(n)]

minv = num_list[0]
maxv = -1000000000

for i in xrange(1, n):
  tmp = num_list[i] - minv
  maxv = tmp if tmp > maxv else maxv
  minv = num_list[i] if minv > num_list[i] else minv
  # print "i = %d, tmp = %d, maxv = %d, minv = %d" % (i, tmp, maxv, minv)

print maxv