Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rstrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())
    
    a0 = ask(0)
    cnt = 1
    ok = 0
    ng = N-1
    mid = (ok+ng)//2
    while ng - ok > 1:
        a = ask(mid)
        cnt += 1
        if cnt == 20:
            assert False
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (ok+ng)//2
    _ = ask(N-1)
    assert False


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rstrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())

    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = ((ng//2)//2) * 2
    while ng - ok > 2:
        a = ask(mid)
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (((ok//2)+(ng//2))//2)*2
    ask((ok+ng)//2)
    ask(N-1)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rstrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())

    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = (ok+ng)//2
    while ng - ok > 1:
        a = ask(mid)
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (ok+ng)//2
    _ = ask(N-1)
    assert False


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rstrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())

    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = ((ng//2)//2) * 2
    while ng - ok > 2:
        a = ask(mid)
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (((ok//2)+(ng//2))//2)*2
    ask((ok+ng)//2)
    ask(N-1)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().strip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())

    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = (ok+ng)//2
    while ng - ok > 1:
        a = ask(mid)
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (ok+ng)//2
    _ = ask(N-1)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rstrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())

    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = ((ng//2)//2) * 2
    while ng - ok > 2:
        a = ask(mid)
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (((ok//2)+(ng//2))//2)*2
    ask((ok+ng)//2)
    ask(N-1)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rtsrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())
    
    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = (ok+ng)//2
    while ng - ok > 1:
        a = ask(mid)
        if a == a0:
            ok = a
        else:
            ng = a
        mid = (ok+ng)//2


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rstrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())

    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = ((ng//2)//2) * 2
    while ng - ok > 2:
        a = ask(mid)
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (((ok//2)+(ng//2))//2)*2
    ask((ok+ng)//2)
    ask(N-1)


if __name__ == '__main__':
    main()