Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    n = int(raw_input())
    dic = []
    for i in range(n):
        t = raw_input().split()
        if t[0] == "insert":
            dic.append(t[1])
        if t[0] == "find":
            if(t[1] in dic):
                print("yes")
            else:
                print("no")

Fixed submission:
n = input()
table =	set()

for i in range(n):
    com	= raw_input().split()
    if(com[0][0] == "i"):
	table.add(com[1])
    else:
	if com[1] in table:
            print("yes")
	else:
            print("no")

Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
    n = int(raw_input())
    dic = []
    num = 0
    for i in range(n):
        t = raw_input().split()
        if t[0] == "insert":
            point = BinarySearch(dic, num, t[1])
            if point !=	"FOUND":
                dic.insert(point, t[1])
                num += 1
        if t[0] == "find":
            if(BinarySearch(dic, num, t[1]) == "FOUND"):
                print("yes")
            else:
                print("no")

Fixed submission:
n = input()
table =	set()

for i in range(n):
    com	= raw_input().split()
    if(com[0][0] == "i"):
	table.add(com[1])
    else:
	if com[1] in table:
            print("yes")
	else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
def BinarySearch(A, n, key):
    left = 0
    right = n
    mid = 0
    while left < right:
        mid = (left+right)/2
        if A[mid] == key:
            return "FOUND"
        elif A[mid] > key:
            right = mid
        else:
            left = mid + 1
    return left

if __name__ == "__main__":
    n = int(raw_input())
    dic = []
    num = 0
    for i in range(n):
        t = raw_input().split()
        if t[0] == "insert":
            point = BinarySearch(dic, num, t[1])
            if point != "FOUND":
                dic.insert(point, t[1])
                num += 1
        if t[0] == "find":
            if(BinarySearch(dic, num, t[1]) == "FOUND"):
                print("yes")
            else:
                print("no")

Fixed submission:
n = input()
table =	set()

for i in range(n):
    com	= raw_input().split()
    if(com[0][0] == "i"):
	table.add(com[1])
    else:
	if com[1] in table:
            print("yes")
	else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
class TrieTree:
    def __init__(self):
        self.flag = 0
        self.next = [None, None, None, None]

def judge(c):
    if c == "A":
        return 0
    elif c == "C":
        return 1
    elif c == "G":
        return 2
    else:
        return 3

def find(key, trie):

    if(len(key)>=1):
        index = judge(key[0])
	if(trie.next[index]!=None):
            find(key[1:], trie.next[index])
        else:
            print("no")
    else:
        if(trie.flag):
            print("yes")
        else:
            print("no")

def insert(key, trie):
    if(len(key)>=1):
        index = judge(key[0])
        if(trie.next[index]!=None):
            insert(key[1:], trie.next[index])
        else:
            trie.next[index] = TrieTree()
            insert(key[1:], trie.next[index])
    else:
	trie.flag = 1

if __name__ == "__main__":

    root = TrieTree()
    n = int(raw_input())
    for i in range(n):
        com = raw_input().split()
        if(com[0][0] == "i"):
            insert(com[1], root)
        else:
            find(com[1], root)

Fixed submission:
n = input()
table =	set()

for i in range(n):
    com	= raw_input().split()
    if(com[0][0] == "i"):
	table.add(com[1])
    else:
	if com[1] in table:
            print("yes")
	else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
class TrieTree:
    def __init__(self):
        self.flag = 0
        self.next = [None, None, None, None]

def judge(c):
    if c == "A":
        return 0
    elif c == "C":
        return 1
    elif c == "G":
        return 2
    else:
        return 3

def find(key, trie):

    if(len(key)>=1):
        index = judge(key[0])
        if(trie.next[index]==None):
            print("no")
        else:
            find(key[1:], trie.next[index])
    else:
        if(trie.flag):
            print("yes")
	else:
            print("no")

def insert(key, trie):
    if(len(key)>=1):
	index = judge(key[0])
	if(trie.next[index]==None):
            trie.next[index] = TrieTree()
            insert(key[1:], trie.next[index])
        else:
            insert(key[1:], trie.next[index])
    else:
        trie.flag = 1

if __name__ == "__main__":

    root = TrieTree()
    n = int(raw_input())
    for i in range(n):
        com = raw_input().split()
        if(com[0][0] == "i"):
            insert(com[1], root)
        else:
            find(com[1], root)

Fixed submission:
n = input()
table =	set()

for i in range(n):
    com	= raw_input().split()
    if(com[0][0] == "i"):
	table.add(com[1])
    else:
	if com[1] in table:
            print("yes")
	else:
            print("no")