Problem:


Score : 200 points

Problem Statement

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?

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq K \leq 100

1 \leq d_i \leq N

1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N

Input

Input is given from Standard Input in the following format:

N K
d_1
A_{1, 1} \cdots A_{1, d_1}
\vdots
d_K
A_{K, 1} \cdots A_{K, d_K}

Output

Print the answer.

Sample Input 1

3 2
2
1 3
1
3

Sample Output 1

1

Snuke 1 has Snack 1.

Snuke 2 has no snacks.

Snuke 3 has Snack 1 and 2.

Thus, there will be one victim: Snuke 2.

Sample Input 2

3 3
1
3
1
3
1
3

Sample Output 2

2



Sample input:
3 2
2
1 3
1
3


Sample output:
1

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
#ANSlist = [1]*(N)
ANSlist = []
ANS = 0

for i in range(K):
    I = input() #
    S = list(input())
    for j in range(len(S)):
        if S[j] != " ":
            #ANSlist[int(S[j])-1] = 0
            if not S[j] in ANSlist:
                ANSlist.append(S[j])
                ANS += 1
            


'''for i in range(len(ANSlist)):
    if ANSlist[i] != 0:
        ANS += 1'''

print(N-ANS)

Submission status: Wrong Answer

Solution code:
line1 = list(map(int, input().split()))
peple = list(range(line1[0]+1))
kashi = list(range(line1[1]+1))
peple.remove(0)
kashi.remove(0)

i = 1
while i < len(kashi):

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1

print(len(peple))

Submission status: Wrong Answer

Solution code:
import itertools
N1, K1 = map(int, input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))
    except:
        break;
N = len(listA)
listB = []
for n in range(1,N):
  if n%2==0:
    listB.append(listA[n])
listC = list(itertools.chain.from_iterable(listB))
print(N1 - len(list(set(listC))))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ql = [tuple(map(int, input().split())) for i in range(2*m)]
a = ql[1::2]
ans = n - len(set(a))
if ans <= 0:
    print(0)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
line1 = list(map(int, input().split()))
peple = list(range(line1[0] + 1))
kashi = list(range(line1[1] + 1))
peple.remove(0)
kashi.remove(0)
i = 1
while i < len(kashi):

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1



print(len(peple))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
a=[list(map(int,input().split()))for i in range(2*K)]
sunuke=[]
if N==1:
    print(0)
    exit()
for i in range(2*K-1):
    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))

Submission status: Wrong Answer

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1:2]
q = m[0].split()
output = N - len(q)
print(output)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
List = []
void = 0
cnt = 0
for i in range(int(K)):
    void = int(input())
    List.append(list(map(int, input().split())))

arr = [int(x) for y in List for x in y]

for k in range(1,N):
    if k in arr:
        pass
    else:
        cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())

num_list = []
d = []
for i in range(N):
  try:
      d.append(list(map(int,input().split())))
      num_list.append(list(map(int,input().split())))
  except EOFError:
    pass
A = set(sum(num_list, []))
#print(A)

ppl = []
for i in range(N):
    ppl.append(N)
    N -= 1

people = set(ppl)
snack = set(A)

s_difference = people - snack
print(s_difference)

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
S = [input() for i in range(K*2)]

count=0
d = []
sunu = []
sunu2 = []
f=0

for i in S:
    count += 1
    if count % 2 == 0:

        sunu.append(i)
    else:
        d.append(i)
        
print(sunu)
print(d)
    
for i in sunu:
    for n in i:
        if n != ' ':
            sunu2.append(n)
print(N-len(set(sunu2)))

Submission status: Wrong Answer

Solution code:
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-1):
    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))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N, K = map(int, input().split())
numlist = []
for i in range(K*2):
    numlist.append(list(map(int,input().split())))
anslist=[]

i=0
while i<K*2:
    if not i%2==0:
        anslist.append(numlist[i])
    i+=1
    
#print(anslist)

