Buggy python submission (verdict: Time Limit Exceeded):
#N　展望台の数　M　道の数
N,M = map(int, input().split())
#高さ
H =list(map(int,input().split()))

ans=0

#道
J=[""]*M
for i in range(M):
  J[i]=(list(map(int, input().split())))

for i in range(1,N+1):
  dic={}
  flg = 0
  for j in J:    
    if j[0] == i:
      dic.setdefault(j[1],0)
      dic[j[1]]+=1 
    elif j[1] == i:
      dic.setdefault(j[0],0)
      dic[j[0]]+=1
  
  if len(dic) == 0:
    ans+=1
  else:
    for k,v in dic.items():
      if H[k-1] >= H[i-1]:
        flg = 1
    if flg == 0:
      ans+=1

    
print(ans)
    
#    for k,v in dic.items():
#      if not v > 1:
#        if H[k-1] >= H[i-1]:
#          flg = 1
#    if flg == 0:
#      ans.append(i)

  

Fixed submission:
#N　展望台の数　M　道の数
N,M = map(int, input().split())
#高さ
H =list(map(int,input().split()))

ans=0
di = {}
#道
J=[""]*M
for i in range(M):
  a,b=list(map(int, input().split()))
  di.setdefault(a,[])
  di[a].append(b)
  di.setdefault(b,[])
  di[b].append(a)
  
#  J[i]=(list(map(int, input().split())))

for i in range(1,N+1):
  flg = 0

  if i in di.keys():
#    print(i)
#    print(di[i])
    for k in di[i]:
      if H[k-1] >= H[i-1]:
        flg = 1
    if flg == 0:
      ans+=1

  else:
    ans+=1

    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#N　展望台の数　M　道の数
N,M = map(int, input().split())
#高さ
H =list(map(int,input().split()))

ans=0

#道
J=[]
for i in range(M):
  J.append(list(map(int, input().split())))

for i in range(1,N+1):
  dic={}
  flg = 0
  for j in J:    
    if j[0] == i:
      dic.setdefault(j[1],0)
      dic[j[1]]+=1 
    elif j[1] == i:
      dic.setdefault(j[0],0)
      dic[j[0]]+=1
  
  if len(dic) == 0:
    ans+=1
  else:
    for k,v in dic.items():
      if H[k-1] >= H[i-1]:
        flg = 1
    if flg == 0:
      ans+=1

    
print(ans)

Fixed submission:
#N　展望台の数　M　道の数
N,M = map(int, input().split())
#高さ
H =list(map(int,input().split()))

ans=0
di = {}
#道
J=[""]*M
for i in range(M):
  a,b=list(map(int, input().split()))
  di.setdefault(a,[])
  di[a].append(b)
  di.setdefault(b,[])
  di[b].append(a)
  
#  J[i]=(list(map(int, input().split())))

for i in range(1,N+1):
  flg = 0

  if i in di.keys():
#    print(i)
#    print(di[i])
    for k in di[i]:
      if H[k-1] >= H[i-1]:
        flg = 1
    if flg == 0:
      ans+=1

  else:
    ans+=1

    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#N　展望台の数　M　道の数
N,M = map(int, input().split())
#高さ
H =list(map(int,input().split()))

ans=[]
#道
J=[]
for i in range(M):
  J.append(list(map(int, input().split())))

for i in range(1,N+1):
  dic={}
  flg = 0
  for j in J:    
    if j[0] == i:
      dic.setdefault(j[1],0)
      dic[j[1]]+=1 
    elif j[1] == i:
      dic.setdefault(j[0],0)
      dic[j[0]]+=1
  
  if len(dic) == 0:
    ans.append(i)
  else:
    for k,v in dic.items():
      if H[k-1] >= H[i-1]:
        flg = 1
    if flg == 0:
      ans.append(i)

    
print(len(ans))

Fixed submission:
#N　展望台の数　M　道の数
N,M = map(int, input().split())
#高さ
H =list(map(int,input().split()))

ans=0
di = {}
#道
J=[""]*M
for i in range(M):
  a,b=list(map(int, input().split()))
  di.setdefault(a,[])
  di[a].append(b)
  di.setdefault(b,[])
  di[b].append(a)
  
#  J[i]=(list(map(int, input().split())))

for i in range(1,N+1):
  flg = 0

  if i in di.keys():
#    print(i)
#    print(di[i])
    for k in di[i]:
      if H[k-1] >= H[i-1]:
        flg = 1
    if flg == 0:
      ans+=1

  else:
    ans+=1

    
print(ans)