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

N = int(input())
A = [int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_left(Color,a)
  if idx == 0:
    Color.insert(0,a)
  else:
    Color[idx-1] = a
  #Color.sort()
  #print(Color)
print(len(Color))

Fixed submission:
import sys
input = sys.stdin.readline
import bisect

N = int(input())
A = [-int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_right(Color,a)
  if idx == len(Color):
    Color.append(a)
  else:
    Color[idx] = a
  #Color.sort()
  #print(Color)
print(len(Color))

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

N = int(input())
A = [int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_left(Color,a)
  if idx == 0:
    Color.insert(0,a)
  else:
    Color[idx-1] = a
  #Color.sort()
  #print(Color)
print(len(Color))

Fixed submission:
import sys
input = sys.stdin.readline
import bisect

N = int(input())
A = [-int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_right(Color,a)
  if idx == len(Color):
    Color.append(a)
  else:
    Color[idx] = a
  #Color.sort()
  #print(Color)
print(len(Color))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = int(input())
A = [int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_left(Color,a)
  if idx == 0:
    Color.insert(0,a)
  else:
    Color[idx-1] = a
  #Color.sort()
  #print(Color)
print(len(Color))

Fixed submission:
import sys
input = sys.stdin.readline
import bisect

N = int(input())
A = [-int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_right(Color,a)
  if idx == len(Color):
    Color.append(a)
  else:
    Color[idx] = a
  #Color.sort()
  #print(Color)
print(len(Color))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
B = [10 ** 9 + 1]
for i in range(N):
  A = int(input())
  flag = True
  for j in range(len(B)):
    if A > B[j]:
      B[j] = A
      flag = False
      break
  if flag:
    B.append(A)
print(len(B) - 1)


Fixed submission:
import sys
input = sys.stdin.readline
import bisect

N = int(input())
A = [-int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_right(Color,a)
  if idx == len(Color):
    Color.append(a)
  else:
    Color[idx] = a
  #Color.sort()
  #print(Color)
print(len(Color))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
B = [10 ** 9 + 1]
for i in range(N):
  A = int(input())
  flag = True
  for j in range(len(B)):
    if A > B[j]:
      B[j] = A
      flag = False
      break
  if flag:
    B.append(A)
print(len(B) - 1)


Fixed submission:
import sys
input = sys.stdin.readline
import bisect

N = int(input())
A = [-int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_right(Color,a)
  if idx == len(Color):
    Color.append(a)
  else:
    Color[idx] = a
  #Color.sort()
  #print(Color)
print(len(Color))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
B = [10 ** 9 + 1]
for i in range(N):
  A = int(input())
  flag = True
  for j in range(len(B)):
    if A > B[j]:
      B[j] = A
      flag = False
      break
  if flag:
    B.append(A)
    B.sort(reverse=True)
print(len(B) - 1)


Fixed submission:
import sys
input = sys.stdin.readline
import bisect

N = int(input())
A = [-int(input()) for _ in range(N)]

Color = []
for a in A:
  idx = bisect.bisect_right(Color,a)
  if idx == len(Color):
    Color.append(a)
  else:
    Color[idx] = a
  #Color.sort()
  #print(Color)
print(len(Color))