Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())

listofmax = [A[0]]

for j in range(1, N):
    if listofmax[0] >= A[j]:
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]

print(len(listofmax))


Fixed submission:
import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
listofmax = [A[0]]
for j in range(1, N):
    if listofmax[0] >= A[j]:
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]
print(len(listofmax))


Fixed submission:
import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
listofmax = [A[0]]
for j in range(1, N):
    if listofmax[0] >= A[j]:
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]
print(len(listofmax))


Fixed submission:
import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
numofcolor = 1
A = [0] * N
for i in range(N):
    A[i] = int(input())
listofmax = [A[0]]
for j in range(1, N):
    if listofmax[0] >= A[j]:
        numofcolor += 1
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]
print(numofcolor)


Fixed submission:
import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
numofcolor = 1
A = [0] * N
for i in range(N):
    A[i] = int(input())
listofmax = [A[0]]
for j in range(1, N):
    if listofmax[0] >= A[j]:
        numofcolor += 1
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]
print(numofcolor)


Fixed submission:
import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
numofcolor = 1
A = [0] * N
for i in range(N):
    A[i] = int(input())
listofmax = [A[0]]
lenoflistofmax = 1  # 実際のところnumofcolorと同じ値になる
for j in range(1, N):
    if listofmax[0] >= A[j]:
        numofcolor += 1
        lenoflistofmax += 1
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]
print(numofcolor)


Fixed submission:
import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N = int(input())
numofcolor = 1
A = [0] * N
for i in range(N):
    A[i] = int(input())
listofmax = [A[0]]
lenoflistofmax = 1  # 実際のところnumofcolorと同じ値になる
for j in range(1, N):
    if bisect.bisect_left(listofmax, A[j]) == 0:
        numofcolor += 1
        lenoflistofmax += 1
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]
print(numofcolor)


Fixed submission:
import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))