Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??\????????????????????????????°?????????????????????????????£??????????????????????

insert str: ????????? str ??????????????????
find str: ????????? str ?????????????????´??? 'yes'??¨????????????????????´??? 'no'??¨???????????????

??????????????????????????????'A', 'C', 'G', 'T' ???????¨????????????????????§????????????????
1 ??? ?????????????????? ??? 12  n ??? 1,000,000

"""
import sys

# ????´??????¢?????¬????????????
NoVal = -1

# ????????¨????????????
Black = 0
Red = 1

class Node:
    """ ???????????? """

    def __init__(self, pnode, color, value):
        """ ????????????????????? """
        self.P = pnode # ????????????
        self.V = value # ???
        self.C = color # ???
        self.L = NoVal # ??????
        self.R = NoVal # ??????

def Find(r,value):
    """ ????????¨??¢?´¢ """
    if value == r.V:
#        print("Finded p:'{}' v:'{}'".format(r.V, value))
        return True
    if value < r.V: # ?°????????????§??????
        if isinstance(r.L, Node) == True:
#            print("Left Search p:'{}' v:'{}'".format(r.V, value))
            return Find(r.L, value)
    elif value > r.V: # ??§???????????§??????
        if isinstance(r.R, Node) == True:
#            print("Right Search p:'{}' v:'{}'".format(r.V, value))
            return Find(r.R, value)
#    print("Not Exists r:{} v:'{}'".format(r.V, value))
    return False

def Insert(r, value):
    """ ????????¨???????????? """
    if isinstance(r, Node) == False: # ???????????????
#        print("Root Insert '{}'".format(value))
        return Node(NoVal, Black, value) # ????´??????\

    if value == r.V: # ???????????????????????????????????§??????
#        print("Exists p:'{}' v:'{}'".format(r.V, value))
        return NoVal

    if value < r.V: # ?°???????
        if isinstance(r.L, Node) == False: # ??????????????????
            r.L = Node(r, Red, value) # ??????????´??????\
#            print("Left Insert '{}'".format(value))
            return r.L
        else:
#            print("Next Left p'{}' v'{}'".format(r.V, value))
            Insert(r.L, value) # ?????????
    elif value > r.V: # ??§??????
        if isinstance(r.R, Node) == False: # ??????????????????
#            print("Right Insert '{}'".format(value))
            r.R = Node(r, Red, value) # ??????????´??????\
            return r.R
        else:
#            print("Next Right p:'{}' v:'{}'".format(r.V, value))
            Insert(r.R, value) # ?????????

def RotateR(a):
    """ ????????¨???????????¢ a:????????? ?????????:??°????????? """
    b = a.L     # a ???????????? b ??¨??????
    b.P = a.P   # b ????????? a ???????????????
    a.P = b     # a ????????? b ?????????
    a.L = b.R   # a ???????????? b ??????????????????
    a.L.P = a   # a ?????????????????? a ?????????
    b.R = a     # b ???????????? a ?????????
    if b.P != NoVal: # b ??????????´????????????????
       if b.P.L == a: # b ?????????????????? a ??????
            b.P.L = b    # b ?????????????????? b ?????????
       elif b.P.R == a: # b ?????????????????? a ??????
            b.P.R = b    # b ?????????????????? b ?????????
    return b

def RotateL(a):
    """ ????????¨???????????¢ r:????????? """
    b = a.R     # a ???????????? b ??¨??????
    b.P = a.P   # b ????????? a ???????????????
    a.P = b     # a ????????? b ?????????
    a.R = b.L   # a ???????????? b ??????????????????
    a.R.P = a   # a ?????????????????? a ?????????
    b.L = a     # b ???????????? a ?????????
    if b.P != NoVal: # b ??????????´????????????????
       if b.P.L == a: # b ?????????????????? a ??????
            b.P.L = b    # b ?????????????????? b ?????????
       elif b.P.R == a: # b ?????????????????? a ??????
            b.P.R = b    # b ?????????????????? b ?????????
    return b

def Restruct(r):
    """ ????§???? """
    
    if isinstance(r, Node) == False: # ?????§??????
        return
    
    if r.C == Black: # ???????????????????????????????????????
        return

    p = r.P
    if p == NoVal: # ???????????????
        r.C = Black # ???????????????????????????
        return

    if p.C == Red: # ????????????
        if p.P.L == p: # ????????????
            if p.L == r: # ???????????????
                p = RotateR(p) # LL:????????¢
            else: # ???????????????
                RotateL(r) # LR: 1.????????¢
                p = RotateR(p) # LR: 2.????????¢
        else: # ????????????
            if r.P.L == r: # ???????????????
                RotateR(r) # RL: 1.????????¢
                p = RotateL(p) # RL: 2.????????¢
            else: # ???????????????
                p = RotateL(p) ## LR: ????????¢
        if p.C == Red: # ??°???????????????????????°???????????????????§????
            Restruct(p)

def main():
    """ ????????? """
    num = int(input().strip())
    istr = sys.stdin.read()
    cmds = list(istr.splitlines())
    root = NoVal
    
    for i in cmds:
        if i[0] == "i":
            r = Insert(root, i[7:])
            if isinstance(root, Node) == False:
                root = r
        elif i[0] == "f":
            ret = Find(root, i[5:])
            if ret == True:
                print("yes")
            else:
                print("no")

if __name__ == '__main__':
    main()

Fixed submission:
import sys

def main():
    """ MAIN """
    num = int(input().strip())
    istr = sys.stdin.read()
    cmds = list(istr.splitlines())

    D = {}
    for i in cmds:
        if i[0] == "i":
            D[i[7:]] = 1
        elif i[0] == "f":
            if i[5:] in D:
                print("yes")
            else:
                print("no")

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??\????????????????????????????°?????????????????????????????£??????????????????????

insert str: ????????? str ??????????????????
find str: ????????? str ?????????????????´??? 'yes'??¨????????????????????´??? 'no'??¨???????????????

??????????????????????????????'A', 'C', 'G', 'T' ???????¨????????????????????§????????????????
1 ??? ?????????????????? ??? 12  n ??? 1,000,000

"""
import sys

