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=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]

nums=[0 for i in range(N)]
t=0
for i in range(N):
  tmpl=tunagari[i]
  mini=min(tmpl)
  if mini<i:
    nums[i]=nums[mini]
    continue
  nums[i]=t
  t+=1
maxn=max(nums)
groups=[[] for i in range(maxn+1)]
for i in range(N):
  groups[nums[i]]+=[i]
ans=0
for i in range(maxn):
  tmpl=groups[i]
  tmpl2=[]
  for i in tmpl:
    tmpl2+=[H[i]]
  n=len(tmpl)
  if n==1:
    ans+=1
  else:
    tmpl2.sort()
    if tmpl2[-1]!=tmpl2[-2]:
      ans+=1
print(ans)

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

N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]
ans=0
for i in range(N):
  tmpl=tunagari[i]
  n=len(tmpl)
  if n==0 :
    ans+=1
  else:
    for j in range(n):
      tmpl[j]=H[tmpl[j]]
    maxh=max(tmpl)
    if maxh<H[i]:
      ans+=1
print(ans)


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())
hl=input().split()
shl=[int(x) for x in hl]
vl=set()
for y in range(n):
    vl.add(y)
print(vl)
for i in range(m):
    try:
        a,b=map(int,input().split())
        if shl[a-1]>shl[b-1]:
            vl.remove(b-1)
        elif shl[a-1]<shl[b-1]:
            vl.remove(a-1)
        else:
            vl.remove(a-1)
            vl.remove(b-1)
    except:
        continue
lshl=len(shl)
lvl=len(vl)
ans=lshl-lvl
print(ans)


n,m=map(int,input().split())
hl=int(input().split())n,m=map(int,input().split())
hl=input().split()
shl=[int(x) for x in hl]
vl=set()
for y in range(n):
    vl.add(y)
print(vl)
for i in range(m):
    try:
        a,b=map(int,input().split())
        if shl[a-1]>shl[b-1]:
            vl.remove(b-1)
        elif shl[a-1]<shl[b-1]:
            vl.remove(a-1)
        else:
            vl.remove(a-1)
            vl.remove(b-1)
    except:
        continue
lshl=len(shl)
lvl=len(vl)
ans=lshl-lvl
print(ans)

n,m=map(int,input().split())
hl=input().split()
shl=[int(x) for x in hl]
vl=set()
for i in range(m):
    a,b=map(int,input().split())
    if shl[a-1]>shl[b-1]:
        vl.add(b-1)
    elif shl[a-1]<shl[b-1]:
        vl.add(a-1)
    else:
        vl.add(a-1)
        vl.add(b-1)
    print(vl)
lshl=len(shl)
lvl=len(vl)
ans=lshl-lvl
print(ans)

n,m=map(int,input().split())
hl=input().split()
shl=[int(x) for x in hl]
vl=set()
for i in range(m):
    a,b=map(int,input().split())
    if shl[a-1]>shl[b-1]:
        vl.add(b-1)
    elif shl[a-1]<shl[b-1]:
        vl.add(a-1)
    else:
        vl.add(a-1)
        vl.add(b-1)
lshl=len(shl)
lvl=len(vl)
ans=lshl-lvl
print(ans)

Verdicts: Wrong Answer

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):
x = list(map(int,input().split(" ")))
n,m = x
h = list(map(int,input().split(" ")))
lowerlist = [1] * n
print(h)

for i in range(m):
    ab = list(map(int,input().split(" ")))
    a,b = ab
    print(a)
    print(b)
    # print(ab)
    if h[a-1] >= h[b-1]:
        lowerlist[b-1] = 0
    if h[b-1] >= h[a-1]:
        lowerlist[a-1] = 0
    print(lowerlist)

print(sum(lowerlist))

x = list(map(int,input().split(" ")))
n,m = x
h = list(map(int,input().split(" ")))
lowerlist = [1] * n

for i in range(m):
    ab = list(map(int,input().split(" ")))
    a,b = ab
    # print(ab)
    if h[a-1] >= h[b-1]:
        lowerlist[b-1] = 0
    if h[b-1] >= h[a-1]:
        lowerlist[a-1] = 0

print(sum(lowerlist))

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 = [list(map(int, input().split())) for m in range(M)]
AB = list(map(list, set(map(tuple, AB))))

