TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
#coding:utf-8

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

sunuke = ["{}".format(i) for i in range(1,n+1)]

for i in range(k):
    d = int(input())
    a = input().split()
    for i in a:
        if i in sunuke:
            sunuke.remove(i)
    print(sunuke)

ans = len(sunuke)

print("{}".format(ans))

#coding:utf-8

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

sunuke = ["{}".format(i) for i in range(1,n+1)]

for i in range(k):
    d = int(input())
    a = input().split()
    for i in a:
        if i in sunuke:
            sunuke.remove(i)

ans = len(sunuke)

print("{}".format(ans))

Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
# B Trick or Treat

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

sunuke = [0] * N
for i in k:
  d = int(input())
  a = list(map(int, input().split()))
  for ai in a:
    sunuke[ai-1] += 1
print(sunuke.count(0))
  
  

# B Trick or Treat

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

sunuke = [0] * N
for i in range(K):
  d = int(input())
  a = list(map(int, input().split()))
  for ai in a:
    sunuke[ai-1] += 1
print(sunuke.count(0))

Verdicts: Runtime Error

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
import itertools
N,K = map(int, input().split())
c = []
for i in range(K):
	a = int(input())
	b=list(map(int,input().split()))
	c.append(b)
f = list(itertools.chain.from_iterable(c))
d = []
for i in range(1,N+1):
	e =  i in f
	if e  == False:
		d.append(i)
length = len(d)
for i in range(length):
	print(d[i])


import itertools
N,K = map(int, input().split())
c = []
for i in range(K):
	a = int(input())
	b=list(map(int,input().split()))
	c.append(b)
f = list(itertools.chain.from_iterable(c))
d = []
for i in range(1,N+1):
	e =  i in f
	if e  == False:
		d.append(i)
length = len(d)
print(length)


Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  lists.append(list)
num=[0]*n
for list in lists:
  for __ in range(len(list)):
    num[list[__]-1]+=1
count=0
for nn in num:
  if nn==0:
    count+=1
print(count)

n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  list.append(list)
num=[0]*n
for list in lists:
  for __ in range(len(list)):
    num[list[__]-1]+=1
count=0
for nn in num:
  if nn==0:
    count+=1
print(count)

