Buggy python submission (verdict: Time Limit Exceeded):
def hash1(m,key):
    return key % m

def hash2(m,key):
    return 1 +  key % ( m -1 )

def hash(m,key,i):
    return (hash1(m,key) + i * hash2(m,key) ) % m

def insert(T,key):
    i = 0
    l = len(T)
    while True:
        h = hash(l,key,i)
        if (T[h] is None ):
            T[h] = key
            return h
        else:
            i += 1

def search(T,key):
    l = len(T)
    i = 0
    while True:
        h = hash(l,key,i)
        if(T[h] == key):
            return h
        elif(T[h] is None or h >= l):
            return -1
        else:
            i += 1

def find(T,key):
    a = search(T,key)
    if(a == -1):
        print('no')
    else:
        print('yes')

dict = {'A' : '1', 'C' : '2', 'G' : '3', 'T' : '4'}
data = []
T = [None]*4444
n = int(input())


while n > 0:
    st = input()
    d = list(st.split())

### convert key to num(1~4)
    tmp_key = ''
    for x in list(d[1]):
        tmp_key += dict[x]

    data.append([d[0],int(tmp_key)])
    n -= 1
for com in data:
    if(com[0] == 'insert'):
        insert(T,com[1]) 
    else:
        find(T,com[1])

Fixed submission:
def hash1(m, key):
    return key % m

def hash2(m, key):
    return 1 +  key % (m - 1)

def hash(m, key, i):
    return (hash1(m, key) + i * hash2(m, key) ) % m

def insert(T, key):
    i = 0
    l = len(T)
    while True:
        h = hash(1046527,key,i)
        if (T[h] == None ):
            T[h] = key
            return h
        elif (T[h] == key):
            return h
        else:
            i += 1

def search(T,key):
    l = len(T)
    i = 0
    while True:
        h = hash(1046527,key,i)
        if(T[h] == key):
            return h
        elif(T[h] is None or h >= l):
            return -1
        else:
            i += 1

def find(T, key):
    a = search(T,key)
    if(a == -1):
        print('no')
    else:
        print('yes')

dict = {'A' : '1', 'C' : '2', 'G' : '3', 'T' : '4'}
data = []
T = [None]*1046527
n = int(input())


while n > 0:
    st = input()
    d = list(st.split())

### convert key to num(1~4)
    tmp_key = ''
    for x in list(d[1]):
        tmp_key += dict[x]

    data.append([d[0],int(tmp_key)])
    n -= 1
for com in data:
    if(com[0] == 'insert'):
        insert(T,com[1]) 
    else:
        find(T,com[1])

Buggy python submission (verdict: Time Limit Exceeded):
def hash1(m,key):
    return key % m

def hash2(m,key):
    return 1 +  key % ( m -1 )

def hash(m,key,i):
    return (hash1(m,key) + i * hash2(m,key) ) % m

def insert(T,key):
    i = 0
    l = len(T)
    while True:
        h = hash(1046527,key,i)
        if (T[h] == None ):
            T[h] = key
            return h
        else:
            i += 1

def search(T,key):
    l = len(T)
    i = 0
    while True:
        h = hash(1046527,key,i)
        if(T[h] == key):
            return h
        elif(T[h] is None or h >= l):
            return -1
        else:
            i += 1

def find(T,key):
    a = search(T,key)
    if(a == -1):
        print('no')
    else:
        print('yes')

dict = {'A' : '1', 'C' : '2', 'G' : '3', 'T' : '4'}
data = []
T = [None]*1046527
n = int(input())


while n > 0:
    st = input()
    d = list(st.split())

### convert key to num(1~4)
    tmp_key = ''
    for x in list(d[1]):
        tmp_key += dict[x]

    data.append([d[0],int(tmp_key)])
    n -= 1
for com in data:
    if(com[0] == 'insert'):
        insert(T,com[1]) 
    else:
        find(T,com[1])

Fixed submission:
def hash1(m, key):
    return key % m

def hash2(m, key):
    return 1 +  key % (m - 1)

def hash(m, key, i):
    return (hash1(m, key) + i * hash2(m, key) ) % m

def insert(T, key):
    i = 0
    l = len(T)
    while True:
        h = hash(1046527,key,i)
        if (T[h] == None ):
            T[h] = key
            return h
        elif (T[h] == key):
            return h
        else:
            i += 1

def search(T,key):
    l = len(T)
    i = 0
    while True:
        h = hash(1046527,key,i)
        if(T[h] == key):
            return h
        elif(T[h] is None or h >= l):
            return -1
        else:
            i += 1