i = []
for m in range(len(AB)):
    a = AB[m][0]
    b = AB[m][1]
    if H[a-1] >= H[b-1]:
        i.append(b-1)
    elif H[a-1] <= H[b-1]:
        i.append(a-1)

i = list(set(i))
for x in i:
    H[i] = 0

cnt = H.count(0)
print(len(H)-cnt)

N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for m in range(M)]
AB = list(map(list, set(map(tuple, AB))))

i = []
for m in range(len(AB)):
    a = AB[m][0]
    b = AB[m][1]
    if H[a-1] > H[b-1]:
        i.append(b-1)
    elif H[a-1] < H[b-1]:
        i.append(a-1)
    else:
        i.append(a-1)
        i.append(b-1)

i = list(set(i))
print(len(H)-len(i))

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 = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
hs = [[] for i in range(n)]
for i in range(m):
  a, b = [int(i) for i in input().split()]
  hs[a-1].append(h[b-1])
  hs[b-1].appned(h[a-1])
c = 0
for i in range(n):
  if len(hs[i]) == 0:
    c += 1
  elif h[i] > max(hs[i]):
    c += 1
print(c)

n, m = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
hs = [[] for i in range(n)]
for i in range(m):
    a, b = [int(i) for i in input().split()]
    hs[a-1].append(h[b-1])
    hs[b-1].append(h[a-1])
c = 0
for i in range(n):
    if len(hs[i]) == 0:
        c += 1
    elif h[i] > max(hs[i]):
        c += 1
print(c)

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())
hs = list(map(int, input().split()))
d = [1]*n

for i in range(m):
    a,b = map(int, input().split())
    if hs[a-1] <= hs[b-1]:
        d[a-1] = 0
    if hs[a-1] >= hs[b-1]:
        d[b-1] = 0
        
    print(hs,d)
    
print(d.count(1))

n,m = map(int, input().split())
hs = list(map(int, input().split()))
d = [1]*n

for i in range(m):
    a,b = map(int, input().split())
    if hs[a-1] <= hs[b-1]:
        d[a-1] = 0
    if hs[a-1] >= hs[b-1]:
        d[b-1] = 0
    
print(d.count(1))

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):
if __name__ == "__main__":
  list_N_M = input().split(' ')
  N = int(list_N_M[0])
  M = int(list_N_M[1])
  
  list_str_H_all = input().split(' ')
  H = [0.0] * N
  for i in range(len(list_str_H_all)):
    H[i] = float(list_str_H_all[i])
  
  is_good_vp = [True] * N
  
  for _ in range(M):
    str_A_B = input().split(' ')
    A = int(str_A_B[0])
    B = int(str_A_B[1])
    
    if H[A-1] > H[B-1]:
      is_good_vp[B-1] = False
    elif H[B-1] > H[A-1]:
      is_good_vp[A-1] = False
    
  output = 0
  for i in N:
    if is_good_vp[i]:
      output += 1
      
  print(output)

if __name__ == "__main__":
  list_N_M = input().split(' ')
  N = int(list_N_M[0])
  M = int(list_N_M[1])
  
  list_str_H_all = input().split(' ')
  H = [0.0] * N
  for i in range(len(list_str_H_all)):
    H[i] = float(list_str_H_all[i])
  
  is_good_vp = [True] * N
  
  for _ in range(M):
    str_A_B = input().split(' ')
    A = int(str_A_B[0])
    B = int(str_A_B[1])
    
    if H[A-1] > H[B-1]:
      is_good_vp[B-1] = False
    elif H[B-1] > H[A-1]:
      is_good_vp[A-1] = False
    
  output = 0
  for i in rabge(N):
    if is_good_vp[i]:
      output += 1
      
  print(output)


if __name__ == "__main__":
  list_N_M = input().split(' ')
  N = int(list_N_M[0])
  M = int(list_N_M[1])
  
  list_str_H_all = input().split(' ')
  H = [0] * N
  for i in range(len(list_str_H_all)):
    H[i] = int(list_str_H_all[i])
  
  is_good_vp = [True] * N
  
  for _ in range(M):
    str_A_B = input().split(' ')
    A = int(str_A_B[0])
    B = int(str_A_B[1])
    
    if H[A-1] > H[B-1]:
      is_good_vp[B-1] = False
    elif H[B-1] > H[A-1]:
      is_good_vp[A-1] = False
    else:
      is_good_vp[A-1] = False
      is_good_vp[B-1] = False
    
  output = 0
  for i in range(N):
    if is_good_vp[i]:
      output += 1
      
  print(output)


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())
H=list(map(int,input().split()))
l=[0]*N
nice=0
for i in range(M):
    A,B=map(int,input().split())
    A-=1
    B-=1
    if l[A] == 0:
        l[A] = B
        nice += 1
        if l[B]==0:
            l[B] = -1
    elif l[A] == -1:
        l[A] = B
        if l[B]==0:
            l[B] = -1
    elif H[l[A]] < H[B]:
        l[A] = B
