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

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

B=[]
for a in A:
  p=bisect.bisect_left(B,a)
  if p==0:
    B.insert(0,a)
  else:
    B[p-1]=a

print(len(B))


Fixed submission:
import bisect

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

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))

Buggy python submission (verdict: Runtime Error):
mport bisect

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

B=[]
for a in A:
  p=bisect.bisect_left(B,a)
  if p==0:
    B.insert(0,a)
  else:
    B[p-1]=a

print(len(B))


Fixed submission:
import bisect

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

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))

Buggy python submission (verdict: Runtime Error):
import bisect

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

c=0
B=[]
for a in A:
  p=bisect.bisect_left(b,a)
  if p==0:
    B.insert(0,a)
  else:
    B[p-1]=a

print(len(B))


Fixed submission:
import bisect

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

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))

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

n=int(input())
a=[int(input()) for i in range(n)]

c=0
b=[]
for i in range(n):
  p=bisect.bisect_left(b,a[i])
  if p==0:
    b.insert(0,a[i])
    c += 1
  else:
    b[p-1]=a[i]

print(c)


Fixed submission:
import bisect

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

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))

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

n=int(input())
a=[int(input()) for i in range(n)]

c=0
b=[]
for i in range(n):
  p=bisect.bisect_left(b,a[i])
  if p==0:
    b.append(a[i])
    c += 1
  else:
    b[p-1]=a[i]
  b.sort()

print(c)


Fixed submission:
import bisect

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

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]

b=[]
c=0
while len(a)>0:
  r=-1
  c+=1
  for i in range(len(a)):
    if a[i]<=r:
      b.append(a[i])
    else:
      r=a[i]
  a=b
  b=[]

print(c)


Fixed submission:
import bisect

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

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))

Buggy python submission (verdict: Runtime Error):
import bisect

n=int(input())
a=[int(input()) for x in range(n)]
c=[]

c.append(a[0])

for i in range(1,n):
  j=bisect.bisect_right(c,a[i])
  if c[j-1]<a[i]:
    c[j-1]=a[i]
  else:
    c.insert(j,a[i])
  print(c)
print(len(c))


Fixed submission:
import bisect

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

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for x in range(n)]
c=[0]*n

m=1
c[0]=a[0]

for i in range(1,n):
  f=0
  for j in range(m):
    if c[j]<a[i]:
      f=1
      c[j]=a[i]
      break
  if f==0:
    c[m]=a[i]
    m+=1

print(m)

Fixed submission:
import bisect

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

B=[]
c=0
for a in A:
  p=bisect.bisect_right(B,a)
  if p==c:
    B.append(a)
    c += 1
  else:
    B[p]=a

print(len(B))