TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M= (int(x) for x in input().split())
height=[int(x) for x in input().split()]
nlist=[1]*N
print(nlist)

for _ in range(M):
    a, b =(int(x) for x in input().split())
    a-=1
    b-=1
    if height[a]<height[b]:
        nlist[a]=0

    if height[b]<height[a]:
        nlist[b]=0
    print(nlist)

print(sum(nlist))

N, M= (int(x) for x in input().split())
height=[int(x) for x in input().split()]
#height=[8,6,9,1,2,1]
nlist=[i for i in range(1,N+1)]
#print(nlist)

for i in range(M):
    a, b =(int(x) for x in input().split())
    c=height.index(min(height[a-1], height[b-1]))+1
    print(c)
    if c in nlist:
        nlist.remove(c)
print(len(nlist))


N, M= (int(x) for x in input().split())
height=[int(x) for x in input().split()]
nlist=[1]*N
print(nlist)

for _ in range(M):
    a, b =(int(x) for x in input().split())
    a-=1
    b-=1
    if height[a]<height[b]:
        nlist[a]=0

    if height[b]<height[a]:
        nlist[b]=0
    print(nlist)

print(sum(nlist))

N, M= (int(x) for x in input().split())
height=[int(x) for x in input().split()]
nlist=[1]*N

for _ in range(M):
    a, b =(int(x) for x in input().split())
    a-=1
    b-=1
    if height[a]<=height[b]:
        nlist[a]=0

    if height[b]<=height[a]:
        nlist[b]=0

print(sum(nlist))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N,M=map(int,input().split())
h=list(map(int,input().split()))

pair=[]
for _ in range(M):
    inp=list(map(int,input().split()))
    pair.append(inp)

loser=[]
for i in range(M):
    if h[pair[i][0]]<h[pair[i][1]]:
        loser.append(pair[i][0])
    elif h[pair[i][0]]>h[pair[i][1]]:
        loser.append(pair[i][1])
    else:
        loser.append(pair[i][0])
        loser.append(pair[i][1])

set_loser=set(loser)
ans=N-int(len(set_loser))
print(ans)

N,M=map(int,input().split())
h=list(map(int,input().split()))

pair=[]
for _ in range(M):
    inp=list(map(int,input().split()))
    pair.append(inp)

loser=[]
for i in range(M):
    if h[pair[i][0]-1]<h[pair[i][1]-1]:
        loser.append(pair[i][0])
    elif h[pair[i][0]-1]>h[pair[i][1]-1]:
        loser.append(pair[i][1])
    else:
        loser.append(pair[i][0])
        loser.append(pair[i][1])

set_loser=set(loser)
ans=N-int(len(set_loser))
print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
a, b = map(float, input().split())
a = int(a)
b_int = b*100

ans = a*b_int/100
ans = int(ans)
print(ans)


n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

good = [1]*n

for comb in ab:
    a = comb[0]-1
    b = comb[1]-1
    if h[a] <= h[b]:
        good[a] = 0
    if h[a] >= h[b]:
        good[b] = 0

ans = sum(good)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m =map(int,input().split())
h=list(map(int,input().split()))
result=list(range(n))
for i in range(m):
    a,b =map(int,input().split())
    a-=1
    b-=1
    if h[a]>h[b]:
        if b in result:
            del result[b]
    elif h[a]<h[b]:
        if a in result:
            del result[a]
    else:
        if a in result:
            del result[a]
        if b in result:
            del result[b]

print(len(result))
            
        
        

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

print(sum(result))
            
        
        

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N,M = map(int, input().split())
H = list(map(int, input().split()))

A = [[] for i in range(N+1)]
for i in range(N+1):
    A[i].append(H[i-1])
for i in range(M):
    a,b = map(int, input().split())
    A[a].append(H[b-1])
    A[b].append(H[a-1])

ans = 0
for i in range(1,N+1):
    print(A[i])
    if max(A[i]) == A[i][0] :
        ans += 1

    if len(A[i]) != 1 and len(set(A[i])) == 1:
        ans -= 1
print(ans)


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

A = [[] for i in range(N+1)]
for i in range(N+1):
    A[i].append(H[i-1])
for i in range(M):
    a,b = map(int, input().split())
    A[a].append(H[b-1])
    A[b].append(H[a-1])