print(nice+l.count(0))

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

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()))
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

newg=[]
for j in graph:
    
    newg.append(set(j))


for index,i in enumerate(newg):
    judge=0
    for j in i:
        print(index , j,ans)
        if h[index] >= h[j]:
            judge=1
        if h[index] < h[j]:
            judge=0
            break
    if judge==1:
        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 index,i in enumerate(graph):
    judge=1
    for j in i:
        if h[index] <= h[j]:
            judge=0
            break
    if judge==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 = list(map(int, input().split()))
pairs = [list(map(int, input().split())) for _ in range(m)]

ans = [1] * n

for i in range(m):
    if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
    elif f h[pairs[i][0] - 1] = h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
        ans[pairs[i][1] - 1] = 0 
    else:
        ans[pairs[i][1] - 1] = 0      

print(sum(ans))

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

ans = [-1] * n

for i in range(m):
    if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:
            ans[pairs[i][0] - 1] = 0
            if ans[pairs[i][1] - 1] != 0:
                ans[pairs[i][1] - 1] = 1
    else:
        if ans[pairs[i][0] - 1] !=0:
            ans[pairs[i][0] - 1] = 1
        ans[pairs[i][1] - 1] = 0      
    print(ans)
for i in range(n):
    if ans[i] == -1:
        ans[i] = 1
print(ans)
print(sum(ans))

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

ans = [1] * n

for i in range(m):
    if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
    elif h[pairs[i][0] - 1] = h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
        ans[pairs[i][1] - 1] = 0 
    else:
        ans[pairs[i][1] - 1] = 0      

print(sum(ans))

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

ans = [1] * n

for i in range(m):
    if h[pairs[i][0] - 1] < h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
    elif h[pairs[i][0] - 1] == h[pairs[i][1] - 1]:
        ans[pairs[i][0] - 1] = 0
        ans[pairs[i][1] - 1] = 0 
    else:
        ans[pairs[i][1] - 1] = 0      

print(sum(ans))

Verdicts: 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):
n,m = map(int,input().split())
h = list(map(int,input().split()))

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

ans = []

for i in range(m):
    if h[a[i][0]-1] < h[a[i][1]-1]:
        ans.append(a[i][0]-1)
    else:
        ans.append(a[i][1]-1)
    
ans = set(ans)
ans = int(len(h)) - int(len(ans))

print(h)
print(a)
print(ans)

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

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

ans = []

for i in range(m):
    if h[a[i][0]-1] > h[a[i][1]-1]:
        ans.append(a[i][1])
    elif h[a[i][0]-1] < h[a[i][1]-1]:
        ans.append(a[i][0])
    if h[a[i][0]-1] == h[a[i][1]-1]:
        ans.append(a[i][0])
        ans.append(a[i][1])
        

ans = set(ans)

print(int(len(h)) - int(len(ans)))
#2,3,5

1,4,4

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,_),h,*t=[[*map(int,t.split())]for t in open(0)]
p=[1]*n
for a,b in t:p[-a]&=h[a]>h[b];p[-b]&=h[b]>h[a]
print(sum(p))

n,h,*t=[[*map(int,t.split())]for t in open(0)]
p=[1]*n[0]
for a,b in t:x,y=h[a-1],h[b-1];p[-a]&=x>y;p[-b]&=y>x
print(sum(p))

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 = [int(i) for i in input().split()]

load = [list(map(int, input().split())) for _ in range(m)]

result = {i: 0 for i in range(n)}

for l in load:
    a, b = l[0]-1, l[1]-1
    #print(a,b)
    if h[a] < h[b]:
        result[b] += 1

#print(result)
print(sum(result.values()))

n, m = map(int, input().split())
h = [int(i) for i in input().split()]
load = [list(map(int, input().split())) for _ in range(m)]
result = {i: 1 for i in range(n)}

