Buggy python submission (verdict: Runtime Error):
from collections import deque

def process_command(dll, commands):
    for cmd, num_str in commands:
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            temp = []
            result = dll.popleft()
            while result != int(num_str):
                temp.append(result)
                result = dll.popleft()
            dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    for i in range(num):
        commands.append([x for x in input().split(' ')])
    #commands.append(('insert', '5'))
    #commands.append(('insert', '2'))
    #commands.append(('insert', '3'))
    #commands.append(('insert', '1'))
    #commands.append(('delete', '3'))
    #commands.append(('insert', '6'))
    #commands.append(('delete', '5'))

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    dll.reverse()
    print('{0}'.format(' '.join(map(str, dll))))

Fixed submission:
from collections import deque

def process_command(dll, commands):
    # line_count = 1
    for cmd in commands:
        # print('processing line: {0}'.format(line_count))
        # line_count += 1
        # print(cmd)
        try:
            cmd, num_str = cmd.split()
        except ValueError:
            pass
        # if cmd.startswith('insert') or cmd.startswith('delete '):
        #     t = cmd.split(' ')
        #     cmd = t[0]
        #     num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            # deque.index() ????????¨??§???????????? python3.5??\???????????§???????????§??¢???
            if int(num_str) in dll:  # ?????????????????????????????¨???????????´?????????????????????????????????
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    commands = [input() for i in range(num)]

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    print('{0}'.format(' '.join(map(str, dll))))

Buggy python submission (verdict: Runtime Error):
from collections import deque

def process_command(dll, commands):
    for cmd in commands:
        # print(cmd)
        if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
        if cmd == 'insert':
            dll.append(int(num_str))
        elif cmd == 'delete':
            temp = []
            result = dll.pop()
            while result != int(num_str):
                temp.append(result)
                result = dll.pop()
            temp = temp[::-1]
            dll.extend(temp)
        elif cmd == 'deleteFirst':
            dll.pop()
        elif cmd == 'deleteLast':
            dll.popleft()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    for i in range(num):
        commands.append(input())
    #commands.append(('insert', '5'))
    #commands.append(('insert', '2'))
    #commands.append(('insert', '3'))
    #commands.append(('insert', '1'))
    #commands.append(('delete', '3'))
    #commands.append(('insert', '6'))
    #commands.append(('delete', '5'))

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    dll.reverse()
    print('{0}'.format(' '.join(map(str, dll))))

Fixed submission:
from collections import deque

def process_command(dll, commands):
    # line_count = 1
    for cmd in commands:
        # print('processing line: {0}'.format(line_count))
        # line_count += 1
        # print(cmd)
        try:
            cmd, num_str = cmd.split()
        except ValueError:
            pass
        # if cmd.startswith('insert') or cmd.startswith('delete '):
        #     t = cmd.split(' ')
        #     cmd = t[0]
        #     num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            # deque.index() ????????¨??§???????????? python3.5??\???????????§???????????§??¢???
            if int(num_str) in dll:  # ?????????????????????????????¨???????????´?????????????????????????????????
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    commands = [input() for i in range(num)]

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    print('{0}'.format(' '.join(map(str, dll))))

Buggy python submission (verdict: Runtime Error):
from collections import deque

def process_command(dll, commands):
    for cmd in commands:
        # print(cmd)
        if cmd.startswith('insert') or cmd.startswith('delete '):
            t = cmd.split(' ')
            cmd = t[0]
            num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            temp = []
            result = dll.popleft()
            while result != int(num_str):
                temp.append(result)
                result = dll.popleft()
            temp = temp[::-1]
            dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    for i in range(num):
        commands.append(input())

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    # dll.reverse()
    print('{0}'.format(' '.join(map(str, dll))))

Fixed submission:
from collections import deque

def process_command(dll, commands):
    # line_count = 1
    for cmd in commands:
        # print('processing line: {0}'.format(line_count))
        # line_count += 1
        # print(cmd)
        try:
            cmd, num_str = cmd.split()
        except ValueError:
            pass
        # if cmd.startswith('insert') or cmd.startswith('delete '):
        #     t = cmd.split(' ')
        #     cmd = t[0]
        #     num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            # deque.index() ????????¨??§???????????? python3.5??\???????????§???????????§??¢???
            if int(num_str) in dll:  # ?????????????????????????????¨???????????´?????????????????????????????????
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    commands = [input() for i in range(num)]

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    print('{0}'.format(' '.join(map(str, dll))))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import namedtuple


class DualLinkList(object):
    def __init__(self):
        self.nil = namedtuple('Node', ['key', 'prev', 'next'])
        self.nil.prev = self.nil
        self.nil.next = self.nil

    def insert(self, key):
        x = namedtuple('Node', ['key', 'prev', 'next'])
        x.key = key
        x.next = self.nil.next
        self.nil.next.prev = x
        self.nil.next = x
        x.prev = self.nil

    def listSearch(self, key):
        cur = self.nil.next
        while cur != None and cur.key != key:
            cur = cur.next
        return cur

    def deleteNode(self, t):
        if t == self.nil:
            return
        t.prev.next = t.next
        t.next.prev = t.prev
        del t

    def deleteFirst(self):
        self.deleteNode(self.nil.next)

    def deleteLast(self):
        self.deleteNode(self.nil.prev)

    def deleteKey(self, key):
        self.deleteNode(self.listSearch(key))

    def get_keys(self):
        results = []
        cur = self.nil.next
        while cur != self.nil:
            results.append(cur.key)
            cur = cur.next
        return results

    def print(self):
        cur = self.nil.next
        while cur != self.nil:
            print(cur.key)
            cur = cur.next


