Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
highest=[True]*N
for i in range(M):
    a,b=map(int,input().split()))
    if(high_list[a-1]>=high_list[b-1]):
        highest[b-1]=False
    if(high_list[a-1]<=high_list[b-1]):
        highest[a-1]=False
print(sum(highest))




Fixed submission:
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
highest=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    if(high_list[a-1]>=high_list[b-1]):
        highest[b-1]=False
    if(high_list[a-1]<=high_list[b-1]):
        highest[a-1]=False
print(sum(highest))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
pathlist=[]
for i in range(M):
    pathlist.extend(list(map(int,input().split())))
ans=N
for n in range(1,N+1):
    for m in range(0,M*2,2):
        if(pathlist[m]==n):#自身じゃない方の灯台
            if(high_list[n-1]<=high_list[pathlist[m+1]-1]):#経路先が自身よりも高い
                ans=ans-1#回答に含まない
                break
        elif(pathlist[m+1]==n):
            if(high_list[n-1]<=high_list[pathlist[m]-1]):#経路先が自身よりも高い
                ans=ans-1
                break

print(ans)




Fixed submission:
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
highest=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    if(high_list[a-1]>=high_list[b-1]):
        highest[b-1]=False
    if(high_list[a-1]<=high_list[b-1]):
        highest[a-1]=False
print(sum(highest))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
pathlist=[]
for i in range(M):
    pathlist.append(list(map(int,input().split())))
waylist=[0]*N
ans=N
for n in range(1,N+1):
    for m in pathlist:
        if(n in m):#もし経路に入っていたら
            if(m[0]==n):#自身じゃない方の灯台
                if(high_list[n-1]<=high_list[m[1]-1]):#経路先が自身よりも高い
                    ans=ans-1#回答に含まない
                    break
            else:
                if(high_list[n-1]<=high_list[m[0]-1]):#経路先が自身よりも高い
                    ans=ans-1
                    break
print(ans)




Fixed submission:
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
highest=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    if(high_list[a-1]>=high_list[b-1]):
        highest[b-1]=False
    if(high_list[a-1]<=high_list[b-1]):
        highest[a-1]=False
print(sum(highest))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy  as np
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
pathlist=[]
for i in range(M):
    pathlist.append(list(map(int,input().split())))
waylist=np.array([[0]*N]*N)
#i行目にi番目から行ける展望台をすべて入れる
for n in range(1,N+1):
    for m in pathlist:
        if(n in m):#もし経路に入っていたら
            if(m[0]==n):#自身じゃない方の高さを代入
                waylist[n-1][m[1]-1]=high_list[m[1]-1]
            else:
                waylist[n-1][m[0]-1]=high_list[m[0]-1]

answer=0
for n in range(N):
    if(waylist[n].max()<high_list[n]):
        answer=answer+1

print(answer)




Fixed submission:
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
highest=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    if(high_list[a-1]>=high_list[b-1]):
        highest[b-1]=False
    if(high_list[a-1]<=high_list[b-1]):
        highest[a-1]=False
print(sum(highest))