checklist=str(anslist)
ans=0
j=0
while j<N:
    #print("HI")
    check=j+1
    #print(check)
    if str(check) not in checklist:
        ans+=1
    j+=1
    
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
list = []
if k ==1:
  d = input()
  #print(i)
  for a in map(int,input().split()):
    list.append(a)
    
else:
  
  for i in range(0,k-1):
    d = input()
    #print(i)
    for a in map(int,input().split()):
      list.append(a)
    
    
#print(list)
print(n - len(set(list)))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
for i in range(1,K):
  d = int(input())
  List = list(map(int, input().split()))
c = 0
n = 1
for I in range(1,N):
  if n in List:
    n = n+1
  else:
    c = c+1
    n = n+1
print(c)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ql = [tuple(map(int, input().split())) for i in range(2*m)]
a = ql[1::2]
if n < len(set(a)):
    print(0)
else:
    print(n - len(set(a)))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ANSlist = [1]*(N)

for i in range(K):
    I = input() #
    S = list(input())
    for j in range(len(S)):
        if S[j] != " ":
            ANSlist[int(S[j])-1] = 0

ANS = 0

for i in range(len(ANSlist)):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
di=int(input())
print(N-di)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ql = [tuple(map(int, input().split())) for i in range(2*m)]
a = ql[1::2]
if n <= len(set(a)):
    print(0)
else:
    print(n - len(set(a)))

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
list = []
if k ==1:
  d = input()
  #print(i)
  for a in map(int,input().split()):
    list.append(a)
    
else:
  
  for i in range(0,k-1):
    d = input()
    print(i)
    for a in map(int,input().split()):
      list.append(a)
    
    
print(list)
print(n - len(set(list)))

Submission status: Wrong Answer

Solution code:
line1 = list(map(int, input().split()))
peple = list(range(line1[0]))
kashi = list(range(line1[1]))


i = 1
while i < len(kashi) + 1:

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1
peple.remove(0)            
print(len(peple))

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
d = []
n = []
for k in range(K):
    d.append(input())
    n.append(input().split())
def flatten(nested_list):
    return [e for inner_list in nested_list for e in inner_list]
nfu = set(flatten(n))
print(nfu)
print(N - len(nfu))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
c = 0
n = 1
for i in range(1,K):
  d = int(input())
  List = list(map(int, input().split()))
for I in range(1,N):
  if n in List:
    n = n+1
  else:
    c = c+1
    n = n+1
print(c)

Submission status: Wrong Answer

Solution code:
line1 = list(map(int, input().split()))
peple = list(range(line1[0]))
kashi = list(range(line1[1]))


i = 1
while i < len(kashi):

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1
peple.remove(0)            
print(len(peple))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
d = [0] * K
A = [0] * K
for i in range (K):
	d[i] = map ( int, input() .split())
	A[i] = list(map(int, input().strip().split())) 

for j in range (K):
    UKE = list ( set(list(range(N))) - set(A[j]) )

print ( len(UKE) )

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
sunuke=[]
for i in range(k):
    d = int(input())
    if d >= 2:
        a = input().split()
        sunuke.extend(a)
    else:
        a = input()
        sunuke.extend(a)
print(n-len(set(sunuke)))

Submission status: Wrong Answer

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1:2]
output = N - len(m)
print(output)
# K_num = []

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
for i in range(k):
        m = set(map(str,input().split()))
s = len(m)    
print(n-s)

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
D=[]
A=[]
for i in range(1,k+1):
    d = set(map(int, input().split())) 
    a = set(map(int, input().split())) 
    D.extend(d)
    A.extend(a)
l = set(A)
ans = []
for i in range (1,n+1):
  if i not in l:
    ans.append(i)
if len(ans) ==1:
  print(ans[0])
else:
  print(*ans)

Submission status: Wrong Answer

Solution code:
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
n_list = list(range(1, n+1))
input_map = {}
for i in range(k):
    d = int(input())
    d_list = [ int(ai) for ai in input().split()]
    input_map.setdefault(d, d_list)

