Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    D = []

    for _ in range(N):
        command, value = [i for i in input().split()]

        if command == "insert":
            D.append(value)
        else:
            if value in D:
                print("yes")
            else:
                print("no")

main()



Fixed submission:
import sys
import collections

# Set max recursion limit
sys.setrecursionlimit(1000000)


def li_input():
    return [int(_) for _ in input().split()]


def main():
    N = int(input())
    C = [input().split() for _ in range(N)]

    D = collections.defaultdict(lambda: 0)

    for c in C:
        command, value = c

        if command == "insert":
            D[value] = 1
        else:
            if D[value] == 1:
                print("yes")
            else:
                print("no")


main()

Buggy python submission (verdict: Runtime Error):
D = []

def append(value):
    global D

    hashvalue = ""
    for letter in value:
        hashvalue += str(ord(letter))

    D.append(int(hashvalue))

def find(value):
    hashvalue = ""
    for letter in value:
        hashvalue += str(ord(letter))

    hashvalue = int(hashvalue)

    left = 0
    right = len(D) - 1

    while True:
        mid = (left + right) // 2

        if D[mid] == hashvalue:
            print("yes")
            return
        elif D[mid] < hashvalue:
            left = mid + 1
        else:
            right = mid - 1

        if left > right:
            print("no")
            return


def main():
    global D

    N = int(input())
    finds = []

    for _ in range(N):
        command, value = [i for i in input().split()]

        if command == "insert":
            append(value)
            D.sort()
        else:
            find(value)

main()



Fixed submission:
import sys
import collections

# Set max recursion limit
sys.setrecursionlimit(1000000)


def li_input():
    return [int(_) for _ in input().split()]


def main():
    N = int(input())
    C = [input().split() for _ in range(N)]

    D = collections.defaultdict(lambda: 0)

    for c in C:
        command, value = c

        if command == "insert":
            D[value] = 1
        else:
            if D[value] == 1:
                print("yes")
            else:
                print("no")


main()

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

def append(value):
    global D

    hashvalue = ""
    for letter in value:
        hashvalue += str(ord(letter))

    D.append(int(hashvalue))

def find(value):
    hashvalue = ""
    for letter in value:
        hashvalue += str(ord(letter))

    hashvalue = int(hashvalue)

    left = 0
    right = len(D) - 1

    while True:
        mid = (left + right) // 2

        if not 0 <= mid < len(D):
            print("no")
            return

        if D[mid] == hashvalue:
            print("yes")
            return
        elif D[mid] < hashvalue:
            left = mid + 1
        else:
            right = mid - 1

        if left > right:
            print("no")
            return


def main():
    global D

    N = int(input())
    finds = []

    for _ in range(N):
        command, value = [i for i in input().split()]

        if command == "insert":
            append(value)
            D.sort()
        else:
            find(value)

main()



Fixed submission:
import sys
import collections

# Set max recursion limit
sys.setrecursionlimit(1000000)


def li_input():
    return [int(_) for _ in input().split()]


def main():
    N = int(input())
    C = [input().split() for _ in range(N)]

    D = collections.defaultdict(lambda: 0)

    for c in C:
        command, value = c

        if command == "insert":
            D[value] = 1
        else:
            if D[value] == 1:
                print("yes")
            else:
                print("no")


main()

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

def append(value):
    global D

    hashvalue = ""
    for letter in value:
        hashvalue += str(ord(letter))

    D.append(int(hashvalue))

def find(value):
    hashvalue = ""
    for letter in value:
        hashvalue += str(ord(letter))

    hashvalue = int(hashvalue)

    left = 0
    right = len(D) - 1

    while True:
        mid = (left + right) // 2

        if not 0 <= mid < len(D):
            print("no")
            return

        if D[mid] == hashvalue:
            print("yes")
            return
        elif D[mid] < hashvalue:
            left = mid + 1
        else:
            right = mid - 1

        if left > right:
            print("no")
            return


def main():
    global D

    N = int(input())
    finds = []

    for _ in range(N):
        command, value = [i for i in input().split()]

        if command == "insert":
            append(value)
            D.sort()
        else:
            find(value)

main()



Fixed submission:
import sys
import collections

# Set max recursion limit
sys.setrecursionlimit(1000000)


def li_input():
    return [int(_) for _ in input().split()]


def main():
    N = int(input())
    C = [input().split() for _ in range(N)]

    D = collections.defaultdict(lambda: 0)

    for c in C:
        command, value = c

        if command == "insert":
            D[value] = 1
        else:
            if D[value] == 1:
                print("yes")
            else:
                print("no")


main()