Buggy python submission (verdict: Runtime Error):
A = []
n = input()

for i in range(n):
    command = [0, 0]
    temp = raw_input().split()
    command[0] = temp[0]
    command[1] = int(temp[1])

    if command[0] == "insert":
        A.insert(0, command[1])
    elif command[0] == "delete":
        A.remove(command[1])
    elif command[0] == "deleteFirst":
        A.pop(0)
    elif command[0] == "deleteLast":
        A.pop()

print A

Fixed submission:
A=[]
fp =0
bp =0
n=int(raw_input())
while n: 
    cmd = raw_input()
    if cmd[0] == 'i':
        A.append(int(cmd[7:]))
        fp += 1
    elif cmd[6] == ' ':
        try:
            i = A[::-1].index(int(cmd[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif cmd[6] == 'F':
        A.pop()
        fp -=1
    elif cmd[6] == 'L':
        bp +=1
    n -=1
 
for k in A[bp:fp+1][::-1]:
    print int(k),

Buggy python submission (verdict: Runtime Error):
A = []
n = input()

for i in range(n):
    command = [0, 0]
    temp = raw_input().split()
    command[0] = temp[0]
    command[1] = int(temp[1])

    if command[0] == "insert":
        A.insert(0, command[1])
    elif command[0] == "delete":
        A.remove(command[1])
    elif command[0] == "deleteFirst":
        A.pop(0)
    elif command[0] == "deleteLast":
        A.pop()

for i in range(len(A)):
    print A[i],

Fixed submission:
A=[]
fp =0
bp =0
n=int(raw_input())
while n: 
    cmd = raw_input()
    if cmd[0] == 'i':
        A.append(int(cmd[7:]))
        fp += 1
    elif cmd[6] == ' ':
        try:
            i = A[::-1].index(int(cmd[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif cmd[6] == 'F':
        A.pop()
        fp -=1
    elif cmd[6] == 'L':
        bp +=1
    n -=1
 
for k in A[bp:fp+1][::-1]:
    print int(k),

Buggy python submission (verdict: Runtime Error):
A = []
n = input()

for i in range(n):
    command = [0, 0]
    temp = raw_input().split()
    command[0] = temp[0]
    command[1] = int(temp[1])

    if command[0] == 'insert':
        A.insert(0, command[1])
    elif command[0] == 'delete':
        A.remove(command[1])
    elif command[0] == 'deleteFirst':
        A.pop(0)
    elif command[0] == 'deleteLast':
        A.pop()

for i in range(len(A)):
    print A[i],

Fixed submission:
A=[]
fp =0
bp =0
n=int(raw_input())
while n: 
    cmd = raw_input()
    if cmd[0] == 'i':
        A.append(int(cmd[7:]))
        fp += 1
    elif cmd[6] == ' ':
        try:
            i = A[::-1].index(int(cmd[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif cmd[6] == 'F':
        A.pop()
        fp -=1
    elif cmd[6] == 'L':
        bp +=1
    n -=1
 
for k in A[bp:fp+1][::-1]:
    print int(k),

Buggy python submission (verdict: Runtime Error):
A = []
n = input()

for i in range(n):
    command = raw_input().split()

    if command[0] == 'insert':
        A.insert(0, command[1])
    elif command[0] == 'delete':
        A.remove(command[1])
    elif command[0] == 'deleteFirst':
        A.pop(0)
    elif command[0] == 'deleteLast':
        A.pop()

for i in range(len(A)):
    print A[i],

Fixed submission:
A=[]
fp =0
bp =0
n=int(raw_input())
while n: 
    cmd = raw_input()
    if cmd[0] == 'i':
        A.append(int(cmd[7:]))
        fp += 1
    elif cmd[6] == ' ':
        try:
            i = A[::-1].index(int(cmd[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif cmd[6] == 'F':
        A.pop()
        fp -=1
    elif cmd[6] == 'L':
        bp +=1
    n -=1
 
for k in A[bp:fp+1][::-1]:
    print int(k),

Buggy python submission (verdict: Time Limit Exceeded):
A = []
n = input()

for i in range(n):
    command = raw_input().split()

    if command[0] == 'insert':
        A.insert(0, command[1])
    elif command[0] == 'delete':
        if A.count(command[1]) != 0:
            A.remove(command[1])
    elif command[0] == 'deleteFirst':
        A.pop(0)
    elif command[0] == 'deleteLast':
        A.pop()

for i in range(len(A)):
    print A[i],

Fixed submission:
A=[]
fp =0
bp =0
n=int(raw_input())
while n: 
    cmd = raw_input()
    if cmd[0] == 'i':
        A.append(int(cmd[7:]))
        fp += 1
    elif cmd[6] == ' ':
        try:
            i = A[::-1].index(int(cmd[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif cmd[6] == 'F':
        A.pop()
        fp -=1
    elif cmd[6] == 'L':
        bp +=1
    n -=1
 
for k in A[bp:fp+1][::-1]:
    print int(k),

Buggy python submission (verdict: Time Limit Exceeded):
A = []
n = input()

for i in range(n):
    command = raw_input().split()

    if command[0] == 'insert':
        A.insert(0, command[1])
    elif command[0] == 'delete':
        if A.count(command[1]) != 0:
            A.remove(command[1])
    elif command[0] == 'deleteFirst':
        A.pop(0)
    elif command[0] == 'deleteLast':
        A.pop()

for i in range(len(A)):
    print A[i],

Fixed submission:
A=[]
fp =0
bp =0
n=int(raw_input())
while n: 
    cmd = raw_input()
    if cmd[0] == 'i':
        A.append(int(cmd[7:]))
        fp += 1
    elif cmd[6] == ' ':
        try:
            i = A[::-1].index(int(cmd[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif cmd[6] == 'F':
        A.pop()
        fp -=1
    elif cmd[6] == 'L':
        bp +=1
    n -=1
 
for k in A[bp:fp+1][::-1]:
    print int(k),