Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left
from collections import deque
n = int(input())
A=[int(input()) for _ in range(n)]
q=deque()
for a in A:
    i=bisect_left(l,a)
    if not i:
        q.appendleft(a)
    else:
        q[i-1]=a
print(len(q))

Fixed submission:
from bisect import bisect_left
from collections import deque
n = int(input())
A=[int(input()) for _ in range(n)]
q=deque()
for a in A:
    i=bisect_left(q,a)
    if not i:
        q.appendleft(a)
    else:
        q[i-1]=a
print(len(q))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
A=[int(input()) for _ in range(n)]
row = [A[0]]
for a in A[1:]:
    index = bisect_left(row[::-1],a)
    if index==0:
        row.append(a)
    else:
        row[len(row) - index] = a
print(len(row))

Fixed submission:
from bisect import bisect_left
from collections import deque
n = int(input())
A=[int(input()) for _ in range(n)]
q=deque()
for a in A:
    i=bisect_left(q,a)
    if not i:
        q.appendleft(a)
    else:
        q[i-1]=a
print(len(q))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
A=[int(input()) for _ in range(n)]
row = [A[0]]
for a in A[1:]:
    if a<=row[-1]:
        row.append(a)
    else:
        row[len(row) - bisect_left(row[::-1],a)] = a
print(len(row))

Fixed submission:
from bisect import bisect_left
from collections import deque
n = int(input())
A=[int(input()) for _ in range(n)]
q=deque()
for a in A:
    i=bisect_left(q,a)
    if not i:
        q.appendleft(a)
    else:
        q[i-1]=a
print(len(q))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
A=[int(input()) for _ in range(n)]
row = []
for a in A:
    if (not row) or a<=row[-1]:
        row.append(a)
    else:
        row[len(row) - bisect_left(row[::-1],a)] = a
print(len(row))

Fixed submission:
from bisect import bisect_left
from collections import deque
n = int(input())
A=[int(input()) for _ in range(n)]
q=deque()
for a in A:
    i=bisect_left(q,a)
    if not i:
        q.appendleft(a)
    else:
        q[i-1]=a
print(len(q))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
A=[int(input()) for _ in range(n)]
row = []
for a in A:
    if (not row) or a<=min(row):
        row.append(a)
    else:
        row[len(row) - bisect_left(row[::-1],a)] = a
print(len(row))

Fixed submission:
from bisect import bisect_left
from collections import deque
n = int(input())
A=[int(input()) for _ in range(n)]
q=deque()
for a in A:
    i=bisect_left(q,a)
    if not i:
        q.appendleft(a)
    else:
        q[i-1]=a
print(len(q))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
A=[int(input()) for _ in range(n)]
row = []
for a in A:
    if (not row) or a<=min(row):
        row.append(a)
    else:
        row[len(row) - bisect_left(row[::-1],a)] = a
print(len(row))

Fixed submission:
from bisect import bisect_left
from collections import deque
n = int(input())
A=[int(input()) for _ in range(n)]
q=deque()
for a in A:
    i=bisect_left(q,a)
    if not i:
        q.appendleft(a)
    else:
        q[i-1]=a
print(len(q))