Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*m
 
for _  in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
 
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
 
print(c) 


n, m = map(int, input().split())
H = list(map(int, input().split()))
S = []
c = 0
b = []
 
for i in range(m):
    S.append(list(map(int, input().split())))
 
for j in range(n):
    for k in range(m):
        if j in S[k]:
            if S[k][0] == j:
                if H[S[k][0]] < H[S[k][1]]:
                    c += 1
            else:
                if H[S[k][0]] > H[S[k][1]]:
                    c + = 1
    if c == 0:
        b.append(j)
    c = 0
 
print(len(b))

n,m = map(int, input().split())
H = list(map(int, input().split()))
S = []
c = 0
b = []

for i in range(m):
    S.append(list(map(int, input()split())))

for j in range(n):
    for k in range(m):
        if j in S[k]:
            if S[k][0] == j:
                if S[k][0] < S[k][1]:
                    c += 1
            else:
                if S[k][0] > S[k][1]:
                    c + = 1
    if c ==0:
        b.append(j)

print(len(b))

n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*n
 
for _  in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
 
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
 
print(c) 


n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*m

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

c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1

print(c)    

n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*n
 
for _  in range(m):
    road = list(map(int, input().split()))
    s[road[0]-1].append(H[road[1]-1])
    s[road[1]-1].append(H[road[0]-1])
 
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
 
print(c) 


n,m = map(int, input().split())
H = list(map(int, input().split()))
S = []
c = 0
b = []
 
for i in range(m):
    S.append(list(map(int, input().split())))
 
for j in range(n):
    for k in range(m):
        if j in S[k]:
            if S[k][0] == j:
                if S[k][0] < S[k][1]:
                    c += 1
            else:
                if S[k][0] > S[k][1]:
                    c + = 1
    if c ==0:
        b.append(j)
 
print(len(b))

n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*n
for i in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
print(c) 


n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
 print(c) 


n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
print(c) 

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted