Buggy python submission (verdict: Time Limit Exceeded):
# coding: UTF-8
n = int(raw_input())
value_list = []
for i in range(n):
    value_list.append(int(raw_input()))
    if i == 1:
        diff =value_list[1] - value_list[0]
    for j in range(i):
        diff2 = value_list[i] - value_list[j]
        if diff < diff2:
            diff = diff2
print diff




Fixed submission:
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = datas.index(now_max)
diff = now_max - datas[0]

for i in range(1,N-1):
    if i == max_index:
        now_max = max(datas[i+1:])
        max_index = datas.index(now_max,i+1)
    new_diff = now_max - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: UTF-8
n = int(raw_input())
value_list = []
diff_indx1 = 0
diff_indx2 = 0
for i in range(n):
    value_list.append(int(raw_input()))
    if i == 1:
        diff = value_list[1] - value_list[0]
        diff_indx1 = 1
    if value_list[i] >= value_list[diff_indx1]:
        for j in range(i):
            diff2 = value_list[i] - value_list[j]
            if diff <= diff2:
                diff = diff2
                diff_indx1 = i
                diff_indx2 = j
                #print("{}:{} - {} = {}").format(diff_indx1,value_list[i],value_list[j],diff)
    elif value_list[diff_indx2] > value_list[i]:
        diff_indx2 = i
        diff_indx1 = i
print diff


Fixed submission:
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = datas.index(now_max)
diff = now_max - datas[0]

for i in range(1,N-1):
    if i == max_index:
        now_max = max(datas[i+1:])
        max_index = datas.index(now_max,i+1)
    new_diff = now_max - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)

Buggy python submission (verdict: Runtime Error):
# coding: UTF-8
n = int(raw_input())
value_list = []
diff_indx1 = 0
diff_indx2 = 0
value_list.append(int(raw_input()))
if i == 1:
    diff = value_list[1] - value_list[0]
    diff_indx1 = 1
if value_list[i] >= value_list[diff_indx1]:
    for j in range(i):
        diff2 = value_list[i] - value_list[j]
        if diff <= diff2:
            diff = diff2
            diff_indx1 = i
            diff_indx2 = j
            #print("{}:{} - {} = {}").format(diff_indx1,value_list[i],value_list[j],diff)
elif value_list[diff_indx2] > value_list[i]:
    diff_indx2 = i
    diff_indx1 = i
print diff


Fixed submission:
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = datas.index(now_max)
diff = now_max - datas[0]

for i in range(1,N-1):
    if i == max_index:
        now_max = max(datas[i+1:])
        max_index = datas.index(now_max,i+1)
    new_diff = now_max - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)

Buggy python submission (verdict: Runtime Error):
# coding: UTF-8
n = int(raw_input())
value_list = []
diff_indx1 = 0
diff_indx2 = 0
diff = None　#変数の初期化
for i in range(n):
    value_list.append(int(raw_input()))
    if i == 1:# diffの初期化
        diff = value_list[1] - value_list[0]
        diff_indx1 = 1
    if value_list[i] >= value_list[diff_indx1]:#引かれる数の更新
        diff2 = value_list[i] - value_list[diff_indx2]
        if diff <= diff2:
            diff = diff2
            diff_indx2 = diff_indx1
            diff_indx1 = i
    if value_list[diff_indx2] > value_list[i]:#引く数の更新と引かれる数のリセット
        diff_indx2 = i
        diff_indx1 = i
print diff


Fixed submission:
from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = datas.index(now_max)
diff = now_max - datas[0]

for i in range(1,N-1):
    if i == max_index:
        now_max = max(datas[i+1:])
        max_index = datas.index(now_max,i+1)
    new_diff = now_max - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)