for l in load:
    a, b = l[0] - 1, l[1] - 1
    if h[a] < h[b]:
        result[a] = 0
    elif h[a] > h[b]:
        result[b] = 0
    elif h[a] == h[b]:
        result[a] = 0
        result[b] = 0

print(sum(result.values()))

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()))
results = []
resultsSet = set()
for i in range(M):
    A, B = map(int, input().split())
    setAB = set([A, B])
    if resultsSet.isdisjoint(setAB):
        results.append(setAB)
        resultsSet = resultsSet | setAB
    else:
        resultsSet = resultsSet | setAB
        for result in results:
            if not result.isdisjoint(set([A])):
                result.add(A)
                break
            if result.isdisjoint(set([B])):
                result.add(B)
                break

naimono = N - len(resultsSet)
result_conunt = len(results)
#print(list(resultsSet), results)

print(naimono + result_conunt)


N, M = map(int, input().split())
H = list(map(int, input().split()))
routes = dict()
for i in range(M):
    A, B = map(int, input().split())
    if routes.get(A) is None:
        routes[A] = set([B])
    else:
        routes[A].add(B)
    if routes.get(B) is None:
        routes[B] = set([A])
    else:
        routes[B].add(A)

#print(routes)
answer = 0
for i in range(1, N + 1):
    if routes.get(i) is None:
        answer += 1
    else:
        tmp = 0
        for j in routes.get(i):
            tmp = max(tmp, H[j - 1])
        if H[i - 1] > tmp:
            answer += 1
print(answer)

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()))
count = 0
for _ in range(M):
    A, B = map(int,input().split())
    if H[B-1] < H[A-1]:
        count +=1
    if H[B-1] > H[A-1]:
        count +=1
print(count)

N, M = map(int,input().split())
H = list(map(int,input().split()))
l = []
count = 0
for _ in range(M):
    A, B = map(int,input().split())
    if B in l:
        if A not in l:
            if H[A-1] < H[B-1]:
                count +=1
    if A in l:
        if B not in l:
            if H[A-1] > H[B-1]:
                count +=1
    l.append(A)
    l.append(B)
print(count)

N, M = map(int,input().split())
H = list(map(int,input().split()))
count = 0
for _ in range(M):
    A, B = map(int,input().split())
    if H[B-1] > H[A-1]:
        count +=1
print(count)

N, M = map(int,input().split())
H = list(map(int,input().split()))
ans = [0]*N
for _ in range(M):
    A, B = map(int,input().split())
    if H[A-1] >= H[B-1]:
        ans[B-1] = 1
    if H[A-1] <= H[B-1]:
        ans[A-1] = 1
print(ans.count(0))

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()))
X=[[0] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  X[a-1].append(b)
  X[b-1].append(a)
t=0
for i in range(n):
  E=list(H[k-1] for k in X[i])
  if max(E) < H[i]:
    t+=1
print(t)

n, m = map(int, input().split())
H = list(map(int, input().split()))
X=[[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  X[a-1].append(b)
  X[b-1].append(a)
t=0
for i in range(n):
  E=[0]+list(H[k-1] for k in X[i])
  if max(E) < H[i]:
    t+=1
print(t)

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()))
heights = list(map(int, input().split()))
flags = [True] * n
count = 0
for _ in range(m):
  roots = list(map(int, input().split()))
  if heights[roots[0] - 1] > heights[roots[1] - 1]:
    flags[roots[1] - 1] = False
  elif heights[roots[0] - 1] < heights[roots[1] - 1]:
    flags[roots[0] - 1] = False
  else:
    flags[roots[1] - 1] = False
    flags[roots[0] - 1] = False
for flag in flags:
  if flag:
    count += 1

n, m = list(map(int, input().split()))
heights = list(map(int, input().split()))
flags = [True] * n
count = 0
for _ in range(m):
  roots = list(map(int, input().split()))
  if heights[roots[0] - 1] > heights[roots[1] - 1]:
    flags[roots[1] - 1] = False
  elif heights[roots[0] - 1] < heights[roots[1] - 1]:
    flags[roots[0] - 1] = False
  else:
    flags[roots[1] - 1] = False
    flags[roots[0] - 1] = False
for flag in flags:
  if flag:
    count += 1
print(count)

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().rstrip().split())
h = map(int, input().rstrip().split())
l = []
high = [0] * n
count = 0