def find(T, key):
    a = search(T,key)
    if(a == -1):
        print('no')
    else:
        print('yes')

dict = {'A' : '1', 'C' : '2', 'G' : '3', 'T' : '4'}
data = []
T = [None]*1046527
n = int(input())


while n > 0:
    st = input()
    d = list(st.split())

### convert key to num(1~4)
    tmp_key = ''
    for x in list(d[1]):
        tmp_key += dict[x]

    data.append([d[0],int(tmp_key)])
    n -= 1
for com in data:
    if(com[0] == 'insert'):
        insert(T,com[1]) 
    else:
        find(T,com[1])

Buggy python submission (verdict: Time Limit Exceeded):
# const
M = 1046527

def h1(key):
    return key % M

def h2(key):
    return 1 + (key % (M-1))

def hash(key ,i):
    return (h1(key) + i*h2(key)) % M

def conv_str_to_num(str):
    converted = 0
    s_list = list(str)
    for (i,c) in enumerate(s_list):
        if c == 'A':
            n = 1
        elif c == 'C':
            n = 2
        elif c == 'G':
            n = 3
        elif c == 'T':
            n = 4
        else:
            n = 0

        converted += 5**i * n

    return converted



class hashTable(object):
    def __init__(self, arg):
        self.T = ["" for _ in range(arg)]

    def insert(self, s):
        key = conv_str_to_num(s)
        i = 0
        while True:
            h = hash(key, i)
            if self.T[h] == "":
                self.T[h] = s
                break
            i += 1

    def find(self, s):
        key = conv_str_to_num(s)
        i = 0
        while True:
            h = hash(key, i)
            if self.T[h] == s:
                return 1
            elif self.T[h] == "":
                return 0

            i += 1
        return 0


if __name__ == '__main__':
    h_t = hashTable(M)
    ans = []
    n = int(input())
    for _ in range(n):
        op, s = input().split()
        if op == "insert":
            h_t.insert(s)
        else:
            tmp = h_t.find(s)
            if tmp == 1:
                ans.append("yes")
            else:
                ans.append("no")

    for s in ans:
        print(s)

Fixed submission:
def hash1(m, key):
    return key % m

def hash2(m, key):
    return 1 +  key % (m - 1)

def hash(m, key, i):
    return (hash1(m, key) + i * hash2(m, key) ) % m

def insert(T, key):
    i = 0
    l = len(T)
    while True:
        h = hash(1046527,key,i)
        if (T[h] == None ):
            T[h] = key
            return h
        elif (T[h] == key):
            return h
        else:
            i += 1

def search(T,key):
    l = len(T)
    i = 0
    while True:
        h = hash(1046527,key,i)
        if(T[h] == key):
            return h
        elif(T[h] is None or h >= l):
            return -1
        else:
            i += 1

def find(T, key):
    a = search(T,key)
    if(a == -1):
        print('no')
    else:
        print('yes')

dict = {'A' : '1', 'C' : '2', 'G' : '3', 'T' : '4'}
data = []
T = [None]*1046527
n = int(input())


while n > 0:
    st = input()
    d = list(st.split())

### convert key to num(1~4)
    tmp_key = ''
    for x in list(d[1]):
        tmp_key += dict[x]

    data.append([d[0],int(tmp_key)])
    n -= 1
for com in data:
    if(com[0] == 'insert'):
        insert(T,com[1]) 
    else:
        find(T,com[1])

Buggy python submission (verdict: Time Limit Exceeded):
# const
M = 1046527

def h1(key):
    return key % M

def h2(key):
    return 1 + (key % (M-1))

def hash(key ,i):
    return (h1(key) + i*h2(key)) % M

def conv_str_to_num(str):
    converted = 0
    s_list = list(str)
    for (i,c) in enumerate(s_list):
        if c == 'A':
            n = 1
        elif c == 'C':
            n = 2
        elif c == 'G':
            n = 3
        elif c == 'T':
            n = 4
        else:
            n = 0

        converted += 5**i * n

    return converted



class hashTable(object):
    def __init__(self, arg):
        self.T = [""] * arg

    def insert(self, s):
        key = conv_str_to_num(s)
        i = 0
        while True:
            h = hash(key, i)
            if self.T[h] == "":
                self.T[h] = s
                break
            i += 1

    def find(self, s):
        key = conv_str_to_num(s)
        i = 0
        while True:
            h = hash(key, i)
            if self.T[h] == s:
                return 1
            elif self.T[h] == "":
                return 0

            i += 1
        return 0


