Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if [c,d] in aans or [d,c] in aans:
      	c=c
    else:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))

Fixed submission:
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
for i in range(b):
    c,d=map(int,input().split())
    ch=h[c-1]
    dh=h[d-1]
    if ch==dh:
        ansl.append(c-1)
        ansl.append(d-1)
        ansl=list(set(ansl))
    else:
        if ch<dh:
            ansl.append(c-1)
        else:
            ansl.append(d-1)
        ansl=list(set(ansl))
print(a-len(ansl))

Fixed submission:
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
for i in range(b):
    c,d=map(int,input().split())
    ch=h[c-1]
    dh=h[d-1]
    if ch==dh:
        ansl.append(c-1)
        ansl.append(d-1)
        ansl=list(set(ansl))
    else:
        if ch<dh:
            ansl.append(c-1)
        else:
            ansl.append(d-1)
        ansl=list(set(ansl))
print(a-len(ansl))

Fixed submission:
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
for i in range(b):
    c,d=map(int,input().split())
    ch=h[c-1]
    dh=h[d-1]
    if ch==dh:
        ansl.append(c-1)
        ansl.append(d-1)
        ansl=list(set(ansl))
    else:
        if ch<dh:
            ansl.append(c-1)
        else:
            ansl.append(d-1)
        ansl=list(set(ansl))
print(a-len(ansl))

Fixed submission:
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ans=[[] for i in range(a)]
ansl=[]
anss=0
for i in range(b):
    c,d=map(int,input().split())
    ch=h[c-1]
    dh=h[d-1]
    if ch==dh:
        ansl.append(c-1)
        ansl.append(d-1)
        ansl=list(set(ansl))
    else:
        if ch<dh:
            ansl.append(c-1)
        else:
            anl.append(d-1)
        ansl=list(set(ansl))
print(a-len(ansl))

Fixed submission:
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ans=[[] for i in range(a)]
ansl=[]
anss=0
for i in range(b):
    c,d=map(int,input().split())
    ans[c-1].append(d-1)
    ans[d-1].append(c-1)
    ans[c-1]=list(set(ans[c-1]))
    ans[d-1]=list(set(ans[d-1]))
for i in ans:
    ansl+=[[h[j] for j in i]]
j=0
for i in range(a):
    height=h[i]
    if len(ansl[i])!=0:
        while True:
            if j==len(ansl[i]):
                anss+=1
                j=0
                break
            if ansl[i][j]>=height:
                j=0
                break
            j+=1
    else:
        anss+=1

print(anss)

Fixed submission:
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ans=[[] for i in range(a)]
ansl=[]
anss=0
for i in range(b):
    c,d=map(int,input().split())
    ans[c-1].append(d-1)
    ans[d-1].append(c-1)
    ans[c-1]=list(set(ans[c-1]))
    ans[d-1]=list(set(ans[d-1]))
for i in ans:
    ansl+=[[h[j] for j in i]]
j=0
for i in range(a):
    height=h[i]
    if len(ansl[i])!=0:
        while True:
            if j==len(ansl[i]):
                anss+=1
                j=0
                break
            if ansl[i][j]>=height:
                j=0
                break
            j+=1
    else:
        anss+=1

print(anss)

Fixed submission:
a,b=map(int,input().split())
h=[int(i) for i in input().split()]
ansl=[]
dic={i:0 for i in range(a)}
aans=[]
for i in range(b):
    c,d=map(int,input().split())
    if True:
        ch=h[c-1]
        dh=h[d-1]
        if ch==dh:
            if dic[c-1]==0:
                ansl.append(c-1)
                dic[c-1]+=1
            if dic[d-1]==0:
                ansl.append(d-1)
                dic[d-1]+=1
        else:
            if ch<dh:
                if dic[c-1]==0:
                    ansl.append(c-1)
                    dic[c-1]+=1
            else:
                if dic[d-1]==0:
                    ansl.append(d-1)
                    dic[d-1]+=1
        aans.append([c,d])
print(a-len(ansl))