for key, value in input_map.items():
    for h in value:
        if n_list.count(h) == 1:
            n_list.remove(h)

print(len(n_list))

Submission status: Wrong Answer

Solution code:

n,k= map(int,input().split())
count = 3
maxcount = k*2+3
damy = []
answer = []
while count < maxcount:
    if count % 2 == 1:
	    count += 1
	    damy.append(input())
    else:
	    count += 1
	    answer.append(input())

answera = set(answer)
print(n-len(answera))

Submission status: Wrong Answer

Solution code:
import collections
N,K=map(int,input().split())
a=[]
while K>0:
  K=K-1
  d=int(input())
  a.append(map(str,input().split()))
e=collections.Counter(a)
p=N-len(e)
print(p)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
l=[x for x in range(1,N+1)]
for i in range(1,K):
	d=int(input())
	A=list(map(int,input().strip().split()))
	for j in range(len(A)):
		if A[j] in l:
			l.remove(A[j])
p=set(l)
print(len(p))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
for i in range(k):
        m = set(map(int,input().split()))
s = len(m)    
print(n-s)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
d = int(input())

print(N-d)

Submission status: Wrong Answer

Solution code:
import collections
N,K=map(int,input().split())
a=[]
while K>0:
  K=K-1
  d=int(input())
  a.append(map(str,input().split()))
e=collections.Counter(a)
print(N-len(e))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
c = 0
n = 1
for i in range(K):
  d = int(input())
  List = list(map(int, input().split()))
for i in range(N):
  if n in List:
    n = n+1
  else:
    c = c+1
    n = n+1
print(c)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
d = []
e = []
for i in range(k):
    d.append(input())
    e.append(input())
f = list(set(e))
g = len(f)
print(n-g)

Submission status: Wrong Answer

Solution code:
import numpy as np

N,K=(int(x) for x in input().split())

A=[]
l=[]
for i in range(K):
    #d = int(input(''))
    #for j in range(d):
        #l_ = int(input(''))
        #l.append(l_)
    l=[int(x) for x in input().split()]
    A.append(l)

a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)

print(np.count_nonzero(np.all(a==0, axis=1)))

Submission status: Wrong Answer

Solution code:
N , K = map(int,input().split())

lis = []

for i in range(K):
  
  d = int(input())
  lis.extend([map(int,input().split())])
lis = set(lis)

print(N-len(lis))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
A=[]
i=0
m=0
for _ in range(2*K):
    a = [int(x) for x in input().split()]
    if i%2!=0:
        A.append(a)
    i=i+1
A = list(map(list, set(map(tuple, A))))
print(N-len(A))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split()) #n任 k種類
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))

mozi = ""
for i in range(k):
    for j in range(int(d[i])): 
        #print("a[i][j]",a[i][j])
        mozi = str(a[i][j]) + mozi
mozi =  ''.join(set(mozi))
mozi = list(mozi)
cnt = 0


print(n-int(len(mozi)))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
l=[x for x in range(1,N+1)]
for i in range(1,K):
	d=int(input())
	A=list(map(int,input().strip().split()))
	for j in range(len(A)):
		if A[j] in l:
			l.remove(A[j])
print(len(l))

Submission status: Wrong Answer

Solution code:
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
n_list = list(range(1, n+1))
input_map = {}
for i in range(k):
    d = int(input())
    d_list = [ int(ai) for ai in input().split()]
    input_map.setdefault(d, d_list)


having_map = {}
for key, value in input_map.items():

    for h in value:
        if n_list.count(h) >= 1:
            n_list.remove(h)

print(len(n_list))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())

N = list(range(1,n +1))
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for p in a:
        try:
            if N.index(p):
                N[N.index(p)] = 0
        except:
            pass

cnt = 0                    
for q in N:
    if q != 0:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