if __name__ == '__main__':
    h_t = hashTable(M)
    n = int(input())
    for _ in range(n):
        op, s = input().split()
        if op == "insert":
            h_t.insert(s)
        else:
            tmp = h_t.find(s)
            if tmp == 1:
                print("yes")
            else:
                print("no")

Fixed submission:
def hash1(m, key):
    return key % m

def hash2(m, key):
    return 1 +  key % (m - 1)

def hash(m, key, i):
    return (hash1(m, key) + i * hash2(m, key) ) % m

def insert(T, key):
    i = 0
    l = len(T)
    while True:
        h = hash(1046527,key,i)
        if (T[h] == None ):
            T[h] = key
            return h
        elif (T[h] == key):
            return h
        else:
            i += 1

def search(T,key):
    l = len(T)
    i = 0
    while True:
        h = hash(1046527,key,i)
        if(T[h] == key):
            return h
        elif(T[h] is None or h >= l):
            return -1
        else:
            i += 1

def find(T, key):
    a = search(T,key)
    if(a == -1):
        print('no')
    else:
        print('yes')

dict = {'A' : '1', 'C' : '2', 'G' : '3', 'T' : '4'}
data = []
T = [None]*1046527
n = int(input())


while n > 0:
    st = input()
    d = list(st.split())

### convert key to num(1~4)
    tmp_key = ''
    for x in list(d[1]):
        tmp_key += dict[x]

    data.append([d[0],int(tmp_key)])
    n -= 1
for com in data:
    if(com[0] == 'insert'):
        insert(T,com[1]) 
    else:
        find(T,com[1])

Buggy python submission (verdict: Time Limit Exceeded):
# const
M = 6094397

def h1(key):
    return key % M

def h2(key):
    return 1 + (key % (M-1))

def hash(key ,i):
    return (h1(key) + i*h2(key)) % M

def conv_str_to_num(str):
    converted = 0
    s_list = list(str)
    for (i,c) in enumerate(s_list):
        if c == 'A':
            n = 1
        elif c == 'C':
            n = 2
        elif c == 'G':
            n = 3
        elif c == 'T':
            n = 4
        else:
            n = 0

        converted += 5**i * n

    return converted



class hashTable(object):
    def __init__(self, arg):
        self.T = [""] * arg

    def insert(self, s):
        key = conv_str_to_num(s)
        i = 0
        while True:
            h = hash(key, i)
            if self.T[h] == "":
                self.T[h] = s
                break
            i += 1

    def find(self, s):
        key = conv_str_to_num(s)
        i = 0
        while True:
            h = hash(key, i)
            if self.T[h] == s:
                return 1
            elif self.T[h] == "":
                return 0

            i += 1
        return 0


if __name__ == '__main__':
    h_t = hashTable(M)
    n = int(input())
    for _ in range(n):
        op, s = input().split()
        if op == "insert":
            h_t.insert(s)
        else:
            tmp = h_t.find(s)
            if tmp == 1:
                print("yes")
            else:
                print("no")

Fixed submission:
def hash1(m, key):
    return key % m

def hash2(m, key):
    return 1 +  key % (m - 1)

def hash(m, key, i):
    return (hash1(m, key) + i * hash2(m, key) ) % m

def insert(T, key):
    i = 0
    l = len(T)
    while True:
        h = hash(1046527,key,i)
        if (T[h] == None ):
            T[h] = key
            return h
        elif (T[h] == key):
            return h
        else:
            i += 1

def search(T,key):
    l = len(T)
    i = 0
    while True:
        h = hash(1046527,key,i)
        if(T[h] == key):
            return h
        elif(T[h] is None or h >= l):
            return -1
        else:
            i += 1

def find(T, key):
    a = search(T,key)
    if(a == -1):
        print('no')
    else:
        print('yes')

dict = {'A' : '1', 'C' : '2', 'G' : '3', 'T' : '4'}
data = []
T = [None]*1046527
n = int(input())


while n > 0:
    st = input()
    d = list(st.split())

### convert key to num(1~4)
    tmp_key = ''
    for x in list(d[1]):
        tmp_key += dict[x]

    data.append([d[0],int(tmp_key)])
    n -= 1
for com in data:
    if(com[0] == 'insert'):
        insert(T,com[1]) 
    else:
        find(T,com[1])