Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,M = list(map(int,input().split()))
Hlist = list(map(int,input().split()))
# Mlist = [list(map(int,input().split())) for _ in range(M)]

adj = [[0 for _ in range(N)] for _ in range(N)]

# for line in Mlist:
for _ in range(M):
    line = list(map(int,input().split()))
    adj[line[0]-1][line[1]-1] = 1
    adj[line[1]-1][line[0]-1] = 1

# # for i in range(N):
# #     adj[i][i] = 1

Hmatrix = [Hlist for _ in range(N)]
target = np.array(Hmatrix)*np.array(adj)
index_list = [i for i in range(len(adj)) if sum(adj[i]) != 0]

count = N - len(index_list)
for i in index_list:
    if max(target[i]) < Hlist[i]:
        count += 1
print(count)

Fixed submission:
import numpy as np

N,M   = list(map(int,input().split()))
Hlist = list(map(int,input().split()))
Hdict = {i:Hlist[i] for i in range(len(Hlist))}
# adj = [[0 for _ in range(N)] for _ in range(N)]

# for line in Mlist:
bad_set = set()
for _ in range(M):
    line = list(map(int,input().split()))
    if Hdict[line[0]-1] <= Hdict[line[1]-1]:
        bad_set.add(line[0])
    if Hdict[line[1]-1] <= Hdict[line[0]-1]:
        bad_set.add(line[1])
print(N-len(bad_set))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,M = list(map(int,input().split()))
Hlist = list(map(int,input().split()))
Mlist = [list(map(int,input().split())) for _ in range(M)]

adj = [[0 for _ in range(N)] for _ in range(N)]

for line in Mlist:
    adj[line[0]-1][line[1]-1] = 1
    adj[line[1]-1][line[0]-1] = 1

# for i in range(N):
#     adj[i][i] = 1

Hmatrix = [Hlist for _ in range(N)]
target = np.array(Hmatrix)*np.array(adj)
index_list = [i for i in range(len(adj)) if sum(adj[i]) != 0]

count = N - len(index_list)
for i in index_list:
    if max(target[i]) < Hlist[i]:
        count += 1
print(count)

Fixed submission:
import numpy as np

N,M   = list(map(int,input().split()))
Hlist = list(map(int,input().split()))
Hdict = {i:Hlist[i] for i in range(len(Hlist))}
# adj = [[0 for _ in range(N)] for _ in range(N)]

# for line in Mlist:
bad_set = set()
for _ in range(M):
    line = list(map(int,input().split()))
    if Hdict[line[0]-1] <= Hdict[line[1]-1]:
        bad_set.add(line[0])
    if Hdict[line[1]-1] <= Hdict[line[0]-1]:
        bad_set.add(line[1])
print(N-len(bad_set))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,M = list(map(int,input().split()))
Hlist = list(map(int,input().split()))
Mlist = [list(map(int,input().split())) for _ in range(M)]

adj = [[0 for _ in range(N)] for _ in range(N)]

for line in Mlist:
    adj[line[0]-1][line[1]-1] = 1
    adj[line[1]-1][line[0]-1] = 1

# for i in range(N):
#     adj[i][i] = 1

Hmatrix = [Hlist for _ in range(N)]
target = np.array(Hmatrix)*np.array(adj)

count = 0
for i in range(len(target)):
    if max(target[i]) < Hlist[i]:
        count += 1
print(count)

Fixed submission:
import numpy as np

N,M   = list(map(int,input().split()))
Hlist = list(map(int,input().split()))
Hdict = {i:Hlist[i] for i in range(len(Hlist))}
# adj = [[0 for _ in range(N)] for _ in range(N)]

# for line in Mlist:
bad_set = set()
for _ in range(M):
    line = list(map(int,input().split()))
    if Hdict[line[0]-1] <= Hdict[line[1]-1]:
        bad_set.add(line[0])
    if Hdict[line[1]-1] <= Hdict[line[0]-1]:
        bad_set.add(line[1])
print(N-len(bad_set))