N, K = list(map(int, input().split()))
d = []
A = []
B = set()
for i in range(K):
    _d = int(input())
    _A = list(map(int, input().split()))
    d.append(_d)
    A.append(_A)
    _B = set(_A)
    B = B | _B
print(B)
print(N - len(B))

Submission status: Wrong Answer

Solution code:
import collections
N,K=map(int,input().split())
a=[]
while K>0:
  K=K-1
  d=int(input())
  a.append(map(int,input().split()))
e=collections.Counter(a)
print(N-len(e))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
d = [0] * k
a_list = []
for i in range(0, k):
    d[i] = int(input())
    a_list.append(list(map(int, input().split())))

print(n - d[0])

Submission status: Wrong Answer

Solution code:
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()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
d = 0

people_dic = []
have_dic = []
min_people = n
temp_min = 0


for all in range(1, n+1):
    people_dic.append(all)

for cnt in range(k):
    d = int(input())
    have_dic.append(list(map(int, input().split())))


for comparison in range(k):
    temp_min = len(list(set(people_dic) - set(have_dic[comparison])))
    if temp_min < min_people:
        min_people = temp_min

print(min_people)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ANSlist = [1]*(N)
for i in range(K):
    I = input() #
    S = list(input())
    for j in range(len(S)):
        if S[j] != " ":
            ANSlist[int(S[j])-1] = 0

ANS = 0

for i in range(N):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)

Submission status: Wrong Answer

Solution code:
import itertools
N, K = map(int, input().split())
snack = [list(map(int, input().split())) for i in range(2*K)]
answer = []
person = 0

for i in snack[1::2]:
    for j in i:
      if not j in answer:
        answer.append(j)
      else:
        break
    else:
	    person += 1
print(person)

Submission status: Wrong Answer

Solution code:
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
n_list = list(range(1, n+1))
input_map = {}
for i in range(k):
    d = int(input())
    d_list = [ int(ai) for ai in input().split()]
    input_map.setdefault(d, d_list)


having_map = {}
for key, value in input_map.items():
    for h in value:
        print(value)
        if n_list.count(h) >= 1:
            n_list.remove(h)

print(len(n_list))

Submission status: Wrong Answer

Solution code:
import collections
N,K = list(map(int,input().split()))

for i in range(K):
    kashi_number = int(input())
    sweets_snk = list(map(int,input().split()))

c = collections.Counter(sweets_snk)
len_C = len(c)
print(K - len_C)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
d = []
e = []
for i in range(k):
    d.append(int(input()))
    e.append(input())
f = list(set(e))
g = len(f)
print(n-g)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
i = 0
a = list()
d = 0
while i<k:
    d += int(input())
    a += (map(int, input().split()))
    i += 1
i=0

while i<d:
    x = d-1
    while x > i:
        if a[x] < a[x-1]:
            c = a[x]
            a[x] = a[x-1]
            a[x-1] = c
        x -= 1
    i+=1

i=0
ans = a[0] - 1
while i<d-1:
    if a[i+1] - a[i]>1:
        ans +=1
    i+=1
if a[d-1] != n:
    ans += n - a[d-1]

print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ANSlist = [1]*(N)
print(ANSlist)
for i in range(K):
    I = input() #
    S = list(input())
    for j in range(len(S)):
        if S[j] != " ":
            ANSlist[int(S[j])-1] = 0

ANS = 0

for i in range(N):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)

Submission status: Wrong Answer

Solution code:
N_setup_data = input().split()
N_sunuke_number = int(N_setup_data[0])
K_snack_number = int(N_setup_data[1]) - 1
K_snack_number = int(N_setup_data[1])
N_sunuke_pocket = [0] * N_sunuke_number


for j in range(K_snack_number):
	N_A_sunuke_pocket = [0] * (N_sunuke_number + 1)
	N_B_sunuke_pocket = [0] * (N_sunuke_number + 1)
	d = input()
	N_A_sunuke_pocket = input().split()
	print(N_A_sunuke_pocket)
	for i in N_A_sunuke_pocket:
		N_B_sunuke_pocket[int(i) - 1] += 1
	print(N_B_sunuke_pocket, i)
	j = 0

	for i in N_B_sunuke_pocket:
		if i != 0:
			N_sunuke_pocket[j] += 1
		j += 1
		print(N_sunuke_pocket)