# ????´??????¢?????¬????????????
NoVal = -1

# ????????¨????????????
Black = 0
Red = 1

class Node:
    """ ???????????? """

    def __init__(self, pnode, color, value):
        """ ????????????????????? """
        self.P = pnode # ????????????
        self.V = value # ???
        self.C = color # ???
        self.L = NoVal # ??????
        self.R = NoVal # ??????

def Find(r,value):
    """ ????????¨??¢?´¢ """
    
    if isinstance(r, Node) == False:
        return False
    if value == r.V:
#        print("Finded p:'{}' v:'{}'".format(r.V, value))
        return True
    if value < r.V: # ?°????????????§??????
        if isinstance(r.L, Node) == True:
#            print("Left Search p:'{}' v:'{}'".format(r.V, value))
            return Find(r.L, value)
    elif value > r.V: # ??§???????????§??????
        if isinstance(r.R, Node) == True:
#            print("Right Search p:'{}' v:'{}'".format(r.V, value))
            return Find(r.R, value)
#    print("Not Exists r:{} v:'{}'".format(r.V, value))
    return False

def Insert(r, value):
    """ ????????¨???????????? """
    if isinstance(r, Node) == False: # ???????????????
#        print("Root Insert '{}'".format(value))
        return Node(NoVal, Black, value) # ????´??????\

    if value == r.V: # ???????????????????????????????????§??????
#        print("Exists p:'{}' v:'{}'".format(r.V, value))
        return NoVal

    if value < r.V: # ?°???????
        if isinstance(r.L, Node) == False: # ??????????????????
            r.L = Node(r, Red, value) # ??????????´??????\
