Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin,stdout
n,m=map(int,stdin.readline().split())
H=list(map(int,stdin.readline().split()))
L=[[]]*(n)
for i in range(m):
	a,b=map(int,stdin.readline().split())
	L[a-1] = L[a-1]+[H[b-1]]
	L[b-1] = L[b-1]+[H[a-1]]
	
#print(L)

count=0
for i in range(n):
	if L[i]!=[]:
		if H[i]>max(L[i]):
			count+=1
	else:
		count+=1
		
stdout.write(str(count))

Fixed submission:
from sys import stdin,stdout
n,m=map(int,stdin.readline().split())
H=list(map(int,stdin.readline().split()))
L=[0]*n
for i in range(m):
	a,b=map(int,stdin.readline().split())
	L[a-1]=max(L[a-1],H[b-1])
	L[b-1]=max(L[b-1],H[a-1])
ans=0
for i in range(n):
	if H[i]>L[i]:
		ans+=1
		
stdout.write(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
H=list(map(int,input().split()))
L=[[]]*(n)
for i in range(m):
	a,b=map(int,input().split())
	L[a-1] = L[a-1]+[H[b-1]]
	L[b-1] = L[b-1]+[H[a-1]]
	
#print(L)

count=0
for i in range(n):
	if L[i]!=[]:
		if H[i]>max(L[i]):
			count+=1
	else:
		count+=1
		
print(count)

Fixed submission:
from sys import stdin,stdout
n,m=map(int,stdin.readline().split())
H=list(map(int,stdin.readline().split()))
L=[0]*n
for i in range(m):
	a,b=map(int,stdin.readline().split())
	L[a-1]=max(L[a-1],H[b-1])
	L[b-1]=max(L[b-1],H[a-1])
ans=0
for i in range(n):
	if H[i]>L[i]:
		ans+=1
		
stdout.write(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
H=list(map(int,input().split()))
L=[[]]*(n+1)
for i in range(m):
	a,b=map(int,input().split())
	L[a] = L[a]+[H[b-1]]
	L[b] = L[b]+[H[a-1]]
	
#print(L)

count=0
for i in range(1,len(L)):
	
	if L[i]!=[]:
		if H[i-1]>max(L[i]):
			count+=1
	else:
		count+=1
		
print(count)

Fixed submission:
from sys import stdin,stdout
n,m=map(int,stdin.readline().split())
H=list(map(int,stdin.readline().split()))
L=[0]*n
for i in range(m):
	a,b=map(int,stdin.readline().split())
	L[a-1]=max(L[a-1],H[b-1])
	L[b-1]=max(L[b-1],H[a-1])
ans=0
for i in range(n):
	if H[i]>L[i]:
		ans+=1
		
stdout.write(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
H=list(map(int,input().split()))
M=[]
L=[[]]*(n+1)
for i in range(m):
	a,b=map(int,input().split())
	M.append([a,b])
	L[a] = L[a]+[b]
	L[b] = L[b]+[a]
	
#print(L)

flag=0
for i in range(1,len(L)):
	count=0
	if L[i]!=[]:
		for j in list(set(L[i])):
			if H[j-1]>=H[i-1]:
				break
			else:
				count+=1
		if count==len(set(L[i])):
			flag+=1
	else:
		flag+=1
print(flag)

Fixed submission:
from sys import stdin,stdout
n,m=map(int,stdin.readline().split())
H=list(map(int,stdin.readline().split()))
L=[0]*n
for i in range(m):
	a,b=map(int,stdin.readline().split())
	L[a-1]=max(L[a-1],H[b-1])
	L[b-1]=max(L[b-1],H[a-1])
ans=0
for i in range(n):
	if H[i]>L[i]:
		ans+=1
		
stdout.write(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
H=list(map(int,input().split()))
M=[]
for i in range(m):
	a,b=map(int,input().split())
	M.append([a,b])
L=[[]]*(n+1)

for i in M:
	L[i[0]]=L[i[0]]+[i[1]]
	L[i[1]]=L[i[1]]+[i[0]]
#print(L)


flag=0
for i in range(1,len(L)):
	count=0
	if L[i]!=[]:
		for j in L[i]:
			if H[j-1]>=H[i-1]:
				break
			else:
				count+=1
		if count==len(L[i]):
			flag+=1
	else:
		flag+=1
print(flag)

Fixed submission:
from sys import stdin,stdout
n,m=map(int,stdin.readline().split())
H=list(map(int,stdin.readline().split()))
L=[0]*n
for i in range(m):
	a,b=map(int,stdin.readline().split())
	L[a-1]=max(L[a-1],H[b-1])
	L[b-1]=max(L[b-1],H[a-1])
ans=0
for i in range(n):
	if H[i]>L[i]:
		ans+=1
		
stdout.write(str(ans))