Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
def main():
  N,M=map(int,input().split())
  R=[i for i in range(N)]
  L=list(map(int,input().split()))
  for i in range(M):
    t,u=map(int,input().split())
    if L[t-1]<=L[u-1] and t-1 in R:
      R.remove(t-1)
    if L[t-1]>=L[u-1] and u-1 in R:
      R.remove(u-1)
  print(len(R))

if __name__ == '__main__':
    main()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
H=LIST()
L=[[0] for i in range(N)]
for i in range(M):
  a,b=MAP()
  a-=1
  b-=1
  L[a].append(H[b])
  L[b].append(H[a])
ans=0
for i in range(N):
  if max(L[i])<H[i]:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
R=list(range(N))
L=list(map(int,input().split()))
for i in range(M):
  t,u=map(int,input().split())
  if L[t-1]<=L[u-1] and t-1 in R:
    R.remove(t-1)
  if L[t-1]>=L[u-1] and u-1 in R:
    R.remove(u-1)
print(len(R))

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
H=LIST()
L=[[0] for i in range(N)]
for i in range(M):
  a,b=MAP()
  a-=1
  b-=1
  L[a].append(H[b])
  L[b].append(H[a])
ans=0
for i in range(N):
  if max(L[i])<H[i]:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
R=list(range(N))
L=list(map(int,input().split()))
for i in range(M):
  t,u=map(int,input().split())
  if L[t-1]<=L[u-1] and t-1 in R:
    R.remove(t-1)
  if L[t-1]>=L[u-1] and u-1 in R:
    R.remove(u-1)
print(len(R))

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
H=LIST()
L=[[0] for i in range(N)]
for i in range(M):
  a,b=MAP()
  a-=1
  b-=1
  L[a].append(H[b])
  L[b].append(H[a])
ans=0
for i in range(N):
  if max(L[i])<H[i]:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
R=list(range(N))
L=list(map(int,input().split()))
for i in range(M):
  t,u=map(int,input().split())
  if L[t-1]<=L[u-1] and t-1 in R:
    R.remove(t-1)
  if L[t-1]>=L[u-1] and u-1 in R:
    R.remove(u-1)
print(len(R))

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
H=LIST()
L=[[0] for i in range(N)]
for i in range(M):
  a,b=MAP()
  a-=1
  b-=1
  L[a].append(H[b])
  L[b].append(H[a])
ans=0
for i in range(N):
  if max(L[i])<H[i]:
    ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
R=list(range(N))
L=list(map(int,input().split()))
for i in range(M):
  t,u=map(int,input().split())
  a=L[t-1]
  b=L[u-1]
  if a==b:
    if t-1 in R:
      R.remove(t-1)
    if u-1 in R:
      R.remove(u-1)
  elif a>b:
    if u-1 in R:
      R.remove(u-1)
  else:
    if t-1 in R:
      R.remove(t-1)
print(len(R))

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
H=LIST()
L=[[0] for i in range(N)]
for i in range(M):
  a,b=MAP()
  a-=1
  b-=1
  L[a].append(H[b])
  L[b].append(H[a])
ans=0
for i in range(N):
  if max(L[i])<H[i]:
    ans+=1
print(ans)