Buggy python submission (verdict: Runtime Error):
n = int(input())

class Hash:
    def __init__(self):
        self.m = 1000003
        self.T = [None] * self.m
    def insert(self, key):
        i = 0
        while True:
            j = self.h(key, i)
            if i >0:
            if self.T[j] == None:
                self.T[j] = key
                break
            else:
                i = i + 1
    def search(self, key):
        i = 0
        while True:
            j = self.h(key, i)
            if self.T[j] == key:
                return j
            elif self.T[j] == None:
                return None
            else:
                i += 1
        return self.T[self.h(key)]
    def h(self, key, i):
        ki = self.key2int(key)
        h1 = ki % self.m
        h2 = i * (1 + (ki % (self.m - 1)))
        return (h1 + h2) % self.m
    def key2int(self, key):
        return sum([['A', 'C', 'G', 'T'].index(s) + 1 for s in key])

h = Hash()
for i in range(n):
    op, st = input().split()
    if op == 'insert':
        h.insert(st)
    else:
        if h.search(st):
            print('yes')
        else:
            print('no')

Fixed submission:
n = int(input())
h = {}

for i in range(n):
    op, st = input().split()
    if op == 'insert':
        h[st] = 'yes'
    else:
        print (h.get(st, 'no'))

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

class Hash:
    def __init__(self):
        self.m = 1000003
        self.T = [None] * self.m
    def insert(self, key):
        i = 0
        while True:
            j = self.h(key, i)
            if self.T[j] == None:
                self.T[j] = key
                break
            else:
                i = i + 1
    def search(self, key):
        i = 0
        while True:
            j = self.h(key, i)
            if self.T[j] == key:
                return j
            elif self.T[j] == None:
                return None
            else:
                i += 1
        return self.T[self.h(key)]
    def h(self, key, i):
        ki = self.key2int(key)
        h1 = ki % self.m
        h2 = i * (1 + (ki % (self.m - 1)))
        return (h1 + h2) % self.m
    def key2int(self, key):
        return sum([['A', 'C', 'G', 'T'].index(s) + 1 for s in key])

h = Hash()
for i in range(n):
    op, st = input().split()
    if op == 'insert':
        h.insert(st)
    else:
        if h.search(st):
            print('yes')
        else:
            print('no')

Fixed submission:
n = int(input())
h = {}

for i in range(n):
    op, st = input().split()
    if op == 'insert':
        h[st] = 'yes'
    else:
        print (h.get(st, 'no'))

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

class Hash:
    def __init__(self):
        self.m = 1000003
        self.T = [None] * self.m
    def insert(self, key):
        i = 0
        while True:
            j = self.h(key, i)
            if self.T[j] == None:
                self.T[j] = key
                break
            else:
                i = i + 1
    def search(self, key):
        i = 0
        while True:
            j = self.h(key, i)
            if self.T[j] == key:
                return j
            elif self.T[j] == None:
                return None
            else:
                i += 1
        return self.T[self.h(key)]
    def h(self, key, i):
        ki = self.key2int(key)
        h1 = ki % self.m
        h2 = i * (1 + (ki % (self.m - 1)))
        return (h1 + h2) % self.m
    def key2int(self, key):
        p = 1
        ret = 0
        for s in key:
            a = ['A', 'C', 'G', 'T'].index(s) + 1
            ret += p * a
            p *= 5
        return ret

h = Hash()
for i in range(n):
    op, st = input().split()
    if op == 'insert':
        h.insert(st)
    else:
        if h.search(st):
            print('yes')
        else:
            print('no')

Fixed submission:
n = int(input())
h = {}

for i in range(n):
    op, st = input().split()
    if op == 'insert':
        h[st] = 'yes'
    else:
        print (h.get(st, 'no'))