#            print("Left Insert '{}'".format(value))
            return r.L
        else:
#            print("Next Left p'{}' v'{}'".format(r.V, value))
            Insert(r.L, value) # ?????????
    elif value > r.V: # ??§??????
        if isinstance(r.R, Node) == False: # ??????????????????
#            print("Right Insert '{}'".format(value))
            r.R = Node(r, Red, value) # ??????????´??????\
            return r.R
        else:
#            print("Next Right p:'{}' v:'{}'".format(r.V, value))
            Insert(r.R, value) # ?????????

def RotateR(a):
    """ ????????¨???????????¢ a:????????? ?????????:??°????????? """
    b = a.L     # a ???????????? b ??¨??????
    b.P = a.P   # b ????????? a ???????????????
    a.P = b     # a ????????? b ?????????
    a.L = b.R   # a ???????????? b ??????????????????
    a.L.P = a   # a ?????????????????? a ?????????
    b.R = a     # b ???????????? a ?????????
    if b.P != NoVal: # b ??????????´????????????????
       if b.P.L == a: # b ?????????????????? a ??????
            b.P.L = b    # b ?????????????????? b ?????????
       elif b.P.R == a: # b ?????????????????? a ??????
            b.P.R = b    # b ?????????????????? b ?????????
    return b

def RotateL(a):
    """ ????????¨???????????¢ r:????????? """
    b = a.R     # a ???????????? b ??¨??????
    b.P = a.P   # b ????????? a ???????????????
    a.P = b     # a ????????? b ?????????
    a.R = b.L   # a ???????????? b ??????????????????
    a.R.P = a   # a ?????????????????? a ?????????
    b.L = a     # b ???????????? a ?????????
    if b.P != NoVal: # b ??????????´????????????????
       if b.P.L == a: # b ?????????????????? a ??????
            b.P.L = b    # b ?????????????????? b ?????????
       elif b.P.R == a: # b ?????????????????? a ??????
            b.P.R = b    # b ?????????????????? b ?????????
    return b

def Restruct(r):
    """ ????§???? """
    
    if isinstance(r, Node) == False: # ?????§??????
        return
    
    if r.C == Black: # ???????????????????????????????????????
        return

    p = r.P
    if p == NoVal: # ???????????????
        r.C = Black # ???????????????????????????
        return

    if p.C == Red: # ????????????
        if p.P.L == p: # ????????????
            if p.L == r: # ???????????????
                p = RotateR(p) # LL:????????¢
            else: # ???????????????
                RotateL(r) # LR: 1.????????¢
                p = RotateR(p) # LR: 2.????????¢
        else: # ????????????
            if r.P.L == r: # ???????????????
                RotateR(r) # RL: 1.????????¢
                p = RotateL(p) # RL: 2.????????¢
            else: # ???????????????
                p = RotateL(p) ## LR: ????????¢
        if p.C == Red: # ??°???????????????????????°???????????????????§????
            Restruct(p)

def main():
    """ ????????? """
    num = int(input().strip())
    istr = sys.stdin.read()
    cmds = list(istr.splitlines())
    root = NoVal
    
    for i in cmds:
        if i[0] == "i":
            r = Insert(root, i[7:])
            if isinstance(root, Node) == False:
                root = r
        elif i[0] == "f":
            ret = Find(root, i[5:])
            if ret == True:
                print("yes")
            else:
                print("no")

if __name__ == '__main__':
    main()

Fixed submission:
import sys

def main():
    """ MAIN """
    num = int(input().strip())
    istr = sys.stdin.read()
    cmds = list(istr.splitlines())

    D = {}
    for i in cmds:
        if i[0] == "i":
            D[i[7:]] = 1
        elif i[0] == "f":
            if i[5:] in D:
                print("yes")
            else:
                print("no")

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??\????????????????????????????°?????????????????????????????£??????????????????????

