Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    store = list()
    for i in range(int(input())):
        parts = input().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(0, int(parts[1]))
        elif cmd == 'delete':
            num = int(parts[1])
            store.remove(num)
        elif cmd == 'deleteFirst':
            store.remove(store[0])
        elif cmd =='deleteLast':
            store = store[:-1]
    print(' '.join(map(str, store)))


Fixed submission:
class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == '__main__':
    store = list()
    for i in range(int(input())):
        parts = input().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(0, int(parts[1]))
        elif cmd == 'delete':
            num = int(parts[1])
            if num in store:
                store.remove(num)
        elif cmd == 'deleteFirst':
            store.remove(store[0])
        elif cmd =='deleteLast':
            store = store[:-1]
    print(' '.join(map(str, store)))


Fixed submission:
class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == '__main__':
    store = list()
    for i in range(int(input())):
        parts = input().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(0, int(parts[1]))
        elif cmd == 'delete':
            num = int(parts[1])
            if num in store:
                store.remove(num)
        elif cmd == 'deleteFirst':
            store.remove(store[0])
        elif cmd =='deleteLast':
            store = store[:-1]

    if len(store) > 0:
        for n in store[:-1]:
            print(n, end=' ')
        print(store[-1])    


Fixed submission:
class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
class LinkedList(object):
    class Node(object):
        def __init__(self, value, next=None, prev=None):
            self.value = value
            self.next = next
            self.prev = prev

    def __init__(self, dtype):
        self.dtype = dtype
        self.dummy = LinkedList.Node(dtype())
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = LinkedList.Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next

        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteLast(self):
        node = self.dummy.prev
        if node != self.dummy:
            self.__remove_node(node)
    
    def deleteFirst(self):
        node = self.dummy.next
        if node != self.dummy:
            self.__remove_node(node)

    def __remove_node(self, node):
        node.prev.next = node.next
        node.next.prev = node.prev

    def items(self):
        node = self.dummy.next
        while node != self.dummy:
            yield node.value
            node = node.next

store = LinkedList(str)
for i in range(int(input())):
    parts = input().split()
    cmd = parts[0]
    if cmd == 'insert':
        store.insert(parts[1])
    elif cmd == 'delete':
        store.delete(parts[1])
    elif cmd == 'deleteFirst':
        store.deleteFirst()
    elif cmd =='deleteLast':
        store.deleteLast()

print(' '.join(store.items()))


Fixed submission:
class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):


class LinkedList(object):
    class Node(object):
        def __init__(self, value, next=None, prev=None):
            self.value = value
            self.next = next
            self.prev = prev

    def __init__(self, dtype):
        self.dtype = dtype
        self.dummy = LinkedList.Node(dtype())
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

        self.dict = dict()

    def insert(self, x):
        node = LinkedList.Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node

        self.dict[x] = node
    
    def delete(self, x):
        if x in self.dict:
            node = self.dict[x]
            self.__remove_node(node)
    
    def deleteLast(self):
        node = self.dummy.prev
        if node != self.dummy:
            self.__remove_node(node)
    
    def deleteFirst(self):
        node = self.dummy.next
        if node != self.dummy:
            self.__remove_node(node)

    def __remove_node(self, node):
        node.prev.next = node.next
        node.next.prev = node.prev
        self.dict.pop(node.value)

    def items(self):
        node = self.dummy.next
        while node != self.dummy:
            yield node.value
            node = node.next


store = LinkedList(str)
for i in range(int(input())):
    parts = input().split()
    cmd = parts[0]
    if cmd == 'insert':
        store.insert(parts[1])
    elif cmd == 'delete':
        store.delete(parts[1])
    elif cmd == 'deleteFirst':
        store.deleteFirst()
    elif cmd =='deleteLast':
        store.deleteLast()

print(' '.join(store.items()))


Fixed submission:
class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict, deque

class LinkedList(object):
    class Node(object):
        def __init__(self, value, next=None, prev=None):
            self.value = value
            self.next = next
            self.prev = prev

    def __init__(self, dtype):
        self.dtype = dtype
        self.dummy = LinkedList.Node(dtype())
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

        self.dict = defaultdict(deque)

    def insert(self, x):
        node = LinkedList.Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node

        self.dict[x].append(node)
    
    def delete(self, x):
        if x in self.dict:
            queue = self.dict[x]
            if len(queue) > 0:
                node = queue.pop()
                self.__remove_node(node)
    
    def deleteLast(self):
        node = self.dummy.prev
        if node != self.dummy:
            self.__remove_node(node)
            self.dict[node.value].popleft()
    
    def deleteFirst(self):
        node = self.dummy.next
        if node != self.dummy:
            self.__remove_node(node)
            self.dict[node.value].pop()

    def __remove_node(self, node):
        node.prev.next = node.next
        node.next.prev = node.prev

    def items(self):
        node = self.dummy.next
        while node != self.dummy:
            yield node.value
            node = node.next

store = LinkedList(str)
for i in range(int(input())):
    parts = input().split()
    cmd = parts[0]
    if cmd == 'insert':
        store.insert(parts[1])
    elif cmd == 'delete':
        store.delete(parts[1])
    elif cmd == 'deleteFirst':
        store.deleteFirst()
    elif cmd =='deleteLast':
        store.deleteLast()

print(' '.join(store.items()))


Fixed submission:
class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):

from collections import defaultdict, deque

class LinkedList(object):
    class Node(object):
        def __init__(self, value, next=None, prev=None):
            self.value = value
            self.next = next
            self.prev = prev

    def __init__(self, dtype):
        self.dtype = dtype
        self.dummy = LinkedList.Node(dtype())
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

        self.dict = defaultdict(deque)

    def insert(self, x):
        node = LinkedList.Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node

        self.dict[x].append(node)
    
    def delete(self, x):
        if x in self.dict:
            queue = self.dict[x]
            if len(queue) > 0:
                node = queue.pop()
                self.__remove_node(node)
    
    def deleteLast(self):
        node = self.dummy.prev
        if node != self.dummy:
            self.__remove_node(node)
            self.dict[node.value].popleft()
    
    def deleteFirst(self):
        node = self.dummy.next
        if node != self.dummy:
            self.__remove_node(node)
            self.dict[node.value].pop()

    def __remove_node(self, node):
        node.prev.next = node.next
        node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

store = LinkedList(str)
for i in range(int(input())):
    parts = input().split()
    cmd = parts[0]
    if cmd == 'insert':
        store.insert(parts[1])
    elif cmd == 'delete':
        store.delete(parts[1])
    elif cmd == 'deleteFirst':
        store.deleteFirst()
    elif cmd =='deleteLast':
        store.deleteLast()

print(' '.join(store.items()))


Fixed submission:
class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()