for i in range(m):
    a, b = map(int, input().rstrip().split())
    l.append([a, b])

for i in l:
    if h[i[0]-1] < h[i[1]-1]:
        high[i[0]-1] += 1
    elif h[i[0]-1] == h[i[1]-1]:
        high[i[0]-1] += 1
        high[i[1]-1] += 1
    else:
        high[i[1]-1] += 1

for hi in high:
    if hi == 0:
        count += 1
print(count)

n, m = map(int, input().rstrip().split())
h = list(map(int, input().rstrip().split()))
l = []
high = [0] * n
count = 0

for i in range(m):
    a, b = map(int, input().rstrip().split())
    l.append([a, b])

for i in l:
    if h[i[0]-1] < h[i[1]-1]:
        high[i[0]-1] += 1
    elif h[i[0]-1] == h[i[1]-1]:
        high[i[0]-1] += 1
        high[i[1]-1] += 1
    else:
        high[i[1]-1] += 1

for hi in high:
    if hi == 0:
        count += 1
print(count)

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())
h=list(map(int,input().split()))
tall=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  tall[a]=max(tall[a],h[b])
  tall[b]=max(tall[b],h[a])
res=0
for i in range(n):
  if h[i]>tall[i]:
    res+=1
print(res)

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

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

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

Verdicts: 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):
n,m = map(int, input().split())
height = list(map(int, input().split()))
roads = [list(map(int, input().split())) for i in range(m)]

bestcount = 0

for i in range(n):
    best = 1 
    for j in range(m):
        if (roads[j][0] == i):
            a = roads[j][0]
            b = roads[j][1]
            if (height[a] <= height[b]):
                best = 0
                break
        if (roads[j][1] == i):
            a = roads[j][1]
            roads[j][0] == b
            if (height[a] <= height[b]):
                best = 0
                break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

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

bestcount = 0

print(height)
print(roads)

for i in range(n):
    best = 1 
    for j in range(m):
        if (roads[j][0] == i):
            a = roads[j][0]
            b = roads[j][1]
            if (height[a] <= height[b]):
                best = 0
                break
        if (roads[j][1] == i):
            a = roads[j][1]
            b = roads[j][0]
            if (height[a] <= height[b]):
                best = 0
                break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

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

roads = [[] for i in range(n)]
for i in range(m):
    x,y = map(int, input().split())
    roads[x-1].append(y-1)
    roads[y-1].append(x-1)

print(roads)

bestcount = 0

for i in range(n):
    best = 1 
    for j in roads[i]:
        if (height[j] >= height[i]):
            best = 0
            break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

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

roads = [[] for i in range(n)]
for i in range(m):
    x,y = map(int, input().split())
    roads[x-1].append(y-1)
    roads[y-1].append(x-1)

bestcount = 0

for i in range(n):
    best = 1 
    for j in roads[i]:
        if (height[j] >= height[i]):
            best = 0
            break
    if(best == 1):
        bestcount += 1

print(str(bestcount))

Verdicts: Runtime Error

Runtime Error

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, K = map(int, input().split())

H = input().split()
H2 = [0] * N
for i in range(K):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        H2[b-1] = 1
    elif H[a-1] < H[b-1]:
        H2[a-1] = 1
    elif H[a-1] == H[b-1]:
        H2[b-1] = 1
        H2[a-1] = 1

count = 0
for i in H2:
    if i == 0:
        count+=1
print(count, end = "")

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

H = input().split()
H2 = [0] * N
for i in range(K):
    a, b = map(int, input().split())
    if int(H[a-1]) > int(H[b-1]):
        H2[b-1] = 1
    elif int(H[a-1]) < int(H[b-1]):
        H2[a-1] = 1
    elif int(H[a-1]) == int(H[b-1]):
        H2[b-1] = 1
        H2[a-1] = 1
count = 0
for i in H2:
    if i == 0:
        count+=1
print(count)

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 re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

N = k()
count = 0
for i in range(1,N+1):
    t = N//i
    count += i * t*(t+1)/2
print(int(count))


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

N, M = I()
H = l()
good = [1]*N
for k in range(M):
    A, B = map(int, input().split())
    if H[A - 1] >= H[B - 1]:
        good[B - 1] = 0
    if H[A - 1] <= H[B - 1]:
        good[A - 1] = 0