ans = 0
for i in range(1,N+1):
    if max(A[i]) == A[i][0] and A[i].count(A[i][0]) < 2:
        ans += 1

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())

H = list(map(int, input().split()))

AB = [tuple(map(int, input().split())) for i in range(M)]

graph = [[] for _ in range(N)]

for a, b in AB:
  a, b = a-1, b-1
  graph[a].append(b)
  graph[b].append(a)

  ans = 0

for i, h in enumerate(H):
  for to in graph[i]:
    if H[to] >= H[i]:
      break
    else:
      ans += 1
  
print(ans)

N, M = map(int, input().split())

H = list(map(int, input().split()))




graph = [[] for _ in range(N)]

for _ in range(M):
  a, b = map(int, input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)

  ans = 0

for n in range(N):
  flag = True
  for to in graph[n]:
    if H[n] <= H[to]:
      flag = False
    
  if flag:
    ans += 1
  
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m=map(int, input().split())
h = list(map(int, input().split()))
l = [input().split() for i in range(m)]

list = [0]*n
for j in range(m):
    if h[int(l[j][0])-1] > h[int(l[j][1])-1]:
        list[int(l[j][1])-1] -= 1
    elif  h[int(l[j][0])-1] < h[int(l[j][1])-1]:
        list[int(l[j][0])-1] -= 1
    else :
        list[int(l[j][0])-1] -= 1
        list[int(l[j][1])-1] -= 1

print(list)
print(list.count(0))

n,m=map(int, input().split())
h = list(map(int, input().split()))
l = [input().split() for i in range(m)]

list = [0]*n
for j in range(m):
    if h[int(l[j][0])-1] > h[int(l[j][1])-1]:
        list[int(l[j][1])-1] -= 1
    elif  h[int(l[j][0])-1] < h[int(l[j][1])-1]:
        list[int(l[j][0])-1] -= 1
    else :
        list[int(l[j][0])-1] -= 1
        list[int(l[j][1])-1] -= 1

print(list.count(0))

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m = map(int, input().split())
A = []
B = []
ans = 0
H = list(map(int,input().split()))
for i in range(m-1):
    a, b = map(int, input().split())
    A.append(int(a))
    B.append(int(b))
for i in range(m-1):
  if H[(A[i])-1] < H[(B[i])-1]:
    ans += 1
for i in range(m-1):
  if A.count(i) == 0 and B.count(i) == 0:
    ans += 1
for i in range(m-1):
  for j in range(m-1):
    if A[i] == B[j] and B[i] == A[j]:
      ans += 1
print(ans)

n, m = map(int,input().split())
h = list(map(int,input().split()))
bads = set()
ans = n
for i in range(m):
  a, b = map(int,input().split())
  a -= 1 
  b -= 1
  if a not in bads and h[a] <= h[b]:
    bads.add(a)
    ans -= 1
  if b not in bads and h[a] >= h[b]:
    bads.add(b)
    ans -= 1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())
H = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

li = [0] + [-1] * N
for a, b in AB:
    ma = max(H[a-1], H[b-1])
    if ma==H[a-1]:
        li[b]=-4
#     elif ma==H[b-1]:
#         li[a]=-4
    else:
        li[a]=-4
        li[b]=-4

#     if H[a-1]>H[b-1]:
#         li[b]=-4
#     elif H[b-1]>H[a-1]:
#         li[a]=-4
#     else:
#         li[a] = li[b] = -4

cnt=0

for i in range(N+1):
    if i==0:
        continue
    if li[i]==-4:
        cnt+=1
print(N-cnt)

N, M = map(int, input().split())
H = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

li = [0] + [-1] * N
for a, b in AB:
#     ma = max(H[a-1], H[b-1])
#     if ma==H[a-1]:
#         li[b]=-4
#     elif ma==H[b-1]:
#         li[a]=-4
#     else:
#         li[a]=-4
#         li[b]=-4

#     if H[a-1]>H[b-1]:
#         li[b]=-4
#     elif H[b-1]>H[a-1]:
#         li[a]=-4
#     else:
#         li[a] = li[b] = -4
        
    if H[a-1]>H[b-1]:
        li[b]=-4
    elif H[b-1]==H[a-1]:
        li[a] = li[b] = -4
    else:
        li[a]=-4

