Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
flg=[0]*N
T=[[] for _ in range(N)]

for m in range(M):
  a,b =map(int,input().split())
  T[a-1].append(b)
  T[b-1].append(a)

for n in range(N):
  if not T[n]:
    flg[n] =1
  else:
    MAX=max([H[t-1] for t in T[n]])
  if H[n]>MAX:
    flg[n]=1

print(sum(flg))
    

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
flg=[1]*N


for m in range(M):
  a,b =map(int,input().split())
  if H[a-1]<H[b-1]:
    flg[a-1]=0
  elif H[a-1]>H[b-1]:
    flg[b-1]=0
  else:
    flg[a-1]=flg[b-1]=0
  
print(flg.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[];B=[]
retu=[[0]*N for _ in range(N)]
flg=[1]*N



for m in range(M):
  a,b =map(int,input().split())
  if H[a-1]<H[b-1]:
    flg[a-1]=0
  elif H[a-1]>H[b-1]:
    flg[b-1]=0
  else:
    flg[a-1]=flg[b-1]=0
  
print(flg.count(1))
 
  

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
flg=[1]*N


for m in range(M):
  a,b =map(int,input().split())
  if H[a-1]<H[b-1]:
    flg[a-1]=0
  elif H[a-1]>H[b-1]:
    flg[b-1]=0
  else:
    flg[a-1]=flg[b-1]=0
  
print(flg.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[];B=[]
retu=[[0]*N for _ in range(N)]
flg=[1]*N


for m in range(M):
  array=list(map(int,input().split()))
  A.append(array[0])
  B.append(array[1])

for m in range(M):
  if H[A[m]-1]<H[B[m]-1]:
    flg[A[m]-1]=0
  elif H[A[m]-1]>H[B[m]-1]:
    flg[B[m]-1]=0
  else:
    flg[A[m]-1]=flg[B[m]-1]=0
  
print(flg.count(1))
 
  

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
flg=[1]*N


for m in range(M):
  a,b =map(int,input().split())
  if H[a-1]<H[b-1]:
    flg[a-1]=0
  elif H[a-1]>H[b-1]:
    flg[b-1]=0
  else:
    flg[a-1]=flg[b-1]=0
  
print(flg.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[];B=[]
retu=[[0]*N for _ in range(N)]
flg=[1]*N


for m in range(M):
  array=list(map(int,input().split()))
  A.append(array[0])
  B.append(array[1])

for m in range(M):
  if H[A[m]-1]<H[B[m]-1]:
    flg[A[m]-1]=0
  elif H[A[m]-1]>H[B[m]-1]:
    flg[B[m]-1]=0
  else:
    flg[A[m]-1]=flg[B[m]-1]=0
  
print(sum(flg))
 
  

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
flg=[1]*N


for m in range(M):
  a,b =map(int,input().split())
  if H[a-1]<H[b-1]:
    flg[a-1]=0
  elif H[a-1]>H[b-1]:
    flg[b-1]=0
  else:
    flg[a-1]=flg[b-1]=0
  
print(flg.count(1))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[];B=[]
retu=[[0]*N for _ in range(N)]
flg=[1]*N


for m in range(M):
  array=list(map(int,input().split()))
  A.append(array[0])
  B.append(array[1])

for m in range(M):
  retu[A[m]-1][B[m]-1]=1
  retu[B[m]-1][A[m]-1]=1

for k,n in enumerate(retu):
  for i,j in enumerate(n):
    if j==1:
      if H[k]<=H[i]:
        flg[k] =0

print(sum(flg))
  

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
flg=[1]*N


for m in range(M):
  a,b =map(int,input().split())
  if H[a-1]<H[b-1]:
    flg[a-1]=0
  elif H[a-1]>H[b-1]:
    flg[b-1]=0
  else:
    flg[a-1]=flg[b-1]=0
  
print(flg.count(1))