def calc_area():
	Out_Area = 0
	for i in N_sunuke_pocket:
		if i == 0:
			Out_Area += 1
	return Out_Area

print(calc_area())

Submission status: Wrong Answer

Solution code:
import collections
N,K=map(int,input().split())
a=[]
while K>0:
  K=K-1
  d=int(input())
  a.append(map(int,input().split()))
e=collections.Counter(a)
print(N-len(a))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ANSlist = [1]*(N)
print(ANSlist)
for i in range(K):
    I = input() #
    S = list(input())
    for j in range(len(S)):
        if S[j] != " ":
            ANSlist[int(S[j])-1] = 0

ANS = 0

for i in range(N-1):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)

Submission status: Wrong Answer

Solution code:
s=input()
l=list(map(int,s.split()))
n=l[0]
k=l[1]

ss=set([i+1 for i in range(n)])
work=l[2:]
counter=set([])

i=0
while True:
    if i==len(work):
        break
    for j in work[i+1:i+work[i]+1]:
        counter.add(j)
        print(counter)
        
    i=i+work[i]+1
    
for j in list(counter):
    ss.remove(j)
print(len(ss))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
c = 0
n = 1
for i in range(K):
  d = int(input())
  List = list(map(int, input().split()))
for I in range(N):
  if n in List:
    n = n+1
  else:
    c = c+1
    n = n+1
print(c)

Submission status: Wrong Answer

Solution code:
d=[];
A=[];
N,K=input().split();
N=int(N);
K=int(K);
for i in range(K):
  d.append(input())
  A.append(input().split());
print(A);
count=0;
for i in range(N):#i君がおかしを持っているか確認
  flag=0;
  for j in range(K):
    if(str(i+1) in A[j]):#i君が種類kのお菓子を持ってるか。
      print(str(i+1)+" have "+str(A[j]));
      flag=1;
  if (flag == 0):
    count+=1;

print(count);

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(b-1):
 p=""
 r=""
 try:
   p=input().split()
 except:
  p=""
 try:
  r=input().split()
  for b in r:
   for bb in b:
    s.append(int(bb))
 except:
  r=""
result = list(filter(lambda x: x not in list(set(s)), list(range(1,a+1))))
print(len(result)+1)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ANSlist = [1]*(N)
print(ANSlist)
for i in range(1,K):
    I = input() #
    S = list(input())
    for j in range(len(S)):
        if S[j] != " ":
            ANSlist[int(S[j])-1] = 0

ANS = 0

for i in range(N-1):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
all_sunuke = [1]*n

for i in range(0,k):
  d = int(input())
  a = list(map(int, input().split()))
  for j in range(0,d):
      all_sunuke[j] =all_sunuke[(a[j]-1)]*0

print(sum(all_sunuke))

Submission status: Wrong Answer

Solution code:
def main():
  s = list(map(int,input().split()))
  n = [0]*s[0]
  for k in range(1,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()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
a = [0] * (n+1)
cnt = -1
b = []

for i in range(k):
    d = int(input())
    b.append(input().split())
    # print(b)

    for j in range(d):
        b[i][j] = int(b[i][j])
        a[b[i][j]] += 1
for i in range(n):
    if a[i] == 0:
        cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
import collections
N,K=map(int,input().split())
a=[]
while K>0:
  K=K-1
  d=int(input())
  a.append(map(str,input().split()))
e=collections.Counter(a)
print(N-len(a))

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(b-1):
 p=""
 r=""
 try:
   p=input().split()
 except:
  p=""
 try:
  r=input().split()
  for b in r:
   for bb in b:
    s.append(int(bb))
 except:
  r=""
result = list(filter(lambda x: x not in list(set(s)), list(range(1,a+1))))
print(len(result))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())