cnt=0

for i in range(N+1):
    if i==0:
        continue
    if li[i]==-4:
        cnt+=1
print(N-cnt)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
import sys
import math

n, m = map(int, input().split())
h = list(map(int, input().split()))
ma = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    ma[a - 1] = max(ma[a-1],h[b - 1])
    ma[b - 1] = max(ma[b-1] ,h[a - 1])
cnt = 0
print(ma)
print(h)
for i in range(n):
    if h[i] > ma[i]:
        cnt += 1
print(cnt)


import sys
import math

n, m = map(int, input().split())
h = list(map(int, input().split()))
ma = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    ma[a - 1] = max(h[a - 1],max(ma[a-1],h[b - 1]))
    ma[b - 1] = max(h[b - 1],max(ma[b-1] ,h[a - 1]))
cnt = 0
for i in range(n):
    if h[i] > ma[i]:
        cnt += 1
print(cnt)


import sys
import math
n, m = map(int, input().split())
h=list(map(int,input().split()))
bli = h
for i in range(m):
    a, b = map(int, input().split())
    bli[a - 1] = max(bli[a - 1], b)
cnt=0
for i in range(n):
    if (h[i] == bli[i]):
        cnt += 1
print(cnt)

import sys
import math

n, m = map(int, input().split())
h = list(map(int, input().split()))
ma = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    ma[a - 1] = max(ma[a-1],h[b - 1])
    ma[b - 1] = max(ma[b-1] ,h[a - 1])
cnt = 0
for i in range(n):
    if h[i] > ma[i]:
        cnt += 1
print(cnt)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())
O = list(map(int, input().split()))
B = [[] for i in range(N)]
 
for j in range(M):
  o_1, o_2 = map(int, input().split())
  B[o_1-1].append(o_2-1)
  B[o_2-1].append(o_1-1)
  
print(B)

ans = 0
for node in range(N):
  flag =1
  for l in B[node]:
    if O[node] <= O[l]:
      flag = 0
  if  flag ==1:
    ans += 1
print(ans)
      

N, M = map(int, input().split())
O = list(map(int, input().split()))
B = [[] for i in range(N)]
 
for j in range(M):
  o_1, o_2 = map(int, input().split())
  B[o_1-1].append(o_2-1)
  B[o_2-1].append(o_1-1)

ans = 0
for node in range(N):
  flag =1
  for l in B[node]:
    if O[node] <= O[l]:
      flag = 0
  if  flag ==1:
    ans += 1
print(ans)
      

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m=list(map(int, input("").split()))
h=list(map(int, input("").split()))
a=[]
b=[]
for i in range(m):
    ai,bi=list(map(int, input("").split()))
    a.append(ai)
    b.append(bi)
ma=0
out=0
for i in range(n):
    ma=h[i]
    q=h[i]
    for j in range(m):
        if i==a[j]-1 or i==b[j]-1:
            if i==a[j]-1:
                if h[b[j]-1] >= ma:
                    ma=0
            else:
                if h[a[j]-1] >= ma:
                    ma=0
    print(ma,q)
    if ma==q:  
        out+=1
print(out)

n,m=list(map(int, input("").split()))
h=list(map(int, input("").split()))
o=[]
for i in range(n):
    o.append(1)
for i in range(m):
    a,b=list(map(int, input("").split()))
    if h[a-1] <=h[b-1]:
        o[a-1]=0
    if h[a-1] >=h[b-1]:
        o[b-1]=0
print(sum(o))

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
arr = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    arr[a-1].append(b-1)
    arr[b-1].append(a-1)

for i in range(len(h)):
    tmph = h[i]
    flg = 1
    if arr[i]:
        for j in arr[i]:
            if tmph <= h[j]:
                flg = 0
                break
    if flg == 1:
        ans +=1
        print(i)
print(ans)

n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
arr = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    arr[a-1].append(b-1)
    arr[b-1].append(a-1)

for i in range(len(h)):
    tmph = h[i]
    flg = 1
    if arr[i]:
        for j in arr[i]:
            if tmph <= h[j]:
                flg = 0
                break
    if flg == 1:
        ans +=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n, m = map(int, input().split())

