Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
M = 10**9
rest = 2**M
for i in range(n):
    x = int(input())
    if x >= M:
        x = M
    val = 2**(M - x)
    if val <= rest:
        print("Yes")
        rest -= val
    else:
        print("No")

Fixed submission:
n = int(input())
bits = set()
c1 = 0
count = 0
ans = []
for i in range(n):
    x = int(input())
    if x in bits:
        y = x
        while c1 < y and y in bits:
            y -= 1
        if y <= c1:
            y = 0
        if y == 0 and count != x:
            c1 = max(x, c1)
            ans.append("No")
        else:
            bits.add(y)
            ans.append("Yes")
            count += 1
            if y == 0:
                if i <= n-2:
                    ans.append("No\n"*(n-2-i) + "No")
                break
            for i in range(y+1, x+1):
                bits.remove(i)
                count -= 1
    else:
        bits.add(x)
        count += 1
        ans.append("Yes")
print("\n".join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
bits = {0: 1}
for i in range(n):
    x = int(input())
    if bits.get(x, 0) == 1:
        bits[x] = 0
        print("Yes")
    else:
        y = x
        while y >= 0 and bits.get(y, 0) == 0:
            y -= 1
        if y < 0:
            print("No")
        else:
            bits[y] = 0
            for i in range(y+1, x+1):
                bits[i] = 1
            print("Yes")

Fixed submission:
n = int(input())
bits = set()
c1 = 0
count = 0
ans = []
for i in range(n):
    x = int(input())
    if x in bits:
        y = x
        while c1 < y and y in bits:
            y -= 1
        if y <= c1:
            y = 0
        if y == 0 and count != x:
            c1 = max(x, c1)
            ans.append("No")
        else:
            bits.add(y)
            ans.append("Yes")
            count += 1
            if y == 0:
                if i <= n-2:
                    ans.append("No\n"*(n-2-i) + "No")
                break
            for i in range(y+1, x+1):
                bits.remove(i)
                count -= 1
    else:
        bits.add(x)
        count += 1
        ans.append("Yes")
print("\n".join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
bits = {}
count = 0
for i in range(n):
    x = int(input())
    if bits.get(0, 0) == 1:
        print("No")
        continue
    if bits.get(x, 0) == 1:
        y = x
        while bits.get(y, 0) == 1:
            y -= 1
        if y == 0 and count != x:
            print("No")
        else:
            bits[y] = 1
            count += 1
            for i in range(y+1, x+1):
                bits[i] = 0
                count -= 1
            print("Yes")
    else:
        bits[x] = 1
        count += 1
        print("Yes")

Fixed submission:
n = int(input())
bits = set()
c1 = 0
count = 0
ans = []
for i in range(n):
    x = int(input())
    if x in bits:
        y = x
        while c1 < y and y in bits:
            y -= 1
        if y <= c1:
            y = 0
        if y == 0 and count != x:
            c1 = max(x, c1)
            ans.append("No")
        else:
            bits.add(y)
            ans.append("Yes")
            count += 1
            if y == 0:
                if i <= n-2:
                    ans.append("No\n"*(n-2-i) + "No")
                break
            for i in range(y+1, x+1):
                bits.remove(i)
                count -= 1
    else:
        bits.add(x)
        count += 1
        ans.append("Yes")
print("\n".join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
bits = set()
count = 0
ans = []
for i in range(n):
    x = int(input())
    if x in bits:
        y = x
        while y in bits:
            y -= 1
        if y == 0 and count != x:
            ans.append("No")
        else:
            bits.add(y)
            if y == 0:
                ans.append("Yes")
                if i <= n-2:
                    ans.append("No\n"*(n-2-i) + "No")
                break
            count += 1
            for i in range(y+1, x+1):
                bits.remove(i)
                count -= 1
            ans.append("Yes")
    else:
        bits.add(x)
        count += 1
        ans.append("Yes")
print("\n".join(ans))

Fixed submission:
n = int(input())
bits = set()
c1 = 0
count = 0
ans = []
for i in range(n):
    x = int(input())
    if x in bits:
        y = x
        while c1 < y and y in bits:
            y -= 1
        if y <= c1:
            y = 0
        if y == 0 and count != x:
            c1 = max(x, c1)
            ans.append("No")
        else:
            bits.add(y)
            ans.append("Yes")
            count += 1
            if y == 0:
                if i <= n-2:
                    ans.append("No\n"*(n-2-i) + "No")
                break
            for i in range(y+1, x+1):
                bits.remove(i)
                count -= 1
    else:
        bits.add(x)
        count += 1
        ans.append("Yes")
print("\n".join(ans))