ls = list(range(1, N))

for i in range(K):
  d = int(input())
  for l in map(int, input().split()):
    #print(l)
    if l in ls:
      ls.remove(l)

print(len(ls))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())

print(N - int(input()))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
d = []
a_list = []
for i in range(k):
    d = int(input())
    a_list.append(list(map(int, input().split())))

print(k - d)

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(b-1):
 try:
   p=input().split()
 except:
  p=""
 try:
  r=input().split()
  for b in r:
   for bb in b:
    s.append(int(bb))
 except:
  r=""
result = list(filter(lambda x: x not in list(set(s)), list(range(1,a+1))))
print(len(result))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
line=[]
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in range(len(a)):
        line.append(a[j])
ans=len(set(line))
print(ans)

Submission status: Wrong Answer

Solution code:
N,K=map(lambda x:int(x),input().split())

i=1
d=[]
A=[]
while i<=K:
	j=0
	a=[]
    #お菓子iを買う人の人数
	num=int(input())
	d.append(num)
   	#お菓子iを買う人
	a=input().split()
	for x in a:
		a[j]=int(x)
		j=j+1
	A.append(a)
	i=i+1

cnt=0
for i in range(K):
	flag=False
	for j in range(len(A[i])):
		if i+1==A[i][j]:
			flag=True
	if flag==False:
		cnt=cnt+1

print(cnt)

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(b-1):
 try:
   p=input().split()
 except:
  p=""
 try:
  r=input().split()
  for b in r:
   for bb in b:
    s.append(int(bb))
 except:
  r=""
r=list(range(1,a+1))
s=list(set(s))
result = list(filter(lambda x: x not in s, r))
print(len(result))

Submission status: Wrong Answer

Solution code:
import numpy
N,K = map(int,input().split())
a= [input().split() for l in range(2*K)]
b=a[1::2]

k=[0]*N
for i in range(K) :
    for j in range(N):
        if (b[i].count(str(j+1))) > 0 :
            k[j]+=1

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

print(count)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
listX=[]

while K>0:
    dk=int(input())
    listk=input().split()
    listX=listX+listk
    K=K-1

listN=list(range(N+1))
listZ=list(set(listN)-set(listX))
L=str(len(listZ))
print(L)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ql = [tuple(map(int, input().split())) for i in range(2*m)]
a = ql[1::2]
print(n - len(set(a)))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
all_sunuke = [1]*n

for i in range(0,k):
  d = int(input())
  a = list(map(int, input().split()))
  for j in range(0,d):
    if a[j] != 0:
      all_sunuke[j] =all_sunuke[a[j]-1]*0

print(sum(all_sunuke))

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
arr1=[]
arr=[]
for i in range(1, N+1):
  arr1.append(i)

for i in range(K*2):
  A=list(map(int, input().split()))
  if i%2!=0:
    arr = arr+A
print(list(set(arr1) - set(arr)))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
Number = []
n = 0
c = 1
for i in range(K):
  d = int(input())
  A = [int(x) for x in input().split()]
  Number.append(int(d))
for I in range(N):
  if c in A:
    c = c+1
  else:
    n = n+1
    c = c+1
print(n)

Submission status: Wrong Answer

Solution code:
#文字列の長さ len(測る文字)
#文字列の検索（何番目） List.index(検索する文字)


#A, B = [int(input()) for i in range(2)]
#A, B = [input() for i in range(2)]
N,K =map(int, input().split())
#N = int(input())
#S = input()

sum=0

#List = ['A','B','C','D','E']
#List=list(range(1))
List_A_all = list(range(3*K+1))
List_A_all =[]


#行列入力
for i in range(K):

    List_d = int(input())

    List_A = input().split()
    List_A_int= [int(s) for s in List_A]
    List_A_all.extend(List_A_int)

#print(List_A_all)