h = {}
for k, v in zip(range(1,n+1),[k for k in map(int, input().split())]):
    h[k] = v 

miti = []
for i in range(m):
    temp = [k for k in map(int, input().split())]
    miti.append(temp)

x = np.zeros(n)

for i in range(m):
    if h[miti[i][0]] < h[miti[i][1]]:
        x[miti[i][0]-1] =+1
    elif h[miti[i][0]] > h[miti[i][1]]:
        x[miti[i][1]-1] =+1
    elif h[miti[i][0]] == h[miti[i][1]]:
        x[miti[i][0]-1] =+1
        x[miti[i][1]-1] =+1

print(sum(x == 0))


import numpy as np

n, m = map(int, input().split())

h = {}
for k, v in zip(range(1,n+1),[k for k in map(int, input().split())]):
    h[k] = v 

miti = []
for i in range(m):
    temp = [k for k in map(int, input().split())]
    miti.append(temp)

x = np.zeros(n)

for i in range(m):
    if h[miti[i][0]] < h[miti[i][1]]:
        x[miti[i][0]-1] =+1
    elif h[miti[i][0]] > h[miti[i][1]]:
        x[miti[i][1]-1] =+1
    elif h[miti[i][0]] == h[miti[i][1]]:
        x[miti[i][0]-1] =+1
        x[miti[i][1]-1] =+1

print(sum(x == 0))


Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N,M=map(int,input().split())
H=list(map(int,input().split()))
good=[True]*N
for i in range(M):
    A,B=map(int,input().split())
    if H[A-1]>H[B-1]:
        print("A")
        good[B-1]=False
    elif H[B-1]>H[A-1]:
        good[A-1]=False
    else:
        good[A-1],good[B-1]=False,False
ans=0
for i in good:
    if i==True:
        ans+=1
print(good)

N,M=map(int,input().split())
H=list(map(int,input().split()))
good=[True]*N
for i in range(M):
    A,B=map(int,input().split())
    if H[A-1]>H[B-1]:
        good[B-1]=False
    elif H[B-1]>H[A-1]:
        good[A-1]=False
    else:
        good[A-1],good[B-1]=False,False
ans=0
for i in good:
    if i==True:
        ans+=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N,M=map(int,input().split())
H = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
list = []
for i in range(M):
  if H[A[i]-1]>=H[B[i]-1]:
    list.append(B[i])
  elif H[A[i]-1]<=H[B[i]-1]:
    list.append(A[i])
print("N:{} M:{} H:{} list:{} set(list):{}".format(N,M,H,list,set(list)))
print(N-len(set(list)))

N,M=map(int,input().split())
H = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
list = []
for i in range(M):
  if H[A[i]-1]>=H[B[i]-1]:
    list.append(B[i])
  else:
    list.append(A[i])
print("N:{} M:{} H:{} list:{} set(list):{}".format(N,M,H,list,set(list)))
print(N-len(set(list)))

N,M=map(int,input().split())
H = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
list = []
for i in range(M):
  if H[A[i]-1]>=H[B[i]-1]:
    list.append(B[i])
  if H[A[i]-1]<=H[B[i]-1]:
    list.append(A[i])
#print("N:{} M:{} H:{} list:{} set(list):{}".format(N,M,H,list,set(list)))
print(N-len(set(list)))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N,M = inputlist()
H = inputlist()
graph = [[] for _ in range(N)]
print(graph)

for i in range(M):
    A,B = inputlist()
    A -=1
    B -=1
    graph[A].append(B)
    graph[B].append(A)
ans = 0
for i in range(N):
    h = H[i]
    k = 0
    for j in graph[i]:
        k = max(k,H[j])
    if h > k:
        ans +=1
print(ans)


#template
def inputlist(): return [int(k) for k in input().split()]
#template
N,M = inputlist()
H = inputlist()
graph = [[] for _ in range(N)]

for i in range(M):
    A,B = inputlist()
    A -=1
    B -=1
    graph[A].append(B)
    graph[B].append(A)
ans = 0
for i in range(N):
    h = H[i]
    k = 0
    for j in graph[i]:
        k = max(k,H[j])
    if h > k:
        ans +=1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