insert str: ????????? str ??????????????????
find str: ????????? str ?????????????????´??? 'yes'??¨????????????????????´??? 'no'??¨???????????????

??????????????????????????????'A', 'C', 'G', 'T' ???????¨????????????????????§????????????????
1 ??? ?????????????????? ??? 12  n ??? 1,000,000

"""
import sys
import random

class Node:
    """ Treap???????´?????????? """

    def __init__(self, value, usen):
        """ ????????????????????? """
        self.V = value # ???
        self.U = usen # ?????????
        self.L = None # ??????
        self.R = None # ??????

def Find(t, value):
    """ ????????¨??¢?´¢ """
    
    if t is not None:
        if value == t.V: # ?????????
#            print("Finded p:'{}' v:'{}'".format(t.V, value))
            return True

        elif value < t.V: # ?°????????????§??????
#            print("Left Search p:'{}' v:'{}'".format(t.V, value))
            return Find(t.L, value)

        elif value > t.V: # ??§???????????§??????
#            print("Right Search p:'{}' v:'{}'".format(t.V, value))
            return Find(t.R, value)

#    print("Not Exists v:'{}'".format(value))
    return False

def Insert(t, value):
    """ ????????¨???????????? """

    if t is None: # ???????????????
        t = Node(value, random.random())
#        print("\tInsert '{}'".format(value))
        return t # ????´??????\

    if value < t.V: # ?°???????
#        print("\tto Left p:'{}' v:'{}'".format(t.V, value))
        t.L = Insert(t.L, value) # ??????????´??????\
        if t.U > t.L.U:
            return RotateR(t)

    elif value > t.V: # ??§??????
#        print("\tto Right p:'{}' v:'{}'".format(t.V, value))
        t.R = Insert(t.R, value) # ?????????
        if t.U > t.R.U:
            return RotateL(t)

#    elif value == t.V: # ???????????????????????????????????§??????
#        print("\tExists p:'{}' v:'{}'".format(t.V, value))

    return t

def RotateR(a):
    """ ????????¨???????????¢ a:??? b:??°????????? """
    if a.L is None: # ??????????????????
        return a
    b = a.L     # b ??? a ?????????
    a.L = b.R   # a ???????????? b ??????????????????
    b.R = a     # b ???????????? a ?????????
#    print("\t\tRotateR a:{} b:{} b.R.V:{}".format(a.V, b.V, b.R.V))
    return b

def RotateL(a):
    """ ????????¨???????????¢ a:??? b:??°????????? """

    if a.R is None: # ??????????????????
        return a
    b = a.R     # b ??? a ?????????
    a.R = b.L   # a ???????????? b ??????????????????
    b.L = a     # b ???????????? a ?????????
#    print("\t\tRotateL a:{} b:{} b.L.V:{}".format(a.V, b.V, b.L.V))
    return b

def GetList(t, a):
    if t is not None:
        a.append(t.V)
        GetList(t.L, a)
        GetList(t.R, a)

def main():
    """ ????????? """
    random.seed() # ??±??°?????????
    num = int(input().strip())
    istr = sys.stdin.read()
    cmds = list(istr.splitlines())
    root = None
    
    for i in cmds:
#        print("cmd:{} tree:{}".format(i,root))
        if i[0] == "i":
            root = Insert(root, i[7:])
        elif i[0] == "f":
            ret = Find(root, i[5:])
            if ret == True:
                print("yes")
            else:
                print("no")
#        a = []
#        GetList(root,a)
#        print(a)

if __name__ == '__main__':
    main()

Fixed submission:
import sys

def main():
    """ MAIN """
    num = int(input().strip())
    istr = sys.stdin.read()
    cmds = list(istr.splitlines())

    D = {}
    for i in cmds:
        if i[0] == "i":
            D[i[7:]] = 1
        elif i[0] == "f":
            if i[5:] in D:
                print("yes")
            else:
                print("no")

if __name__ == '__main__':
    main()