Buggy python submission (verdict: Time Limit Exceeded):
# ABC134E

import sys
from bisect import bisect_left
input=sys.stdin.readline

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    lbds=[A[0]]
    for i in range(1,N):
        if lbds[-1]>=A[i]:
            lbds+=[A[i]]
        else:
            x=len(lbds)-bisect_left(lbds[::-1],A[i])
            lbds[x]=A[i]
            
    print(len(lbds))
    
if __name__=="__main__":
    main()


Fixed submission:
# ABC134E

import sys
input=sys.stdin.readline

def bisectR(ite,x):
    st=-1
    en=len(ite)
    while(en-st>1):
        mid=(en+st)//2
        if ite[mid]<x:
            en=mid
        else:
            st=mid
    return en

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    lbds=[A[0]]
    for i in range(1,N):
        if lbds[-1]>=A[i]:
            lbds+=[A[i]]
        else:
            x=bisectR(lbds,A[i])
            lbds[x]=A[i]
    print(len(lbds))
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# ABC134E

import sys
from bisect import bisect_left
input=sys.stdin.readline

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    lbds=[A[0]]
    for i in range(1,N):
        if lbds[-1]>=A[i]:
            lbds+=[A[i]]
        else:
            x=len(lbds)-bisect_left(lbds[::-1],A[i])
            lbds[x]=A[i]
            
    print(len(lbds))
    
if __name__=="__main__":
    main()


Fixed submission:
# ABC134E

import sys
input=sys.stdin.readline

def bisectR(ite,x):
    st=-1
    en=len(ite)
    while(en-st>1):
        mid=(en+st)//2
        if ite[mid]<x:
            en=mid
        else:
            st=mid
    return en

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    lbds=[A[0]]
    for i in range(1,N):
        if lbds[-1]>=A[i]:
            lbds+=[A[i]]
        else:
            x=bisectR(lbds,A[i])
            lbds[x]=A[i]
    print(len(lbds))
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# ABC134E

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    cho=[0]*(10**9+1)
    cho[A[0]]+=1
    maxset=set([A[0]])
    
    for i in range(1,N):
        remset=set()
        for m in maxset:
            if A[i]>m:
                remset.add(m)
            if A[i]==m:
                cho[m]+=1
        if len(remset)>0:
            maxset.remove(max(remset))
            maxset.add(A[i])
        else:
            maxset.add(A[i])
            
    print(max(len(maxset),max(cho)))
    
if __name__=="__main__":
    main()


Fixed submission:
# ABC134E

import sys
input=sys.stdin.readline

def bisectR(ite,x):
    st=-1
    en=len(ite)
    while(en-st>1):
        mid=(en+st)//2
        if ite[mid]<x:
            en=mid
        else:
            st=mid
    return en

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    lbds=[A[0]]
    for i in range(1,N):
        if lbds[-1]>=A[i]:
            lbds+=[A[i]]
        else:
            x=bisectR(lbds,A[i])
            lbds[x]=A[i]
    print(len(lbds))
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# ABC134E

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    cho=[0]*(10**5+1)
    cho[A[0]]+=1
    maxset=set([A[0]])
    
    for i in range(1,N):
        remset=set()
        for m in maxset:
            if A[i]>m:
                remset.add(m)
            if A[i]==m:
                cho[m]+=1
        if len(remset)>0:
            maxset.remove(max(remset))
            maxset.add(A[i])
        else:
            maxset.add(A[i])
            
    print(max(len(maxset),max(cho)))
    
if __name__=="__main__":
    main()


Fixed submission:
# ABC134E

import sys
input=sys.stdin.readline

def bisectR(ite,x):
    st=-1
    en=len(ite)
    while(en-st>1):
        mid=(en+st)//2
        if ite[mid]<x:
            en=mid
        else:
            st=mid
    return en

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    lbds=[A[0]]
    for i in range(1,N):
        if lbds[-1]>=A[i]:
            lbds+=[A[i]]
        else:
            x=bisectR(lbds,A[i])
            lbds[x]=A[i]
    print(len(lbds))
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# ABC134E

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    cho=[0]*(10**5+1)
    cho[A[0]]+=1
    maxset=set([A[0]])
    
    for i in range(1,N):
        remset=set()
        for m in maxset:
            if A[i]>m:
                remset.add(m)
            if A[i]==m:
                cho[m]+=1
        if len(remset)>0:
            maxset.remove(max(remset))
            maxset.add(A[i])
        else:
            maxset.add(A[i])
            
    print(maxset)
    print(max(len(maxset),cho))
    
if __name__=="__main__":
    main()


Fixed submission:
# ABC134E

import sys
input=sys.stdin.readline

def bisectR(ite,x):
    st=-1
    en=len(ite)
    while(en-st>1):
        mid=(en+st)//2
        if ite[mid]<x:
            en=mid
        else:
            st=mid
    return en

def main():
    N=int(input())
    A=[int(input()) for i in range(N)]
    
    lbds=[A[0]]
    for i in range(1,N):
        if lbds[-1]>=A[i]:
            lbds+=[A[i]]
        else:
            x=bisectR(lbds,A[i])
            lbds[x]=A[i]
    print(len(lbds))
    
if __name__=="__main__":
    main()