Buggy python submission (verdict: Runtime Error):
h = list(map(int,input().split()))
d = [1] * n
for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  if h[a] > h[b]:
    d[b] = 0
  elif h[b] > h[a]:
    d[a] = 0
  else:
    d[a] = 0
    d[b] = 0

print(sum(d))

Fixed submission:

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [1] * n
for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  if h[a] > h[b]:
    d[b] = 0
  elif h[b] > h[a]:
    d[a] = 0
  else:
    d[a] = 0
    d[b] = 0

print(sum(d))

Buggy python submission (verdict: Time Limit Exceeded):

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [[0] * n for _ in range(n)]

for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  d[a][b] = h[b]
  d[b][a] = h[a]

mh = [1] * n
ans = 0

for i in range(n):
  if h[i] > max(d[i]):
    ans += 1
  
print(ans)

Fixed submission:

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [1] * n
for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  if h[a] > h[b]:
    d[b] = 0
  elif h[b] > h[a]:
    d[a] = 0
  else:
    d[a] = 0
    d[b] = 0

print(sum(d))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,m = list(map(int,input().split()))
h = np.array(list(map(int,input().split())))
d = np.array([[0] * n for _ in range(n)])

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

mh = [1] * n
ans = 0

for i in range(n):
  t = d[i] * h
  if h[i] > max(t):
    ans += 1
  
print(ans)

Fixed submission:

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [1] * n
for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  if h[a] > h[b]:
    d[b] = 0
  elif h[b] > h[a]:
    d[a] = 0
  else:
    d[a] = 0
    d[b] = 0

print(sum(d))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [[0] * n for _ in range(n)]

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

mh = [0] * n
ans = set()

for i in range(n):
  t = h[i]
  mh[i] = 1
  for j in range(n):
    if d[i][j] == 1 and i != j:
      if t <= h[j]:
        mh[i] = 0
        break
  if mh[i] == 1: ans.add(i)

print(len(ans))

Fixed submission:

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [1] * n
for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  if h[a] > h[b]:
    d[b] = 0
  elif h[b] > h[a]:
    d[a] = 0
  else:
    d[a] = 0
    d[b] = 0

print(sum(d))

Buggy python submission (verdict: Time Limit Exceeded):

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [[0] * n for _ in range(n)]

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

mh = [0] * n
ans = set()

for i in range(n):
  t = h[i]
  mh[i] = 1
  for j in range(n):
    if d[i][j] == 1 and i != j:
      if t <= h[j]:
        mh[i] = 0
  if mh[i] == 1: ans.add(i)

print(len(ans))


Fixed submission:

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [1] * n
for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  if h[a] > h[b]:
    d[b] = 0
  elif h[b] > h[a]:
    d[a] = 0
  else:
    d[a] = 0
    d[b] = 0

print(sum(d))