for t in range(N):
    if not t in List_A_all:
        sum+=1


#print(List_d)
print(sum)


#1行のリスト作成
#for i in range(1):
#    X,Y,Z= map(int, input().split())
#    List=[X,Y,Z]

#List.sort()
#print(List[1])

#for i in range(3):
 #   sum += List[i][0]*List[i][1]*0.1

#print(int(sum))

#print(List.index(S)+1)

#salary = 0

#sum=0

#print(N)
#while sum!=N:

#    print(1)
#    sum+=1



#i=0からスタートなのに注意
#for i in range(N+1):
#    salary+= i*10000/N
#
#salary = int(salary)
#print(str(Y)+' '+str(X))

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(a-1):
 try:
   p=input().split()
 except:
  p=""
 try:
  r=input().split()
  for b in r:
   for bb in b:
    s.append(int(bb))
 except:
  r=""
r=list(range(1,a+1))
s=list(set(s))
result = list(filter(lambda x: x not in s, r))
print(len(result))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
res={' '}
for i in range(K):
    d=input()
    ki=list(input())
    res|=set(ki)
res=[x for x in res if x!=' ']
print(N-len(res))

Submission status: Wrong Answer

Solution code:
N,K =map(int , input().split())
A = []
for i in range(K):
  d = int(input())
  A += map(int , input().split())
  print(set(A))
print(N-len(set(A)))

Submission status: Wrong Answer

Solution code:
#文字列の長さ len(測る文字)
#文字列の検索（何番目） List.index(検索する文字)


#A, B = [int(input()) for i in range(2)]
#A, B = [input() for i in range(2)]
N,K =map(int, input().split())
#N = int(input())
#S = input()

sum=0

#List = ['A','B','C','D','E']
#List=list(range(1))
List_A_all = list(range(3*K+1))
List_A_all =[]


#行列入力
for i in range(K):

    List_d = int(input())

    List_A = input().split()
    List_A_int= [int(s) for s in List_A]
    List_A_all.extend(List_A_int)

#print(List_A_all)

for t in range(K):
    if not t in List_A_all:
        sum+=1


#print(List_d)
print(sum)


#1行のリスト作成
#for i in range(1):
#    X,Y,Z= map(int, input().split())
#    List=[X,Y,Z]

#List.sort()
#print(List[1])

#for i in range(3):
 #   sum += List[i][0]*List[i][1]*0.1

#print(int(sum))

#print(List.index(S)+1)

#salary = 0

#sum=0

#print(N)
#while sum!=N:

#    print(1)
#    sum+=1



#i=0からスタートなのに注意
#for i in range(N+1):
#    salary+= i*10000/N
#
#salary = int(salary)
#print(str(Y)+' '+str(X))

Submission status: Wrong Answer

Solution code:
N, K = input().split(" ")

d_num = int(input())

okasi_nasi = set()
for i in range(int(K)*2):
    if i % 2 == 1:
        buf = input()
        if buf[0] != "":
            okasi_nasi = okasi_nasi | set(buf.split(" "))

print(int(N) - len(okasi_nasi))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
d = [0]*k
a = [0]*k
s = []
for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int,input().split()))
    s.extend(a[i])
d = set(s)

print(n-len(d))
print(s)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
ns = ""
ans =0
for i in range(k):
    p = int(input())
    s = str(input())
    ns += s+" "

for i in range(1,n+1):
    if(str(i) not in ns):
        ans+= 1
print(ans)

Submission status: Wrong Answer

Solution code:
N, K = list(map(int, input().split())) 
d = int(input())
A =[]
while(True):
  try:
    IN = list(map(int, input().split())) 
    A += IN[:d]
  except EOFError:
    break

A = set(A)
nin = 0
for i in range(1, N+1):
  if i not in A:
    nin += 1

print(nin)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    A.append(map(int,input().split()))
answer = N-len(set(A))
print(answer)

Submission status: Wrong Answer

Solution code:
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))