input1 = input().rstrip().split(" ")
h = input().rstrip().split(" ")
yoi = [1 for i in range(int(input1[0]))]

# print(h)map(int, input().split())
root =  [input().rstrip().split(" ") for i in range(int(input1[1]))]


print(int(root[0][1]))
for i in range(int(input1[1])):
    a=int(root[i][0])-1
    b=int(root[i][1])-1
    if h[a]> h[b]:
        # if  yoi[a] == 0:
        # yoi[a] = 1
        yoi[b] = 0
    elif h[a] < h[b]:
        # if  yoi[a] == 0:
        # yoi[a] = 1
        yoi[a] = 0
    else:
        # if  yoi[b] == 0:
            # yoi[b] = 1
        yoi[a] = 0
        yoi[b] = 0
print (sum(yoi))


N,M=map(int, input().split())
H=list(map(int, input().split()))
flag=[1]*N
for i in range(M):
    A,B=map(int, input().split())
    if H[A-1]>H[B-1]:
        flag[B-1]=0 
    elif H[A-1]<H[B-1]:
        flag[A-1]=0
    else:
        flag[A-1]=0
        flag[B-1]=0
print(sum(flag))

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n, m = map(int ,input().split(" "))
h = list(map(int, input().split(" ")))

candidates = {}
for i in range(m):
    x, y = map(int, input().split(" "))

    if h[x - 1] <= h[y -1]:
        candidates[x] = False
    if h[x - 1] >= h[y -1]:
        candidates[y] = False
    print(x, y , candidates)

ans = 0
for i in range(1, n + 1):
    is_highest = candidates.get(i, True)
    if is_highest:
        ans += 1

print(ans)

n, m = map(int ,input().split(" "))
h = list(map(int, input().split(" ")))

candidates = {}
for i in range(m):
    x, y = map(int, input().split(" "))

    if h[x - 1] <= h[y -1]:
        candidates[x] = False
    if h[x - 1] >= h[y -1]:
        candidates[y] = False

ans = 0
for i in range(1, n + 1):
    is_highest = candidates.get(i, True)
    if is_highest:
        ans += 1

print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n, m = list(map(int, input().split()))

h = list(map(int, input().split()))
print(h)

yoi_warui = [0]*(n)
dokuritsu = [0]*(n)

for i in range(m):
    a, b = list(map(int, input().split()))
    dokuritsu[a-1] = 1
    dokuritsu[b-1] = 1
    if h[a-1] < h[b-1]:
        yoi_warui[a-1] = 1
    elif h[b-1] < h[a-1]:
        yoi_warui[b-1] = 1

print(yoi_warui.count(0)- dokuritsu.count(0))


n, m = list(map(int, input().split()))

h = list(map(int, input().split()))

yoi_warui = [0]*n
dokuritsu = [0]*n

for i in range(m):
    a, b = list(map(int, input().split()))
    dokuritsu[a-1] = 1
    dokuritsu[b-1] = 1
    if h[a-1] == h[b-1]:
        yoi_warui[a-1] = 1
        yoi_warui[b-1] = 1
    elif h[a-1] < h[b-1]:
        yoi_warui[a-1] = 1
    elif h[b-1] < h[a-1]:
        yoi_warui[b-1] = 1

print(yoi_warui)
print(dokuritsu)

print(yoi_warui.count(0))



n, m = list(map(int, input().split()))

h = list(map(int, input().split()))

yoi_warui = [0]*n
dokuritsu = [0]*n

for i in range(m):
    a, b = list(map(int, input().split()))
    dokuritsu[a-1] = 1
    dokuritsu[b-1] = 1
    if h[a-1] == h[b-1]:
        yoi_warui[a-1] = 1
        yoi_warui[b-1] = 1
    elif h[a-1] < h[b-1]:
        yoi_warui[a-1] = 1
    elif h[b-1] < h[a-1]:
        yoi_warui[b-1] = 1

print(yoi_warui.count(0))



Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input(),split())
    if H[a] > H[b] and b in kouho:
        kouho.remove(b)
    elif H[a] < H[b] and a in kouho:
        kouho.remove(a)
    elif H[a] == H[b]:
        if a in kouho:
            kouho.remove(a)
        if b in kouho:
            kouho.remove(b)