def process_instructions(dll, insts):
    for ins in insts:
        try:
            code, key = ins.split()
        except ValueError:
            code = ins
        if code == 'insert':
            dll.insert(int(key))
        elif code == 'delete':
            dll.deleteKey(int(key))
        elif code == 'deleteFirst':
            dll.deleteFirst()
        elif code == 'deleteLast':
            dll.deleteLast()
        else:
            raise ValueError
    return dll.get_keys()


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())
    data = [input() for x in range(num)]


    # ??????????????????
    dll = DualLinkList()
    results = process_instructions(dll, data)

    # ???????????¨???
    print('{0}'.format(' '.join(map(str, results))))

Fixed submission:
from collections import deque

def process_command(dll, commands):
    # line_count = 1
    for cmd in commands:
        # print('processing line: {0}'.format(line_count))
        # line_count += 1
        # print(cmd)
        try:
            cmd, num_str = cmd.split()
        except ValueError:
            pass
        # if cmd.startswith('insert') or cmd.startswith('delete '):
        #     t = cmd.split(' ')
        #     cmd = t[0]
        #     num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            # deque.index() ????????¨??§???????????? python3.5??\???????????§???????????§??¢???
            if int(num_str) in dll:  # ?????????????????????????????¨???????????´?????????????????????????????????
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    commands = [input() for i in range(num)]

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    print('{0}'.format(' '.join(map(str, dll))))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import namedtuple


class DualLinkList(object):
    def __init__(self):
        self.nil = namedtuple('Node', ['key', 'prev', 'next'])
        self.nil.prev = self.nil
        self.nil.next = self.nil

    def insert(self, key):
        x = namedtuple('Node', ['key', 'prev', 'next'])
        x.key = key
        x.next = self.nil.next
        self.nil.next.prev = x
        self.nil.next = x
        x.prev = self.nil

    def listSearch(self, key):
        cur = self.nil.next
        while cur != self.nil and cur.key != key:
            cur = cur.next
        return cur

    def deleteNode(self, t):
        if t == self.nil:
            return
        t.prev.next = t.next
        t.next.prev = t.prev
        del t

    def deleteFirst(self):
        self.deleteNode(self.nil.next)

    def deleteLast(self):
        self.deleteNode(self.nil.prev)

    def deleteKey(self, key):
        self.deleteNode(self.listSearch(key))

    def get_keys(self):
        results = []
        cur = self.nil.next
        while cur != self.nil:
            results.append(cur.key)
            cur = cur.next
        return results

    def print(self):
        cur = self.nil.next
        while cur != self.nil:
            print(cur.key)
            cur = cur.next


def process_instructions(dll, insts):
    for ins in insts:
        try:
            code, key = ins.split()
        except ValueError:
            code = ins
        if code == 'insert':
            dll.insert(int(key))
        elif code == 'delete':
            dll.deleteKey(int(key))
        elif code == 'deleteFirst':
            dll.deleteFirst()
        elif code == 'deleteLast':
            dll.deleteLast()
        else:
            raise ValueError
    return dll.get_keys()


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())
    data = [input() for x in range(num)]


    # ??????????????????
    dll = DualLinkList()
    results = process_instructions(dll, data)

    # ???????????¨???
    print('{0}'.format(' '.join(map(str, results))))

Fixed submission:
from collections import deque

def process_command(dll, commands):
    # line_count = 1
    for cmd in commands:
        # print('processing line: {0}'.format(line_count))
        # line_count += 1
        # print(cmd)
        try:
            cmd, num_str = cmd.split()
        except ValueError:
            pass
        # if cmd.startswith('insert') or cmd.startswith('delete '):
        #     t = cmd.split(' ')
        #     cmd = t[0]
        #     num_str = t[1]
        if cmd == 'insert':
            dll.appendleft(int(num_str))
        elif cmd == 'delete':
            # deque.index() ????????¨??§???????????? python3.5??\???????????§???????????§??¢???
            if int(num_str) in dll:  # ?????????????????????????????¨???????????´?????????????????????????????????
                temp = []
                result = dll.popleft()
                while result != int(num_str):
                    temp.append(result)
                    result = dll.popleft()
                temp = temp[::-1]
                dll.extendleft(temp)
        elif cmd == 'deleteFirst':
            dll.popleft()
        elif cmd == 'deleteLast':
            dll.pop()
        # print(dll)
        # print('=' * 64)


if __name__ == '__main__':
    # ??????????????\???
    commands = []
    num = int(input())
    commands = [input() for i in range(num)]

    # ??????
    dll = deque()
    process_command(dll, commands)

    # ???????????????
    print('{0}'.format(' '.join(map(str, dll))))