n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
ans=[0]*n
for list in lists:
  for i in range(len(list)):
    ans[list[i]-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1

n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=input()
  if d==1:
    list=[int(input())]
  else:
    list=list(map(int,input().split()))
  lists.append(list)
ans=[0]*n
for list in lists:
  for i in range(1,len(list)+1):
    ans[i-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=input()
  list=list(map(int,input().split()))
  lists.append(list)
ans=[0]*n
for list in lists:
  for i in range(1,len(list)+1):
    ans[i-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  lists.append(a)
num=[0]*n
for list in lists:
  for __ in range(len(list)):
    num[list[__]-1]+=1
count=0
for nn in num:
  if nn==0:
    count+=1
print(count)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
n,k = map(int,input().split())
sunuke = list(range(1,n+1))
i = 0
kashi_sunuke = []
d = ''
while i < k:
  d = input()
  okashi = list(map(int,input().split()))
  kashi_sunuke += okashi
  i+=1

o = list(set(sunuke) - set(kashi_sunuke))
print('o', o, len(o))


n,k = map(int,input().split())
sunuke = list(range(1,n+1))
i = 0
kashi_sunuke = []
d = ''
while i < k:
  d = input()
  okashi = list(map(int,input().split()))
  kashi_sunuke += okashi
  i+=1

o = list(set(sunuke) - set(kashi_sunuke))
print(len(o))

Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
N,K=map(int,input().split())
a=[list(map(int,input().split()))for i in range(2*K)]
sunuke=[]
for i in range(2*K):
    if i%2==1:
        d=sum(a[i-1])
        for n in range(d):
            sunuke.append(a[i][n])
print(sunuke)
sunuke=set(sunuke)
print(N-len(sunuke))

N,K=map(int,input().split())
a=[list(map(int,input().split()))for i in range(2*K)]
sunuke=[]
for i in range(2*K):
    if i%2==1:
        d=sum(a[i-1])
        for n in range(d):
            sunuke.append(a[i][n])
sunuke=set(sunuke)
print(N-len(sunuke))

Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

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

a = [0] * n
print(a)
for w in range(k):
    d = int(input())
    ds = list(map(lambda x:int(x),input().split()))
    for i in ds:
        a[i-1] = 1

print(len(list(filter(lambda x:x==0,a))))



n,k=list(map(lambda x:int(x),input().split()))

a = [0] * n
for w in range(k):
    d = int(input())
    ds = list(map(lambda x:int(x),input().split()))
    for i in ds:
        a[i-1] = 1

print(len(list(filter(lambda x:x==0,a))))



Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
#--Trick or Treat
import itertools

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

A = []
judge = list(range(1,N+1))
for i in range(K):
  d = int(input())
  A.append([int(i) for i in input().split()])

allocate = list(itertools.chain.from_iterable(A))
#print(judge)


l1_l2_sym_diff = []
l1_l2_sym_diff = set(allocate) ^ set(judge)
print(l1_l2_sym_diff)



#--Trick or Treat
import itertools

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

A = []
judge = list(range(1,N+1))
for i in range(K):
  d = int(input())
  A.append([int(i) for i in input().split()])

allocate = list(itertools.chain.from_iterable(A))
#print(judge)


l1_l2_sym_diff = []
l1_l2_sym_diff = set(allocate) ^ set(judge)
print(len(l1_l2_sym_diff))



Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
N,K = map(int,input().split())
D = []
for k in range(0,K):
    d = int(input())
    D.append(d)
    a = list(map(int, input().split()))

for i in range(1,N+1):
    x = a.count(i)
    if x >= 2:
        for n in range(1,x):
            a.remove(i)

print(N - len(a))

N,K = map(int,input().split())
D = []
A = []
for k in range(1,K+1):
    d = int(input())
    D.append(d)
    a = list(map(int, input().split()))
    for n in a:
        A.append(n)

for i in range(1,N+1):
    x = A.count(i)
    if x >= 2:
        for n in range(1,x):
            A.remove(i)

print(N - len(A))

Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
def main():
  s = list(map(int,input().split()))
  n = [0]*s[0]
  for k in range(0,s[1],1):
    d = int(input())
    a = list(map(int,input().split()))
    #print(a)
    for i in range(0,d,1):
      #print(a[i])
      n[a[i]-1] = 1
      #print(n)
      
  sum=0
  print(n)
  
  for k in range(0,s[0],1):  
    if(n[k]==0): sum = sum+1
 
  print(sum)
  
main()

def main():
  s = list(map(int,input().split()))
  n = [0]*s[0]
  for k in range(0,s[1],1):
    d = int(input())
    a = list(map(int,input().split()))
    #print(a)
    for i in range(0,d,1):
      #print(a[i])
      n[a[i]-1] = 1
      #print(n)
      
  sum=0
  #print(n)
  
  for k in range(0,s[0],1):  
    if(n[k]==0): sum = sum+1
 
  print(sum)
  
main()

Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):

N,K = int(input())

d_list = []
A_list_list = []
for i in range(K):
  
  d = int(input())
  d_list.append(d)
  
  A_list = list(map(int, input().split()))
  A_list_list.append(A_list)
  
counter = 0
for i in range(N):
  if((i+1 in A_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)
  



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

d_list = []
A_list_list = []
for i in range(K):
  
  d = int(input())
  d_list.append(d)
  
  A_list = list(map(int, input().split()))
  A_list_list.append(A_list)
  
counter = 0
for i in range(N):
  if((i+1 in A_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)
  




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

d_list = []
A_list_list = []
for i in range(K):
  
  d = int(input())
  d_list.append(d)
  
  A_list = list(map(int, input().split()))
  #print(A_list)
  A_list_list.extend(A_list)
#print(A_list)
counter = 0
for i in range(N):
  if((i+1 in A_list_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
N,K=map(int,input().split())
ans=list()
for i in range(K):
  D=int(input())
  L=list(map(int,input(),split()))
  ans+=L
  ans=list(set(ans))
print(N-len(ans))

N,K=map(int,input().split())
ans=list()
for i in range(K):
  D=int(input())
  L=list(map(int,input().split()))
  ans+=L
  ans=list(set(ans))
print(N-len(ans))

Verdicts: Runtime Error

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    for ai in a:
        n.remove(ai)
print(len(n))

n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    print(a)
    for ai in a:
        n.remove(ai)
print(len(n))



n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    for ai in a:
        for ni in n:
            if ai == ni:
                n.remove(ai)
print(len(n))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
(n, k) = [int(x) for x in input().split()]

s = set()

for i in range(k):
    input()
    s |= set(input().split)
    
print(n-len(s))


(n, k) = [int(x) for x in input().split()]

s = set()

for i in range(k):
  input()
  s |= set(input().split)
    
print(n-len(s))


(n, k) = [int(x) for x in input().split()]

s = set()

for i in range(k):
	input()
    s |= set(input().split)
    
print(n-len(s))

(n, k) = [int(x) for x in input().split()]

s = set()

for i in range(k):
    input()
    s |= set(input().split())
    
print(n-len(s))


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(int(N) - set(wahtMan).count)

whatMan = []

N, K = input()
for i in range(1, K):
    wahtMan.append(input().split())
print(N - set(wahtMan).count)

whatMan = []
 
N, K = input().split()
for i in range(int(K)):
    wahtMan.append(input().split())
print(wahtMan)

whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(int(N) - len(set(whatMan)))

whatMan = []
 
N, K = input()
for i in range(int(K)):
　　　　wahtMan.append(input().split())
print(wahtMan)

whatMan = []

N, K = input().split()
for i in range(int(K)):
    wahtMan.extend(input().split())
print(wahtMan)

whatMan = []

N, K = input()
for i in range(int(K)):
    wahtMan.append(input().split())

print(int(N) - set(wahtMan).count)

whatMan = []
 
N, K = input()
for i in range(int(K)):
    wahtMan.append(input().split())
print(wahtMan)

whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(whatMan)

whatMan = []

N, K = input().split()
wahtMan.extend(input().split())
print(wahtMan)

whatMan = []
 
N, K = input().split()
print(N)

whatMan = []

N, K = input().split()
print(input().split())

whatMan = []

N, K = input().split()
for i in range(int(K)):
    wahtMan.append(input().split())
print(wahtMan)

whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(int(N) - set(whatMan).count)

whatMan = []

N, K = input().split()
for i in range(int(K)):
    print(input().split())

whatMan = []

N, K = input().split()
for i in range(int(K)):
    input()
    whatMan.extend(input().split())
print(int(N) - len(set(whatMan)))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
N, K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()  # ignore
  for j in map(int, input().split(" ")):
    flag[j - 1] = 0
sum(flag)


N, K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()  # ignore
  for j in map(int, input().split(" ")):
    flag[j - 1] = 0
print(sum(flag))


Verdicts: Wrong Answer

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
N, K = map(int, input().split())
d = []
A = []
safe = []
ubsafe = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

for _ in range(K-1):
    for p in range(d[K-1]-1):
        safe.append(A[_][p])
        
L = len(list(set(safe)))
print(N-L)


N, K = map(int, input().split())
d = []
A = []
safe = []
ubsafe = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

for _ in range(K-1):
    for p in range(d[K-1]):
        safe.append(A[_][p])
        
L = len(list(set(safe)))
print(N-L)


N, K = map(int, input().split())
d = []
A = []

for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

Alist = [e for row in A for e in row]
        
L = len(list(set(Alist)))
print(N-L)



Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N _Snukes_ called Snuke 1, Snuke 2, ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Submission attempts (in order):
n, k = map(int, input().split())
snuke = []
for _ in range(k):
    okashi = int(input())
    snuke += [int(v) for v in input().split()]
target = 1
for j in range(len(snuke)):
    if j + 1 != target:
        print(j + 1)
        break

n, k = map(int, input().split())
snukes = []
for _ in range(k):
    okashi = int(input())
    snukes += [int(v) for v in input().split()]
target = 1
cnt = 0
l = list(set(snukes))
s = [int(v) for v in range(1, n + 1)]

for p in s:
    if p not in l:
        cnt += 1
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):
import collections

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

X = []
for i in range(M):
    Aj, Bj = map(int,input().split())
    if H[Aj - 1] < H[Bj - 1]:
       X.append(Aj)
    elif H[Bj - 1] < H[Aj - 1]:
       X.append(Bj)
    elif H[Aj - 1] == H[Bj - 1]:
        X.append(Aj)
        X.append(Bj)

low_H = collections.Counter(X)
ans = N - len(low_H)
print(ans)


import collections

N, M = map(int,input().split())
H = [int(i) for i in input().split()]

X = []
for i in range(M):
    Aj, Bj = map(int,input().split())
    if H[Aj - 1] < H[Bj - 1]:
       X.append(Aj)
    elif H[Bj - 1] < H[Aj - 1]:
       X.append(Bj)
    elif H[Aj - 1] == H[Bj - 1]:
        X.append(Aj)
        X.append(Bj)

low_H = collections.Counter(X)
ans = N - len(low_H)
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):
from heapq import heappush, heappop


def main():

    N, M = [int(v) for v in input().split()]

    H = [int(v) for v in input().split()]
    link = [0] * N

    for _ in range(M):
        a, b = [int(v) - 1 for v in input().split()]
        link[a] = max(link[a], H[b])
        link[b] = max(link[b], H[a])

    count = 0
    for h, nh in zip(H, link):
        print(h, nh)
        if h > nh:
            count += 1
    print(count)


main()


from heapq import heappush, heappop


def main():

    N, M = [int(v) for v in input().split()]

    H = [int(v) for v in input().split()]
    link = [0] * N

    for _ in range(M):
        a, b = [int(v) - 1 for v in input().split()]
        link[a] = max(link[a], H[b])
        link[b] = max(link[b], H[a])

    count = 0
    for h, nh in zip(H, link):
        if h > nh:
            count += 1
    print(count)


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):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = [1] * n
for i in range(m):
    ai, bi = map(int, input().split()) 
    ab[i] = ai
    ab[i+m] = bi
    if h[ai-1] >= h[bi-1]:
        ans[bi-1] = 0
    elif h[ai-1] < h[bi-1]:
        ans[ai-1] = 0
print(sum(ans))

n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = [1] * n
for i in range(m):
    ai, bi = map(int, input().split()) 
    if h[ai-1] >= h[bi-1]:
        ans[bi-1] = 0
    if h[ai-1] <= h[bi-1]:
        ans[ai-1] = 0
print(sum(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):
i = input()
i = i.split(' ')
l = []
while len(l)<int(i[0]):
  l += [0]

lim = int(i[1])

i = input()
i = i.split(' ')
for j in list(range(len(l))):
    i[j]=int(i[j])
print(i)

count=0
while count<lim:
    count += 1
    k = input()
    k = k.split(' ')
    if i[int(k[0])-1]==i[int(k[1])-1]:
        l[int(k[1])-1] = 1
        l[int(k[0])-1] = 1
    elif i[int(k[0])-1]>i[int(k[1])-1]:
        l[int(k[1])-1] = 1
    else:
        l[int(k[0])-1] = 1

count = 0
for j in l:
    if j==0:
        count += 1
print(count)
  


i = input()
i = i.split(' ')
l = []
while len(l)<int(i[0]):
  l += [0]

lim = int(i[1])

i = input()
i = i.split(' ')
for j in list(range(len(l))):
    i[j]=int(i[j])


count=0
while count<lim:
    count += 1
    k = input()
    k = k.split(' ')
    if i[int(k[0])-1]==i[int(k[1])-1]:
        l[int(k[1])-1] = 1
        l[int(k[0])-1] = 1
    elif i[int(k[0])-1]>i[int(k[1])-1]:
        l[int(k[1])-1] = 1
    else:
        l[int(k[0])-1] = 1

count = 0
for j in l:
    if j==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):
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = [1]*n
for i in range(m):
    print(ans)
    a,b = map(int,input().split())
    if h[a-1]>h[b-1]:
        ans[b-1] = 0
    elif h[b-1]>h[a-1]:
        ans[a-1] = 0
    else:
        print("a")
        ans[a-1] = 0
        ans[b-1] = 0
print(ans.count(1))    

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

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

Verdicts: Wrong Answer

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()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
if height[x-1] >= height[y-1]:
    lst[x-1] = 1
if height[x-1] <= height[y-1]:
    lst[y-1] = 1
    print(lst.count(0))

n,m = map(int,input().split())
height = list(map(int,input().split()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
if height[x-1] >= height[y-1]:
    lst[y-1] = 1
if height[x-1] <= height[y-1]:
    lst[x-1] = 1
print(lst.count(0))

n,m = map(int,input().split())
height = list(map(int,input().split()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
if height[x-1] >= height[y-1]:
    lst[y-1] = 1
if height[x-1] <= height[y-1]:
    lst[x-1] = 1
    print(lst.count(0))

n,m = map(int,input().split())
height = list(map(int,input().split()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
    if height[x-1] >= height[y-1]:
        lst[y-1] = 1
    if height[x-1] <= height[y-1]:
        lst[x-1] = 1
print(lst.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())
heights = list(map(int,input().split()))
win = []

for i in range(1, N + 1):
  win.append(i)

for i in range(M):
  x, y = map(int, input().split())
  if heights[x - 1] > heights[y - 1]:
    del win[x - 1]
  elif heights[x - 1] < heights[y - 1]:
    del win[y - 1]

print(len(win))

N, M = map(int, input().split())
heights = list(map(int,input().split()))
lose = []

for i in range(M):
  x, y = map(int, input().split())
  if heights[x - 1] > heights[y - 1]:
    lose.append(y)
  elif heights[x - 1] < heights[y - 1]:
    lose.append(x)
  elif heights[x - 1] == heights[y - 1]:
    lose.append(y)
    lose.append(x)

print(N - len(list(set(lose))))

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(x) for x in input().split()]
a = [0] * m
b = [0] * m
for i in range(m):
    a[i],b[i] = map(int,input().split())
ind = []
for i in range(m):
    if h[a[i]-1] < h[b[i]-1]:
        ind.append(a[i])
    elif h[a[i]-1] == h[b[i]-1]:
        ind.append(a[i])
        ind.append(b[i])
    else:
        ind.append(b[i])
ind2 = [0] * n
for i in range(n):
    ind2[ind[i]-1] += 1
ans = 0
for i in range(n):
    if ind2[i] == 0:
        ans += 1
print(ans)

n,m = map(int,input().split())
h = [int(x) for x in input().split()]
a = [0] * m
b = [0] * m
for i in range(m):
    a[i],b[i] = map(int,input().split())
ind = []
for i in range(m):
    if h[a[i]-1] < h[b[i]-1]:
        ind.append(a[i])
    elif h[a[i]-1] == h[b[i]-1]:
        ind.append(a[i])
        ind.append(b[i])
    else:
        ind.append(b[i])
ind2 = [0] * n
for i in range(len(ind)):
    ind2[ind[i]-1] += 1
ans = 0
for i in range(n):
    if ind2[i] == 0:
        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):
import numpy as np
X=int(input())
flag=1
for c in range(np.power(10,9)):
    c+=1
    x=X
    if x%c==0:
        x=x//c
        for a in range(np.power(10,3)):
            if (np.power(a,4) + np.power(a,3)*(a-c) + np.power(a,2)*np.power(a-c,2) + a*np.power(a-c,3) + np.power(a-c,4))==x:
                print(a,a-c)
                flag=0
                break
    if flag==0:
        break

N, M = list(map(int, input().split()))
record = [1 for i in range(N)]
H = list(map(int, input().split()))
grid = []
for i in range(M):
    array = list(map(int, input().split()))
    grid.append(array)

for i in range(M):
    if H[grid[i][0]-1] > H[grid[i][1]-1]:
        record[grid[i][1]-1] = 0
    elif H[grid[i][0]-1] < H[grid[i][1]-1]:
        record[grid[i][0]-1] = 0
    elif H[grid[i][0]-1] == H[grid[i][1]-1]:
        record[grid[i][0]-1] = 0
        record[grid[i][1]-1] = 0

flag = 0
for i in range(N):
    if record[i] == 1:
        flag += 1
print(flag)


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(input()) for i in range(N)]

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

count = 0

dic = {}

for i in range(1, N):
  dic[i] = set()

for hen in V:
  dic[hen[0]].add(hen[1])
  dic[hen[1]].add(hen[0])

print(sum(all([H[i] > hs for hs in dic[i]]) for i in N))

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

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

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

count = 0

dic = {}

for i in range(1, N):
  dic[i] = set()

for hen in V:
  dic[hen[0]].add(hen[1])
  dic[hen[1]].add(hen[0])

print(sum(all([H[i] > hs for hs in dic[i]]) for i in range(N)))

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

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

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

count = 0

dic = {}

for i in range(1, N):
  dic[i] = set()

for hen in V:
  dic[hen[0]].add(hen[1])
  dic[hen[1]].add(hen[0])

print(sum(all([H[i] > hs for hs in dic[i]]) for i in N))

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

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

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

count = 0

dic = {}

for i in range(1, N+1):
  dic[i] = set()

for hen in V:
  dic[hen[0]].add(hen[1])
  dic[hen[1]].add(hen[0])

print(sum(all([H[i] > H[hs] for hs in dic[i]]) for i in range(1, N+1)))

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 = list(map(int, input().split()))
H = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

ans = [1] * (n)
route = [1] * (n)
for i in range(len(ab)):
    a, b = ab[i]
    if H[a-1] <= H[b-1]:
      ans[a-1] = 0

    elif H[b-1] <= H[a-1]:
      ans[b-1] = 0
    
print(sum(cnt))

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

ans = [1] * (n)
route = [1] * (n)
for i in range(len(ab)):
    a, b = ab[i]
    if H[a-1] <= H[b-1]:
      ans[a-1] = 0

    if H[b-1] <= H[a-1]:
      ans[b-1] = 0
    
print(sum(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):
import numpy as np

N, M = map(int, input().split())
H = [int(a) for a in input().split()]
good = np.zeros(N, dtype=int)
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    print(H[a], H[b])
    if H[a] > H[b]:
        good[b] += 1
    elif H[a] < H[b]:
        good[a] += 1

ans = 0
print(good)
for i in good:
    if i == 0:
        ans += 1
print(ans)


import numpy as np

N, M = map(int, input().split())
H = [int(a) for a in input().split()]
good = np.zeros(N, dtype=int)
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if H[a] > H[b]:
        good[b] += 1
    elif H[a] < H[b]:
        good[a] += 1
    else:
        good[a] += 1
        good[b] += 1

ans = 0
for i in good:
    if i == 0:
        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, readline().split())
h = list(map(int, readline().split()))

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

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

l = [1]*n
for i in range(m):
    a, b= map(int, readline().split())
    if h[a - 1] < h[b - 1]:
        l[a - 1] = 0
    elif h[a - 1] > h[b - 1]:
        l[b - 1] = 0
    else:
        l[a - 1] = 0
        l[b - 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()))
obs = []
j = []
for i in range(m):
    a, b = list(map(int, input().split()))
    j.append([a,b])

for i in j:
    if h[i[0]-1] > h[i[1]-1]:
        obs.append(h[i[0]-1]) 
    elif h[i[1]-1] > h[i[0]-1]:
        obs.append(h[i[1]-1])
print(obs) 
print(len(set(obs)))

n,m = map(int,input().split())
h = list(map(int, input().split()))
ok =[True] * n
for i in range(m):
    a, b = list(map(int,input().split()))
    if h[a-1] > h[b-1]:
        ok[b-1] = False
    elif h[b-1] > h[a-1]: 
        ok[a-1] = False
    else:
        ok[a-1] = False
        ok[b-1] = False
print(ok.count(True))

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):
list1=list(map(int,input().strip().split()))[:2]
n,m=list1[0],list1[1]
arr=list(map(int,input().strip().split()))[:n]
dict1={}
for i in range(m):
	l=list(map(int,input().strip().split()))[:2]
	key,val=l[0],l[1]
	if key in dict1:
		dict1[key].append(val)
	else:
		dict1[key]=[]
		dict1[key].append(val)
	if val in dict1:
		dict1[val].append(key)
	else:
		dict1[val]=[]
		dict1[val].append(key)
print(dict1)
count=0
for i in range(1,n+1):
	flag=0
	if i in dict1:
		l=arr[i-1]
		for j in dict1[i]:
			if(l <= arr[j-1]):
				flag=1
				break
	if(flag==0):
		count+=1
print(count)

list1=list(map(int,input().strip().split()))[:2]
n,m=list1[0],list1[1]
arr=list(map(int,input().strip().split()))[:n]
dict1={}
for i in range(m):
	l=list(map(int,input().strip().split()))[:2]
	key,val=l[0],l[1]
	if key in dict1:
		dict1[key].append(val)
	else:
		dict1[key]=[]
		dict1[key].append(val)
	if val in dict1:
		dict1[val].append(key)
	else:
		dict1[val]=[]
		dict1[val].append(key)
count=0
for i in range(1,n+1):
	flag=0
	if i in dict1:
		l=arr[i-1]
		for j in dict1[i]:
			if(l <= arr[j-1]):
				flag=1
				break
	if(flag==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):
n, m = map(int, input().split())
hs = list(map(int, input().split()))

edge = [[] for _ in range(n)]

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

print(edge)
cnt = 0

for node in range(n):
    good = True
    for neighbor in edge[node]:
        if hs[node] <= hs[neighbor]:
            good = False
    if good:
        cnt +=1

print(cnt)

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

for i in range(m):
    a, b = map(int,input().split())
    a -= 1
    b -= 1
    neighbor[a].append(h[b])
    neighbor[b].append(h[a])

for i in range(n):
    my_height = h[i]
    neighbor_height = neighbor[i]
    if all(my_height > x for x in neighbor_height):
        good += 1

print(good)

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()))
XX = [set() for i in range(N)]
ans = 0
for i in range(M):
  A,B = map(int,input().split())
  XX[A-1].add(B-1)
  XX[B-1].add(A-1)
  
for i in range(N):
  for y in XX[i]:
    r = True
    if H[i]<=H[y]:
      r = False
      break
    if r:
      ans += 1

print(ans)


N,M = map(int,input().split())
H = list(map(int,input().split()))
XX = [set() for i in range(N)]
ans = 0
for i in range(M):
  A,B = map(int,input().split())
  XX[A-1].add(B-1)
  XX[B-1].add(A-1)
  
for i in range(N):
  r = True
  for y in XX[i]:
    if H[i]<=H[y]:
      r = False
      break
    if r:
      ans += 1

print(ans)


N,M = map(int,input().split())
H = list(map(int,input().split()))
XX = [set() for i in range(N)]
ans = 0
for i in range(M):
  A,B = map(int,input().split())
  XX[A-1].add(B)
  XX[B-1].add(A)
  
for i in range(N):
  for y in XX[1]
  	if H[i]<=H[y]:
      break
    else:
      ans += 1
      
print(ans)

N,M = map(int,input().split())
H = list(map(int,input().split()))
AB = [set() for i in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    AB[A-1].add(B-1)
    AB[B-1].add(A-1)
ans = 0
for i in range(N):
    res = True
    for x in AB[i]:
        if H[i]<=H[x]:
            res = False
            break
    if res:
        ans += 1
print(ans)

Verdicts: Wrong Answer

Wrong Answer

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

cnt = 0

lose_flag = [0] * n
for j in range(m):
    if h[a[j]-1] < h[b[j]-1]:
        lose_flag[a[j]-1] = 1
    elif h[a[j]-1] > h[b[j]-1]:
        lose_flag[b[j]-1] = 1
    elif h[a[j]-1] == h[b[j]-1]:
        lose_flag[a[j]-1] = 1
        lose_flag[b[j]-1] = 1

cnt += lose_flag.count(0)
print(lose_flag)
print(cnt)

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

cnt = 0

lose_flag = [0] * n
for j in range(m):
    if h[a[j]-1] < h[b[j]-1]:
        lose_flag[a[j]-1] = 1
    elif h[a[j]-1] > h[b[j]-1]:
        lose_flag[b[j]-1] = 1
    elif h[a[j]-1] == h[b[j]-1]:
        lose_flag[a[j]-1] = 1
        lose_flag[b[j]-1] = 1

cnt += lose_flag.count(0)

print(cnt)

Verdicts: Wrong Answer

Accepted