Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
tmp = input().split(' ')
H = []
for i in range(N):
    H = H + [int(tmp[i])]

A = []
B = []
for i in range(M):
    ta, tb = map(int, input().split())
    A = A + [ta]
    B = B + [tb]

ans = [True]*N
# v: 1ならいい展望台、0なら良くない展望台 
for i in range(M):
    ans[A[i]-1] = H[A[i]-1] > H[B[i]-1] and ans[A[i]-1]
    ans[B[i]-1] = H[B[i]-1] > H[A[i]-1] and ans[B[i]-1]

print(ans.count(True))

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))

A = [0]*M
B = [0]*M
for i in range(M):
    ta, tb = map(int, input().split())
    A[i] = ta - 1
    B[i] = tb - 1

ans = [True]*N
# v: Trueならいい展望台、Falseなら良くない展望台 
for i in range(M):
    ans[A[i]] = H[A[i]] > H[B[i]] and ans[A[i]]
    ans[B[i]] = H[B[i]] > H[A[i]] and ans[B[i]]

print(ans.count(True))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
tmp = input().split(' ')
H = []
for i in range(N):
    H = H + [int(tmp[i])]

A = []
B = []
for i in range(M):
    ta, tb = map(int, input().split())
    A = A + [ta]
    B = B + [tb]

ans = [1]*N
# v: 1ならいい展望台、0なら良くない展望台 
for i in range(M):
    if H[A[i]-1] > H[B[i]-1]:
        ans[B[i]-1] = 0
    elif H[A[i]-1] < H[B[i]-1]:
        ans[A[i]-1] = 0
    elif H[A[i]-1] == H[B[i]-1]:
        ans[A[i]-1] = 0
        ans[B[i]-1] = 0

print(sum(ans))

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))

A = [0]*M
B = [0]*M
for i in range(M):
    ta, tb = map(int, input().split())
    A[i] = ta - 1
    B[i] = tb - 1

ans = [True]*N
# v: Trueならいい展望台、Falseなら良くない展望台 
for i in range(M):
    ans[A[i]] = H[A[i]] > H[B[i]] and ans[A[i]]
    ans[B[i]] = H[B[i]] > H[A[i]] and ans[B[i]]

print(ans.count(True))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
tmp = input().split(' ')
H = []
for i in range(N):
    H = H + [int(tmp[i])]

A = []
B = []
for i in range(M):
    ta, tb = map(int, input().split())
    A = A + [ta]
    B = B + [tb]

ans = [0]*N
# v: 0ならいい展望台、1なら良くない展望台 
for i in range(N):
    j = 0
    while(ans[i] == 0 and j<M):
        if A[j]-1 == i:
            if H[B[j]-1] >= H[i]:
                ans[i] = 1
            else:
                ans[B[j]-1] = 1
        if B[j]-1 == i:
            if H[A[j]-1] >= H[i]:
                ans[i] = 1
            else:
                ans[A[j]-1] = 1
        j += 1

print(ans.count(0))

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))

A = [0]*M
B = [0]*M
for i in range(M):
    ta, tb = map(int, input().split())
    A[i] = ta - 1
    B[i] = tb - 1

ans = [True]*N
# v: Trueならいい展望台、Falseなら良くない展望台 
for i in range(M):
    ans[A[i]] = H[A[i]] > H[B[i]] and ans[A[i]]
    ans[B[i]] = H[B[i]] > H[A[i]] and ans[B[i]]

print(ans.count(True))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
tmp = input().split(' ')
H = []
for i in range(N):
    H = H + [int(tmp[i])]

A = []
B = []
for i in range(M):
    ta, tb = map(int, input().split())
    A = A + [ta]
    B = B + [tb]

ans = 0
# v: 0ならいい展望台、1なら良くない展望台 
for i in range(N):
    v = 0
    for j in range(M):
        if A[j]-1 == i:
            if H[B[j]-1] >= H[i]:
                v = 1
        if B[j]-1 == i:
            if H[A[j]-1] >= H[i]:
                v = 1
    if v == 0:
        ans+=1
    
print(ans)

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))

A = [0]*M
B = [0]*M
for i in range(M):
    ta, tb = map(int, input().split())
    A[i] = ta - 1
    B[i] = tb - 1

ans = [True]*N
# v: Trueならいい展望台、Falseなら良くない展望台 
for i in range(M):
    ans[A[i]] = H[A[i]] > H[B[i]] and ans[A[i]]
    ans[B[i]] = H[B[i]] > H[A[i]] and ans[B[i]]

print(ans.count(True))