Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
li=[]
H=list(map(int,input().split()))

for i in range(M):
    A,B=map(int,input().split())
    if H[A-1]>H[B-1]:
        if B in li:
            pass
        else:
            li.append(B)
    elif H[A-1]<H[B-1]:
        if A in li:
            pass
        else:
            li.append(A)
    else:
        if A in li and B in li:
            pass
        elif A in li:
            li.append(B)
        elif B in li:
            li.append(A)
        else:
            li.append(A)
            li.append(B)

print(N-len(li))


Fixed submission:
N,M=map(int,input().split())
h=list(map(int,input().split()))
li=[1]*N
for i in range(M):
    a,b=list(map(int,input().split()))
    if h[a-1]>h[b-1]:
        li[b-1]*=0
    elif h[a-1]==h[b-1]:
        li[a-1]*=0
        li[b-1]*=0
    else:
        li[a-1]*=0

ans=li.count(1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
li=[]
H=list(map(int,input().split()))

for i in range(M):
    A,B=map(int,input().split())
    C=H[A-1]
    D=H[B-1]
    if C>D:
        if B in li:
            pass
        else:
            li.append(B)
    elif D>C:
        if A in li:
            pass
        else:
            li.append(A)
    else:
        if A in li and B in li:
            pass
        elif A in li:
            li.append(B)
        elif B in li:
            li.append(A)
        else:
            li.append(A)
            li.append(B)

print(N-len(li))


Fixed submission:
N,M=map(int,input().split())
h=list(map(int,input().split()))
li=[1]*N
for i in range(M):
    a,b=list(map(int,input().split()))
    if h[a-1]>h[b-1]:
        li[b-1]*=0
    elif h[a-1]==h[b-1]:
        li[a-1]*=0
        li[b-1]*=0
    else:
        li[a-1]*=0

ans=li.count(1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
li=[]
H=list(map(int,input().split()))

for i in range(M):
    A,B=map(int,input().split())
    C=H[A-1]
    D=H[B-1]
    if C>D:
        if B in li:
            pass
        else:
            li.append(B)
    elif D>C:
        if A in li:
            pass
        else:
            li.append(A)
    else:
        if A in li and B in li:
            pass
        elif A in li:
            li.append(B)
        elif B in li:
            li.append(A)
        else:
            li.append(A)
            li.append(B)

print(N-len(li))


Fixed submission:
N,M=map(int,input().split())
h=list(map(int,input().split()))
li=[1]*N
for i in range(M):
    a,b=list(map(int,input().split()))
    if h[a-1]>h[b-1]:
        li[b-1]*=0
    elif h[a-1]==h[b-1]:
        li[a-1]*=0
        li[b-1]*=0
    else:
        li[a-1]*=0

ans=li.count(1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
li=[]
ans=[]
H=list(map(int,input().split()))

for i in range(M):
    A,B=map(int,input().split())
    C=H[A-1]
    D=H[B-1]
    if C>D:
        li.append(B)
    elif D>C:
        li.append(A)
    else:
        li.append(A)
        li.append(B)

for j in range(N):
    if j+1 in li:
        pass
    else:
        ans.append(j+1)

print(len(ans))


Fixed submission:
N,M=map(int,input().split())
h=list(map(int,input().split()))
li=[1]*N
for i in range(M):
    a,b=list(map(int,input().split()))
    if h[a-1]>h[b-1]:
        li[b-1]*=0
    elif h[a-1]==h[b-1]:
        li[a-1]*=0
        li[b-1]*=0
    else:
        li[a-1]*=0

ans=li.count(1)
print(ans)