Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0, flush=True)
    sys.stdout.flush()
    s = input().strip()
    if s == 'Vacant':
        exit()
    ls, rs = s, s
    l, r = 0, N
    while True:
        m = (l + r) // 2
        print(m, flush=True)
        s = input().strip()
        if s == 'Vacant':
            exit()
        if (m - l) % 2 == 0 and s != ls:
            r = m
        elif (m - l) % 2 == 1 and s == ls:
            r = m
        elif (r - m) % 2 == 0 and s != rs:
            l = m
        elif (r - m) % 2 == 1 and s == rs:
            l = m

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0, flush=True)
    s = input().strip()
    if s == 'Vacant':
        return True
    ls, rs = s, s
    l, r = 0, N
    while True:
        m = (l + r) // 2
        print(m, flush=True)
        s = input().strip()
        if s == 'Vacant':
            return True
        if (m - l) % 2 == 0 and s != ls:
            r = m
            rs = s
        elif (m - l) % 2 == 1 and s == ls:
            r = m
            rs = s
        elif (r - m) % 2 == 0 and s != rs:
            l = m
            ls = s
        elif (r - m) % 2 == 1 and s == rs:
            l = m
            ls = s

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0, flush=True)
    sys.stdout.flush()
    s = input().strip()
    ls, rs = s, s
    l, r = 0, N
    while True:
        m = (l + r) // 2
        print(m, flush=True)
        s = input().strip()
        if s == 'Vacant':
            break
        if (m - l) % 2 == 0 and s != ls:
            r = m
        elif (m - l) % 2 == 1 and s == ls:
            r = m
        elif (r - m) % 2 == 0 and s != rs:
            l = m
        elif (r - m) % 2 == 1 and s == rs:
            l = m

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0, flush=True)
    s = input().strip()
    if s == 'Vacant':
        return True
    ls, rs = s, s
    l, r = 0, N
    while True:
        m = (l + r) // 2
        print(m, flush=True)
        s = input().strip()
        if s == 'Vacant':
            return True
        if (m - l) % 2 == 0 and s != ls:
            r = m
            rs = s
        elif (m - l) % 2 == 1 and s == ls:
            r = m
            rs = s
        elif (r - m) % 2 == 0 and s != rs:
            l = m
            ls = s
        elif (r - m) % 2 == 1 and s == rs:
            l = m
            ls = s

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0, flush=True)
    sys.stdout.flush()
    s = input().strip()
    ls, rs = s, s
    l, r = 0, N
    while s != 'Vacant':
        m = (l + r) // 2
        print(m, flush=True)
        s = input().strip()
        if (m - l) % 2 == 0 and s != ls:
            r = m
        elif (m - l) % 2 == 1 and s == ls:
            r = m
        elif (r - m) % 2 == 0 and s != rs:
            l = m
        elif (r - m) % 2 == 1 and s == rs:
            l = m

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0, flush=True)
    s = input().strip()
    if s == 'Vacant':
        return True
    ls, rs = s, s
    l, r = 0, N
    while True:
        m = (l + r) // 2
        print(m, flush=True)
        s = input().strip()
        if s == 'Vacant':
            return True
        if (m - l) % 2 == 0 and s != ls:
            r = m
            rs = s
        elif (m - l) % 2 == 1 and s == ls:
            r = m
            rs = s
        elif (r - m) % 2 == 0 and s != rs:
            l = m
            ls = s
        elif (r - m) % 2 == 1 and s == rs:
            l = m
            ls = s

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0)
    s = input().strip()
    ls, rs = s, s
    l, r = 0, N
    while s != 'Vacant':
        m = (l + r) // 2
        print(m)
        s = input().strip()
        if (m - l) % 2 == 0 and s != ls:
            r = m
        elif (m - l) % 2 == 1 and s == ls:
            r = m
        elif (r - m) % 2 == 0 and s != rs:
            l = m
        elif (r - m) % 2 == 1 and s == rs:
            l = m

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0, flush=True)
    s = input().strip()
    if s == 'Vacant':
        return True
    ls, rs = s, s
    l, r = 0, N
    while True:
        m = (l + r) // 2
        print(m, flush=True)
        s = input().strip()
        if s == 'Vacant':
            return True
        if (m - l) % 2 == 0 and s != ls:
            r = m
            rs = s
        elif (m - l) % 2 == 1 and s == ls:
            r = m
            rs = s
        elif (r - m) % 2 == 0 and s != rs:
            l = m
            ls = s
        elif (r - m) % 2 == 1 and s == rs:
            l = m
            ls = s

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0)
    s = input().strip()
    seats = [''] * (N+1)
    seats[0], seats[-1] = s, s
    l, r = 0, N
    while s != 'Vacant':
        m = (l + r) // 2
        print(m)
        s = input().strip()
        if (m - l) % 2 == 0 and s != seats[l]:
            r = m
        elif (m - l) % 2 == 1 and s == seats[l]:
            r = m
        elif (r - m) % 2 == 0 and s != seats[r]:
            l = m
        elif (r - m) % 2 == 1 and s == seats[r]:
            l = m

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    print(0, flush=True)
    s = input().strip()
    if s == 'Vacant':
        return True
    ls, rs = s, s
    l, r = 0, N
    while True:
        m = (l + r) // 2
        print(m, flush=True)
        s = input().strip()
        if s == 'Vacant':
            return True
        if (m - l) % 2 == 0 and s != ls:
            r = m
            rs = s
        elif (m - l) % 2 == 1 and s == ls:
            r = m
            rs = s
        elif (r - m) % 2 == 0 and s != rs:
            l = m
            ls = s
        elif (r - m) % 2 == 1 and s == rs:
            l = m
            ls = s

if __name__ == '__main__':
    main()