print(len(kouho))


N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))


Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
def main():
    n, m = [int(x) for x in input().split()]
    heights = tuple(int(x) for x in input().split())
    adjacents_heights = [set() for _ in range(n)]
    print(heights)
    for i in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        adjacents_heights[a].add(heights[b])
        adjacents_heights[b].add(heights[a])
    ans = 0
    print(adjacents_heights)
    for h, ahs in zip(heights, adjacents_heights):
        if not ahs:
            ans += 1
            continue
        elif h > max(ahs):
            ans += 1

    return ans


if __name__ == '__main__':
    print(main())


def main():
    n, m = [int(x) for x in input().split()]
    heights = tuple(int(x) for x in input().split())
    checked = [1] * n
    for i in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        h_a = heights[a]
        h_b = heights[b]
        if h_a < h_b:
            checked[a] = 0
        elif h_a > h_b:
            checked[b] = 0
        else:
            checked[a] = 0
            checked[b] = 0

    return sum(checked)


if __name__ == '__main__':
    print(main())


Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
import numpy as np

n,m = map(int,input().split())
h = np.array(list(map(int,input().split())))


#seen = np.zeros((n,n))


#  a,b = map(int,input().split())


  
ans = 0


#  temp_1 = np.max(temp)
#  if (h[i] > temp_1) and (temp_1 != 0):
#    ans += 1
#  elif temp_1 == 0:
#    ans += 1
    
print(ans)

import numpy as np

n,m = map(int,input().split())
h = list(map(int,input().split()))


seen = np.zeros((n,n))
temp = 1


#  a,b = map(int,input().split())


  
ans = 0
for i in range(n):
  temp = np.multiply(seen[i],h)
  temp_1 = np.max(temp)
  if (h[i] > temp_1) and (temp_1 != 0):
    ans += 1
  elif temp_1 == 0:
    ans += 1
    
print(ans)

import numpy as np

n,m = map(int,input().split())
h = list(map(int,input().split()))


seen = np.zeros((n,n))
temp = 1

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


#  temp_1 = np.max(temp)
#  if (h[i] > temp_1) and (temp_1 != 0):
#    ans += 1
#  elif temp_1 == 0:
#    ans += 1
    
print(ans)

import numpy as np

n,m = map(int,input().split())
h = list(map(int,input().split()))


seen = np.zeros((n,n))


#  a,b = map(int,input().split())


  
ans = 0


#  temp_1 = np.max(temp)
#  if (h[i] > temp_1) and (temp_1 != 0):
#    ans += 1
#  elif temp_1 == 0:
#    ans += 1
    
print(ans)

import numpy as np

n,m = map(int,input().split())
h = np.array(list(map(int,input().split())))

base = np.zeros(n)
seen = np.zeros((n,n))


#  a,b = map(int,input().split())


  
ans = 0


#  temp_1 = np.max(temp)
#  if (h[i] > temp_1) and (temp_1 != 0):
#    ans += 1
#  elif temp_1 == 0:
#    ans += 1
    
print(ans)

import numpy as np
n,m = map(int,input().split())
h = list(map(int,input().split()))

base = np.ones(n)

for i in range(m):
  a,b =  map(int,input().split())
  if h[a-1] > h[b-1]:
    base[b-1] = 0
  elif h[a-1] < h[b-1]:
    base[a-1] = 0
  elif h[a-1] == h[b-1]:
    base[a-1] = 0
    base[b-1] = 0
    
print(int(np.sum(base)))

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
def c():
    N, M = map(int, input().split())
    
    H = list(map(int, input().split()))

    
    G = {}
    for i in range(M):
        A, B = map(int, input().split())
        G[A-1] = max(G.get(A-1, 0), H[B-1])
        G[B-1] = max(G.get(B-1, 0), H[A-1])
    cnt = 0
    print(G)
    for j in range(N):
        if j in G.keys() and H[j] > G[j]:
            cnt += 1
    print(cnt)


##########
if __name__ == "__main__":
    c()


def c():
    N, M = map(int, input().split())
    
    H = list(map(int, input().split()))

    
    G = {}
    for i in range(M):
        A, B = map(int, input().split())
        G[A-1] = max(G.get(A-1, 0), H[B-1])
        G[B-1] = max(G.get(B-1, 0), H[A-1])
    cnt = 0
    for j in range(N):
        if j in G.keys() and H[j] > G[j]:
            cnt += 1
        elif j not in G.keys():
            cnt += 1
    print(cnt)


