Buggy python submission (verdict: Time Limit Exceeded):
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
for a,b in p:
    if h[a-1]<=h[b-1]:
        remain = remain - set([a])
print(len(remain))

Fixed submission:
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
delset = set()
for a,b in p:
    if h[a-1]<=h[b-1]:
        #remain = remain - set([a])
        delset.add(a)
remain = remain - delset
print(len(remain))

Buggy python submission (verdict: Runtime Error):
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
for a,b in p:
    if h[a-1]<=h[b-1]:
        remain = remain - set(a)
print(len(remain))

Fixed submission:
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
delset = set()
for a,b in p:
    if h[a-1]<=h[b-1]:
        #remain = remain - set([a])
        delset.add(a)
remain = remain - delset
print(len(remain))

Buggy python submission (verdict: Runtime Error):
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
for a,b in p:
    if h[a-1]<=h[b-1]:
        remain -= set(a)
print(len(remain))

Fixed submission:
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
delset = set()
for a,b in p:
    if h[a-1]<=h[b-1]:
        #remain = remain - set([a])
        delset.add(a)
remain = remain - delset
print(len(remain))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
#p.sort()
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
#p.sort()
for a,b in p:
    if not (a in remain):
        continue
    if h[a-1]<=h[b-1]:
        remain = remain - set([a])
print(len(remain))

Fixed submission:
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
delset = set()
for a,b in p:
    if h[a-1]<=h[b-1]:
        #remain = remain - set([a])
        delset.add(a)
remain = remain - delset
print(len(remain))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
#p.sort()
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
p.sort()
for a,b in p:
    if not (a in remain):
        continue
    if h[a-1]<=h[b-1]:
        remain = remain - set([a])
print(len(remain))

Fixed submission:
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
delset = set()
for a,b in p:
    if h[a-1]<=h[b-1]:
        #remain = remain - set([a])
        delset.add(a)
remain = remain - delset
print(len(remain))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
p.sort()
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
p.sort()
for a,b in p:
    if not (a in remain):
        continue
    if h[a-1]<=h[b-1]:
        remain = remain - set([a])
print(len(remain))

Fixed submission:
n,m=list(map(int, input().split()))
h=list(map(int, input().split()))
p=[]
remain = set(range(1, n+1))
for i in range(m):
    p.append(list(map(int, input().split())))
temp = []
for a,b in p:
    temp.append([b,a])
p = p + temp
delset = set()
for a,b in p:
    if h[a-1]<=h[b-1]:
        #remain = remain - set([a])
        delset.add(a)
remain = remain - delset
print(len(remain))