print(sum(good))



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())

high_list = list(map(int, input().split()))
check_list = [1]*N

for i in range(M):
  a_, b_ = map(int, input().split())
  if high_list[a_-1] < high_list[b_-1]:
    check_list[a_-1] = 0
  elif high_list[a_-1] > high_list[b_-1]:
    check_list[b_-1] = 0
  elif high_list[a_-1] == high_list[b_-1]:
    check_list[a_-1] = 0
    check_list[b_-1] = 0

print(len(check_list))

N, M = map(int, input().split())
 
high_list = list(map(int, input().split()))
check_list = [1]*N
 
for i in range(M):
  a_, b_ = map(int, input().split())
  if high_list[a_-1] < high_list[b_-1]:
    check_list[a_-1] = 0
  elif high_list[a_-1] > high_list[b_-1]:
    check_list[b_-1] = 0
  elif high_list[a_-1] == high_list[b_-1]:
    check_list[a_-1] = 0
    check_list[b_-1] = 0
 
print(sum(check_list))

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, B = [], []
for i in range(m):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
tmp = [0] * n
cnt = [0] * n

num = []
res = 0
for i in range(1, n+1):
    if i not in A and i not in B:
        num.append(i)

for i in range(m):
    print("i",i)
    if H[A[i]-1] >= H[B[i]-1]:
        print(H[A[i]-1])
        tmp[A[i]-1] += 1
        cnt[A[i]-1] += 1
        cnt[B[i]-1] += 1
    elif H[A[i]-1] < H[B[i]-1]:
        print(H[B[i]-1])
        tmp[B[i]-1] += 1
        cnt[A[i]-1] += 1
        cnt[B[i]-1] += 1

print(tmp)
print(cnt)

for i in range(n):
    if tmp[i] == cnt[i] and tmp[i] != 0:
        res += 1
print(res+len(num))

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

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

print(ans)

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):
h = [int(x) for x in input().split()]
l = [1] * n
for i in range(m):
	a, b = map(int, input().split())
	if h[a-1] >= h[b-1]:
		l[b-1] = 0
	if h[b-1] >= h[a-1]:
		l[a-1] = 0
print(sum(l))

n, m = map(int, input().split())
h = [int(x) for x in input().split()]
l = [1] * n
for i in range(m):
	a, b = map(int, input().split())
	if h[a-1] >= h[b-1]:
		l[b-1] = 0
	if h[b-1] >= h[a-1]:
		l[a-1] = 0
print(sum(l))

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()))

l = [0] * N

for i in range(M):
  A,B = map(int,input().split())
  if h[A-1] > h[B-1]:
    l[B - 1] = 0
  elif H[A - 1] < H[B - 1]:
    l[A - 1] = 0
  elif H[A - 1] == H[B - 1]:
    l[A - 1], l[B - 1] = 0, 0
print(l.count(1))

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

l = [1] * N

for i in range(M):
  A,B = map(int,input().split())
  if h[A-1] > h[B-1]:
    l[B - 1] = 0
  elif H[A - 1] < H[B - 1]:
    l[A - 1] = 0
  elif H[A - 1] == H[B - 1]:
    l[A - 1], l[B - 1] = 0, 0
print(l.count(1))


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

l = [1] * N

for i in range(n):
  A,B = map(int,input().split())
  if H[A-1] > h[B-1]:
    l[B - 1] = 0
  elif H[A - 1] < H[B - 1]:
    l[A - 1] = 0
  elif H[A - 1] == H[B - 1]:
    l[A - 1], l[B - 1] = 0, 0
print(l.count(1))


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

l = [1] * n

for i in range(n):
  A,B = map(int,input().split())
  if H[A-1] > H[B-1]:
    l[B - 1] = 0
  elif H[A - 1] < H[B - 1]:
    l[A - 1] = 0
  elif H[A - 1] == H[B - 1]:
    l[A - 1], l[B - 1] = 0, 0
print(l.count(1))


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


Verdicts: 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):
import sys

lines = sys.stdin.readlines()

X = lines[0].split(' ')
N = int(X[0])
M = int(X[1])

H = []
Y = [0 for j in range(N)]
Z =[0]*N

for i in range(N):
    H.append(lines[1].split(' ')[i])