##########
if __name__ == "__main__":
    c()


Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())

H = list(map(int, input().split()))

N_addj = [[] for i in range(N)]

for i in range(M):
    AB = list(map(int, input().split()))
    N_addj[AB[0]-1].append(AB[1]-1)
    N_addj[AB[1]-1].append(AB[0]-1)


N_memo = [0] * N

num = 0


arr = []

print(H)


for i in range(N):
    flag = True
    for j in N_addj[i]:
        if(H[i] <= H[j]):
            flag = False
            break
    if(flag):
        num = num + 1

print(num)


N, M = map(int, input().split())

H = list(map(int, input().split()))

N_addj = [[] for i in range(N)]

for i in range(M):
    AB = list(map(int, input().split()))
    N_addj[AB[0]-1].append(AB[1]-1)
    N_addj[AB[1]-1].append(AB[0]-1)


N_memo = [0] * N

num = 0


arr = []


for i in range(N):
    flag = True
    for j in N_addj[i]:
        if(H[i] <= H[j]):
            flag = False
            break
    if(flag):
        num = num + 1

print(num)


Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
# input
inp_ls = input().split(" ")
n,m = [int(e) for e in inp_ls[:2]]
h_ls = [int(e) for e in input().split(" ")[:n]]

# calc
raw_obs_dic = {i+1: [] for i in range(n)}
for i in range(m):
	a,b = [int(e) for e in input().split(" ")[:2]]
	raw_obs_dic[a].append(b)
	raw_obs_dic[b].append(a)


obs_dic = {k:list(set(raw_obs_dic[k])) for k in raw_obs_dic}
print(obs_dic)

cnt = 0
for o0 in obs_dic:
	
	# if len(obs_dic[o0]) < 1:
	
	# 	continue
	# compare height
	o0_h = h_ls[o0-1]
	flag = True
	for o1 in obs_dic[o0]:
		o1_h = h_ls[o1-1]
		if o0_h <= o1_h: flag = False
	print(o0, flag)
	if flag is True: cnt += 1

# result
print(cnt)

# input
inp_ls = input().split(" ")
n,m = [int(e) for e in inp_ls[:2]]
h_ls = [int(e) for e in input().split(" ")[:n]]

# calc
raw_obs_dic = {i+1: [] for i in range(n)}
for i in range(m):
	a,b = [int(e) for e in input().split(" ")[:2]]
	raw_obs_dic[a].append(b)
	raw_obs_dic[b].append(a)


obs_dic = {k:list(set(raw_obs_dic[k])) for k in raw_obs_dic}
# print(obs_dic)

cnt = 0
for o0 in obs_dic:
	
	# if len(obs_dic[o0]) < 1:
	
	# 	continue
	# compare height
	o0_h = h_ls[o0-1]
	flag = True
	for o1 in obs_dic[o0]:
		o1_h = h_ls[o1-1]
		if o0_h <= o1_h: flag = False
	# print(o0, flag)
	if flag is True: cnt += 1

# result
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n, m = map(int, input().split())
h = list(map(int, input().split()))

tmp = [1] * n

ab = [map(int, input().split()) for _ in range(M)]
a, b = [list(i) for i in zip(*ab)]

for i in range(m):
    if h[a[i] - 1] > h[b[i] - 1]:
        tmp[b[i] - 1] = 0
    elif h[a[i] - 1] < h[b[i] - 1]:
        tmp[a[i] - 1] = 0
    else:
        tmp[a[i] - 1] = 0
        tmp[b[i] - 1] = 0

print(sum(tmp))

n, m = map(int, input().split())
h = list(map(int, input().split()))

tmp = [1] * n

ab = [map(int, input().split()) for _ in range(m)]
a, b = [list(i) for i in zip(*ab)]

for i in range(m):
    if h[a[i] - 1] > h[b[i] - 1]:
        tmp[b[i] - 1] = 0
    elif h[a[i] - 1] < h[b[i] - 1]:
        tmp[a[i] - 1] = 0
    else:
        tmp[a[i] - 1] = 0
        tmp[b[i] - 1] = 0

