Buggy python submission (verdict: Time Limit Exceeded):
d_list = []

times = int(input())
for i in range(times):
    elm = input().split()
    if elm[0] == "insert":
        d_list.append(elm[1])
    elif elm[0] == "find":
        if elm[1] in d_list:
            print("yes")
        else:
            print("no")

Fixed submission:
n = int(input())

d = set()
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        d.add(com[1])
    else:
        print('yes' if com[1] in d else 'no')

Buggy python submission (verdict: Time Limit Exceeded):
d_list_a = []
d_list_c = []
d_list_g = []
d_list_t = []

times = int(input())
for i in range(times):
    elm = input().split()
    if elm[0] == "insert":
        if elm[1][0] == "A":
            d_list_a.append(elm[1])
        if elm[1][0] == "C":
            d_list_c.append(elm[1])
        if elm[1][0] == "G":
            d_list_g.append(elm[1])
        else:
            d_list_t.append(elm[1])
    elif elm[0] == "find":
        if elm[1][0] =="A":
            if elm[1] in d_list_a:
                print("yes")
            else:
                print("no")
        elif elm[1][0] =="C":
            if elm[1] in d_list_c:
                print("yes")
            else:
                print("no")
        elif elm[1][0] =="G":
            if elm[1] in d_list_g:
                print("yes")
            else:
                print("no")
        elif elm[1][0] =="T":
            if elm[1] in d_list_t:
                print("yes")
            else:
                print("no")

Fixed submission:
n = int(input())

d = set()
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        d.add(com[1])
    else:
        print('yes' if com[1] in d else 'no')

Buggy python submission (verdict: Time Limit Exceeded):
d_list = []

times = int(input())
for i in range(times):
    elm = input().split()
    code = elm[1].replace("A","1")
    code = code.replace("C","2")
    code = code.replace("G","3")
    code = code.replace("T","4")
    if elm[0] == "insert":
        d_list.append(code)
        d_list = sorted(d_list)

    elif elm[0] == "find":
        lower_bound = 0
        upper_bound = len(d_list)-1
        found = False

        while lower_bound <= upper_bound and not found:
            mid = (lower_bound + upper_bound)//2
            if d_list[mid] < code:
                lower_bound = mid + 1
            elif d_list[mid] > code:
                upper_bound = mid - 1
            else:
                found = True
        if found:
            print("yes")
        else:
            print("no")

Fixed submission:
n = int(input())

d = set()
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        d.add(com[1])
    else:
        print('yes' if com[1] in d else 'no')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

d = []
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        d.append(command[1])
    else:
        print('yes' if command[1] in d else 'no')

Fixed submission:
n = int(input())

d = set()
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        d.add(com[1])
    else:
        print('yes' if com[1] in d else 'no')

Buggy python submission (verdict: Runtime Error):
d_list = set()

times = int(input())
for i in range(times):
    elm = input().split()
    code = elm[1].replace("A","1")
    code = code.replace("C","2")
    code = code.replace("G","3")
    code = code.replace("T","4")
    if elm[0] == "insert":
        d_list.add(code)
        d_list = sorted(d_list)

    elif elm[0] == "find":
        lower_bound = 0
        upper_bound = len(d_list)-1
        found = False

        while lower_bound <= upper_bound and not found:
            mid = (lower_bound + upper_bound)//2
            if d_list[mid] < code:
                lower_bound = mid + 1
            elif d_list[mid] > code:
                upper_bound = mid - 1
            else:
                found = True
        if found:
            print("yes")
        else:
            print("no")

Fixed submission:
n = int(input())

d = set()
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        d.add(com[1])
    else:
        print('yes' if com[1] in d else 'no')