for j in range(M):
    A = int(lines[j+2].split(' ')[0])
    B = int(lines[j+2].split(' ')[1])
    if Y[A-1] < int(H[B-1]):
      Y[A-1] = int(H[B-1])
    if Y[B-1] < int(H[A-1]):
      Y[B-1] = int(H[A-1])

print(1)      


import sys

lines = sys.stdin.readlines()

X = lines[0].split(' ')
N = int(X[0])
M = int(X[1])

H = []
Y = []*2

for i in range(N):
    H.append(int(lines[1].split(' ')[i]))

for j in range(M):
    A = int(lines[j+2].split(' ')[0])
    B = int(lines[j+2].split(' ')[1])
    Y.append([A,B])

Y.sort()


import sys

lines = sys.stdin.readlines()

X = lines[0].split(' ')
N = int(X[0])
M = int(X[1])

H = []
Y = []

for i in range(N):
    H.append(int(lines[1].split(' ')[i]))

for j in range(M):
    A = int(lines[j+2].split(' ')[0])
    B = int(lines[j+2].split(' ')[1])
    if int(H[A-1]) <= int(H[B-1]):      
      Y.append(A-1)
    if int(H[B-1]) <= int(H[A-1]):
      Y.append(B-1)


import sys

lines = sys.stdin.readlines()

X = lines[0].split(' ')
N = int(X[0])
M = int(X[1])

H = []
Y = []*2

for i in range(N):
    H.append(int(lines[1].split(' ')[i]))

import sys

lines = sys.stdin.readlines()

X = lines[0].split(' ')
N = int(X[0])
M = int(X[1])

H = []
Y = []

H=lines[1].split(' ')

for j in range(M):
    A = int(lines[j+2].split(' ')[0])
    B = int(lines[j+2].split(' ')[1])
    if int(H[A-1]) <= int(H[B-1]):      
      Y.append(A-1)
    if int(H[B-1]) <= int(H[A-1]):
      Y.append(B-1)
Z = len(set(Y))
print(N-Z)


Verdicts: Wrong Answer

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()))
c=[]
d=[]
e=[]
f=[]

for i in range(M):
  A,B=map(int,input().split())
  d.append(A)
  d.append(B)
  if H[A-1]>H[B-1]:
    c.append(A)
    e.append(B)
  elif H[B-1]>H[A-1]:
    c.append(B)
    e.append(A)

for k in range(1,N+1):
  if (k in c) and (k not in e):
    f.append(k)
    

for j in range(1,N+1):
  if j not in d:
    f.append(j)
    

    
print(len(f))




D=set(d)

for j in range(1,N+1):
  if j not in D:
    c.append(j)
    
print(len(set(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())
    if H[a-1] == H[b-1]:
        g += [a, b]
    if H[a-1] > H[b-1]:
        g += [b]
    else:
        g += [a]

g = set(g)
r = N - len(g)
print(r)


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) = input().split()
N = int(N)
M = int(M)
h = list(map(int,input().split()))
y = [0] * N
for i in range (M):
    A,B = map(int,input().split())
    if h[A -1] >= h[B -1]:
        y[B -1] += 1
    if h[B -1] >= h[a -1]:
        y[A -1] += 1
print(y.count(0))

(N,M) = input().split()
N = int(N)
M = int(M)
h = list(map(int,input().split()))
y = [0] * N
for i in range (M):
    A,B = map(int,input().split())
    if h[A -1] >= h[B -1]:
        y[B -1] += 1
    if h[B -1] >= h[a -1]:
        y[A -1] += 1
print(y.count(0))

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

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())
H = list(map(int, input().split()))

L = [0 for in range(N+1)]

for q in range(M):
  A, B = map(int, input().split())
  if H[A] < H[B]:
    L[A] += 1
  elif H[A] > H[B]:
    L[B] += 1
  else:
    L[A] += 1
    L[B] += 1
    
ans = 0
for i in range(1,N+1):
  if L[i] == 0:
    ans += 1
print(ans)


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

L = [0 for i in range(N+1)]

for q in range(M):
  A, B = map(int, input().split())
  if H[A-1] < H[B-1]:
    L[A] += 1
  elif H[A-1] > H[B-1]:
    L[B] += 1
  else:
    L[A] += 1
    L[B] += 1
    
ans = 0
for i in range(1,N+1):
  if L[i] == 0:
    ans += 1
print(ans)


Verdicts: Runtime Error

Accepted