print(sum(tmp))

Verdicts: Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):

n, m =map(int, input().split())  
list_h=list(map(int, input().split()))  

a = []
for i in range(m):
    ai = list(map(int, input().split()))  
    a.append(ai)

booler = [True] * n
for i in range(n):
    a_copy = copy.deepcopy(a)
    for j in range(m):
        if i in a_copy[j] :
            a_copy[j].remove(i)
#             print(a_copy)
            if list_h[i] > list_h[a_copy[j][0]-1]:
                continue
            else:
                booler[i] = False
        else:
            continue

print(booler.count(True))

x = int(input())
for i in range(-118, 119):
    for j in range(-119, 118):
        if i**5 - j**5 == x:
            print(i,j)
            break
    else:
        continue
    break

import copy
n, m =map(int, input().split())  
list_h=list(map(int, input().split()))  

a = []
for i in range(m):
    ai = list(map(int, input().split()))  
    a.append(ai)

for i in a:
    i.sort()
a = list(map(list, set(map(tuple, a))))

booler = [True] * n
for j in a:
    if list_h[j[0]-1] < list_h[j[1]-1]:
        booler[j[0]-1] = False
    elif list_h[j[0]-1] > list_h[j[1]-1]:
        booler[j[1]-1] = False
    else :
        booler[j[0]-1] = False
        booler[j[1]-1] = False
print(booler.count(True))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
n,m=map(int,input().split())
ilst = [int(i) for i in input().split()]
tlst = [0]*n
total = 0
for i in range(m):
    List = [int(j) for j in input().split()]
    print(List)
    xlst = []
    for p in List:
        xlst.append(ilst[p-1])
    print(xlst)
    maxIndex = [i for i, x in enumerate(xlst) if x == max(xlst)]
    print(maxIndex)
    if len(maxIndex) >= 2:
        for k in List:
            tlst[k-1] +=1
    else:
        List.pop(maxIndex[0])
        for k in List:
            tlst[k-1] +=1
for x in tlst:
    if x == 0:
        total +=1
print(total)

n,m=map(int,input().split())
ilst = [int(i) for i in input().split()]
tlst = [0]*n
total = 0
for i in range(m):
    List = [int(j) for j in input().split()]
    xlst = []
    for p in List:
        xlst.append(ilst[p-1])
    maxIndex = [i for i, x in enumerate(xlst) if x == max(xlst)]
    if len(maxIndex) >= 2:
        for k in List:
            tlst[k-1] +=1
    else:
        List.pop(maxIndex[0])
        for k in List:
            tlst[k-1] +=1
for x in tlst:
    if x == 0:
        total +=1
print(total)

Verdicts: Wrong Answer

Accepted
Problem: There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.  Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.  How many good observatories are there?

Submission attempts (in order):
N, M = map(int, input().split())
height = [int(i) for i in input().split()]
roads = [list(map(int, input().split())) for _ in range(N)]
alone=[]
ans={}
b_list=[]
for i in range(1, N+1):
  alone.append(i)
for road in roads:
  if max(road) not in b_list:
    ans[max(road)]='Yes'
    b_list.append(min(road))
  elif road[0] in alone:
    alone.remove(road[0])
  elif road[1] in alone:
    alone.remove(road[1])
print(len(ans)+len(alone))

N, M = map(int, input().split())
height = [int(i) for i in input().split()]
roads = [list(map(int, input().split())) for _ in range(M)]
alone=[]
ans={}
b_list=[]
for i in range(1, N+1):
  alone.append(i)
for road in roads:
  if max(road) not in b_list:
    ans[max(road)]='Yes'
    b_list.append(min(road))
  elif road[0] in alone:
    alone.remove(road[0])
  elif road[1] in alone:
    alone.remove(road[1])
print(len(ans)+len(alone))


N,M = map(int, input().split())
H = [0] + list(map(int, input().split()))
P = [0] + [1]*N
for i in range(M):
  A,B = map(int, input().split())
  if H[A]<=H[B]:
    P[A]=0
  if H[A]>=H[B]:
    P[B]=0
print(sum(P))

Verdicts: Runtime Error

Wrong Answer

Accepted