Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0 for i in range(22369621)]
for i in range(n):
    s = input().split(" ")
    num = 0
    p = 1
    for j in range(len(s[1])):
        if s[1][j] == "A":
            num += p * 1
        elif s[1][j] == "C":
            num += p * 2
        elif s[1][j] == "G":
            num += p * 3
        else:
            num += p * 4
        p *= 4
    if s[0] == "insert":
        a[num] = 1
    else:
        if a[num] == 1:
            print("yes")
        else:
            print("no")

Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    Cmd, Key = input().split(" ")
    if Cmd == "insert":
	    dic.add(Key)
    else:
        if Key in dic:
	        print("yes")
        else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
M = 1046527
a = [0 for i in range(M)]
for i in range(n):
    s = input().split(" ")
    num = 0
    p = 1
    for j in range(len(s[1])):
        if s[1][j] == "A":
            num += p * 1
        elif s[1][j] == "C":
            num += p * 2
        elif s[1][j] == "G":
            num += p * 3
        else:
            num += p * 4
        p *= 5
    h1 = num % M
    h2 = h1 + num % (M - 1)
    k = 0
    h = (h1 + k * h2) % M
    if s[0][0] == "i":
        while True:
            if a[h] == 0:
                a[h] = s[1]
                break
            elif a[h] == s[1]:
                break
            else:
                k += 1
    else:
        while True:
            if a[h] == s[1]:    
                print("yes")
                break
            elif a[h] == 0:
                print("no")
                break
            else:
                k += 1

Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    Cmd, Key = input().split(" ")
    if Cmd == "insert":
	    dic.add(Key)
    else:
        if Key in dic:
	        print("yes")
        else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0 for i in range(22369621)]
for i in range(n):
    s = input().split(" ")
    num = 0
    p = 1
    for j in range(len(s[1])):
        if s[1][j] == "A":
            num += p * 1
        elif s[1][j] == "C":
            num += p * 2
        elif s[1][j] == "G":
            num += p * 3
        else:
            num += p * 4
        p *= 4
    if s[0][0] == "i":
        a[num] = 1
    else:
        if a[num] == 1:
            print("yes")
        else:
            print("no")

Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    Cmd, Key = input().split(" ")
    if Cmd == "insert":
	    dic.add(Key)
    else:
        if Key in dic:
	        print("yes")
        else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
M = 1046527
a = [0 for i in range(M)]
for i in range(n):
    s = input().split(" ")
    num = 0
    p = 1
    for j in range(len(s[1])):
        if s[1][j] == "A":
            num += p * 1
        elif s[1][j] == "C":
            num += p * 2
        elif s[1][j] == "G":
            num += p * 3
        else:
            num += p * 4
        p *= 5
    h1 = num % M
    h2 = h1 + num % (M - 1)
    k = 0
    if s[0][0] == "i":
        while True:
            h = (h1 + k * h2) % M
            if a[h] == 0:
                a[h] = s[1]
                break
            elif a[h] == s[1]:
                break
            else:
                k += 1
    else:
        while True:
            h = (h1 + k * h2) % M
            if a[h] == s[1]:    
                print("yes")
                break
            elif a[h] == 0:
                print("no")
                break
            else:
                k += 1

Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    Cmd, Key = input().split(" ")
    if Cmd == "insert":
	    dic.add(Key)
    else:
        if Key in dic:
	        print("yes")
        else:
            print("no")

Buggy python submission (verdict: Runtime Error):
n = int(input())
dic = set()
for i in range(n):
    Cmd, Key = input().split()
    if Cmd == "insert":
	dic.add(Key)
    else:
        if Key in dic:
	    print("yes")
	else:
	    print("no")

Fixed submission:
n = int(input())
dic = set()
for i in range(n):
    Cmd, Key = input().split(" ")
    if Cmd == "insert":
	    dic.add(Key)
    else:
        if Key in dic:
	        print("yes")
        else:
            print("no")