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: Accepted

Solution code:
n, k = list(map(int, input().split()))
d = []
sweets_matrix = []

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

sunuke = [0] * n

for i in range(k):
    for j in range(d[i]):
        sunuke[sweets_matrix[i][j]-1] += 1

print(len([i for i in sunuke if i == 0]))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
nusuke = set()
for _ in range(k):
  d = int(input())
  for a in map(int, input().split()):
    nusuke.add(a)
print(n - len(nusuke))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
a = []
for i in range(k):
    d = input()
    a += [int(i) for i in input().split(" ")]
print(n-len(set(a)))

Submission status: Accepted

Solution code:
def str_to_int(lista):
    for num, i in enumerate(lista):
        lista[num]=int(i)
        
def main():
    list_NK = input().split()
    str_to_int(list_NK)
    list_N = []
    list_K=[]
    for i in range(list_NK[1]):
        list_K.append(input())
        temp = input().split()
        str_to_int(temp)
        for j in temp:
            if j not in list_N:
                list_N.append(j)
    print(list_NK[0]-len(list_N))

main()

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
res = [0]*n
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for key in a:
        res[key-1]+=1
res = list(filter(lambda x:x==0,res))
print(len(res))

Submission status: Accepted

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

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

print(N - len(set(A)))

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

N, K = map(int, input().split())
sunukes = {n+1 for n in range(N)}
# print(sunukes)

for i in range(K):
    d_i = int(input())
    for n in map(int, input().split()):
        n in sunukes and sunukes.remove(n)

print(len(sunukes))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
ans = [0 for i in range(n)]
for i in range(k):
    d = int(input())
    tmp = list(map(int,input().split()))
    for j in tmp:
        ans[j-1] += 1

print(ans.count(0))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
sunuke = set(range(1,n+1))

for i in range(k):
    d = int(input())
    a = map(int,input().split())
    A = set(a)
    sunuke = sunuke - A 

print(len(sunuke))

Submission status: Accepted

Solution code:
N, K = [int(i) for i in input().split()]
Okashi = [[] for _ in range(K + 1)]

snuke_have_sweets = [False] * (N + 1)
for _ in range(K):
    D = int(input())
    A = [int(i) for i in input().split()]
    for a in A:
        snuke_have_sweets[a] = True

print(N - sum(snuke_have_sweets[1:]))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())
    result = [0] * N

    for i in range(K):
        _ = int(input())
        A = list(map(int, input().split()))
        for a in A:
            result[a - 1] += 1
    print(result.count(0))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

res_list_set = list(set(res_list))
print( n - len(res_list_set))

Submission status: Accepted

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

l = []

for i in range(k):
  d = input()
  l.append(set([int(x) for x in input().split()]))
  
s = set()
for i in l:
  s = s.union(i)
  
all_set = set([x+1 for x in range(n)])
def_set = all_set.difference(s)
print(len(def_set))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
have = set()
for i in range(1, K+1):
    di = int(input())
    for h in list(map(int, input().split())):
        have.add(h)
print(N - len(have))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
ans=[1]*n
for i in range(k):
  d=int(input())
  for j in list(map(int,input().split())):ans[j-1]=0
print(ans.count(1))

Submission status: Accepted

Solution code:
n,k = list(map(int, input().split()))
b =[0]*n

for i in range(k):
    d = int(input())
    dk = list(map(int, input().split()))
    #print(dk)
    for j in range(d):
        #print(dk[j])
        b[dk[j] - 1] += 1
#print(b)
ans = 0
for i in range(len(b)):
    if b[i] == 0:
        ans +=1
print(ans)

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
kashi_num = [str(i+1) for i in range(N)]
for _ in range(K):
  d = input()
  for a in input().split():
    if a in kashi_num:
      kashi_num.remove(a)
  if len(kashi_num)==0:
    break
print(len(kashi_num))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
d=[]
A=[]
B=[]
for i in range(1,K+1):
    d=int(input())
    A=list(map(int,input().split()))
    B=B+A

C=set(list(range(1,N+1)))
print(len(C-set(B)))

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

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

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

    have = []
    for a in A:
        have[len(have):] = set(a)
    print(N - len(set(have)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n, k = [int(x) for x in input().split()]
A = {}
for i in range(k):
    d = int(input())
    for x in input().split():
        A[x] = True

print(n - len(A))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
b = []
for i in range (k):
  a=int(input())
  b.extend(int(i) for i in input().split())
unique = set(b)
c = n-len(unique)
print(c)

Submission status: Accepted

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

susuke = [1] * N

for i in range(K):
  di = int(input())
  ai = map(int, input().split())
  for j in ai:
    susuke[j - 1] = 0
    
print(sum(susuke))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
m = set(range(1,n+1))

for i in range(k):
    input()
    a = set(map(int, input().split()))
    m -= a

print(len(m))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

n,k = (int(x) for x in input().split())
lst = [0 for _ in range(n)]
for i in range(k):
    d = int(input())
    seq = [int(x) for x in input().split()]
    for val in seq:
        lst[val-1] += 1
print(sum((val==0 for val in lst)))

Submission status: Accepted

Solution code:
import numpy as np
NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]
trick = N
lists = np.zeros(N)
for i in range(K):
    d = int(input())
    A = input().split()
    for j in range(d):
        if lists[int(A[j])-1] == 0:
            lists[int(A[j])-1] = 1
            trick -= 1
print(trick)

Submission status: Accepted

Solution code:
#ABC166b
n, k = map(int,input().split())
d = [0]*k
a = [1]*n

for i in range(k):
    d[i] = int(input())
    sunuke_i = map(int,input().split())
    for t in sunuke_i:
        a[t-1]=0
print(sum(a))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
ans=[]
for i in range(K):
    _=input()
    ans+=input().split()

print(N-len(set(ans)))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
sunuke = list(range(1, n+1))

for i in range(k):
  d = int(input())
  A = list(map(int, input().split()))
  for d in range(d):
    for a in A:
      if a in sunuke:
        sunuke.remove(a)
    
print(len(sunuke))

Submission status: Accepted

Solution code:
"""
n snukes
k kinds of snacks


the following di snukes have


"""
import collections

n, k = map(int, raw_input().split(' '))

cc = collections.Counter()
for i in range(k):
	d = int(raw_input())
	for u in map(int,raw_input().split(' ')): cc[u] +=1

count = 0
for u in range(1,n+1):
	if cc[u] == 0: count+=1
print count

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
S={*range(1,N+1)}
for i in range(K):
    _=input()
    S-={*map(int,input().split())}

print(len(S))

Submission status: Accepted

Solution code:
N, K = [int(i) for i in input().split()]
d = []
A = []
for i in range(K):
    d.append(int(input()))
    for j in input().split():
        A.append(int(j))

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

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
A = []
for i in range(K):
    d1 = int(input())
    a = list(map(int,input().split()))
    A.append(a)
ans = {i:0 for i in range(1,N+1)}
for a in A:
    for d in a:
        ans[d] = 1
ans2 = 0
for j in ans.keys():
    if ans[j] == 0:
        ans2 += 1
print(ans2)

Submission status: Accepted

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

Bs = [0 for i in range(N + 1)]
for _ in range(K):
    d = int(input())
    As = list(map(int, input().split()))
    for a in As:
        Bs[a] += 1
cnt = 0
for b in Bs[1:]:
    if b == 0:
        cnt += 1
# print(Bs)
print(cnt)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
d=[]
a=[]
for _ in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
x=[0]+[1]*n
for i in range(k):
    for j in range(d[i]):
        x[a[i][j]]=0
print(sum(x))

Submission status: Accepted

Solution code:
s = input().split()
N, K = int(s[0]), int(s[1])
victims = [True]*N
for k in range(K):
  d = input()
  a = input().split()
  for i in a:
    victims[int(i)-1] = False
print(sum(victims))

Submission status: Accepted

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

N_list = []
for i in range(1, N+1):
    N_list.append(i)
for i in range(K):
    L = int(input())
    P_list = [int(x) for x in input().split()]
    for P in P_list:
        if P in N_list:
            N_list.remove(P)

print(len(N_list))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
sweets = [0]*n
for _ in range(k):
  _ = input()
  for i in map(int, input().split()):
    sweets[i-1] += 1
print(sum(i<1 for i in sweets))

Submission status: Accepted

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

for i in range(k):
    d = int(input())
    a_list = list(map(int, input().split()))
    for a in a_list:
        A[a-1] += 1

print(A.count(0))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
nn = set(range(1,n+1))

for i in range(k):
    input()
    a = set(map(int, input().split()))
    nn -= a

print(len(nn))

Submission status: Accepted

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

snk_sweets = []

for i in range(K):
    sweets = input()
    snk_sweets = snk_sweets + input().split()

len_snk = len(set(snk_sweets))
print(N - len_snk)

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
l=[1 for i in range(n)]
for i in range(m):
  input()
  for j in input().split():
    l[int(j)-1]=0
print(sum(l))

Submission status: Accepted

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

count = 0

sunuke = list(range(1,N+1))

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        try:
            sunuke.remove(a)
        except ValueError:
            continue
print(len(sunuke))

Submission status: Accepted

Solution code:
n,k = [int(i) for i in input().split()]
s = [0 for i in range(n)]
ans = 0

for i in range(k):
    d = int(input())
    a = [int(j) for j in input().split()]
    for m in range(d):
        s[a[m]-1] += 1
        
for i in range(n):
    if s[i]==0:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
x=[c for c in range(1,n+1)]
for i in range(1,k+1):
  d=int(input())
  s=input().split()
  for b in range(d):
    if int(s[b]) in x:
      x.remove(int(s[b]))
print(len(x))

Submission status: Accepted

Solution code:
n, k = [int(i) for i in input().split()]
s = [i + 1 for i in range(n)]
for i in range(k):
  d = int(input())
  ns = [int(j) for j in input().split()]
  for l in ns:
    s.remove(l) if l in s else None
print(len(s))

Submission status: Accepted

Solution code:
N, K = map(int,input().split())
ans = [0 for _ in range(N)]
for i in range(K):
  d = int(input())
  As = list(map(int,input().split()))
  for q in As:
    ans[q-1] += 1
print(len([k for k in ans if k == 0]))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
x=[c for c in range(1,n+1)]
for i in range(1,k+1):
  d_i=int(input())
  s_i=input().split()
  for b in range(d_i):
    if int(s_i[b]) in x:
      x.remove(int(s_i[b]))
print(len(x))

Submission status: Accepted

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

ans=set()
for aa in a:
    ans=ans|set(aa)

print(n-len(ans))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
a = [0] * n
d = []
for i in range(k):
    d.append(int(input()))
    at = list(map(int, input().split()))
    for a_ in at:
        a_-=1
        a[a_]+=1
ans = 0
for a_ in a:
    if a_==0:ans+=1
print(ans)

Submission status: Accepted

Solution code:
N, K = input().split()
nusk = [0 for i in range(int(N))]
for i in range(int(K)):
    D = int(input())
    A = input().split()
    for item in A:
        nusk[int(item)-1] += 1

print(nusk.count(0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nk = input().split()
n = int(nk[0])
k = int(nk[1])
s = [input().split() for i in range(k*2)]
o = []
 
for  j in range(len(s)):
    if j % 2 == 0:
        pass
    else:
        o[len(o):len(o)] = s[j]
 
l =list(set(o))
ans = n - len(l) 
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b = map(int,input().split())
c = [1 for i in range(a)]
for i in range(b):
    d = int(input())
    e = list(map(int, input().split()))
    for j in range(d):
        c[e[j] - 1] = 0

print(sum(c))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
sunuke = [0]*(N+1)
for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(d):
    sunuke[A[j]] = 1
cnt = 0
for i in range(1,N+1):
  if sunuke[i] == 0:
    cnt += 1
  
print(cnt)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
D = {}
for i in range(N):
    D[i+1] = 0
for i in range(K):
    d = input()
    A = list(map(int,input().split()))
    for a in A:
        D[a] += 1
ans = 0
for i in range(N):
    if D[i+1] == 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
ans=[]
for i in range(1,n+1):
  ans.append(i)

for i in range(k):
  d=int(input())
  a=list(map(int, input().split()))
  ans=set(ans)-set(a)
print(len(ans))

Submission status: Accepted

Solution code:
def main():
    N, K = map(int, input().split())
    ans = set(range(N))
    for i in range(K):
        d = int(input())
        A = list(map(int, input().split()))
        for a in A:
            if a-1 in ans:
                ans.remove(a-1)
    print(len(ans))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
have = [0]*n
for _ in range(k):
    _ = input()
    A = list(map(int, input().split()))
    for x in A:
        have[x-1] += 1
ans = 0
for x in have:
    if x == 0:
        ans += 1
print(ans)

Submission status: Accepted

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

l = []
for i in range(K):
    _ = int(input())
    A = list(map(int, input().split()))
    l.extend(A)

print(N - len(set(l)))

Submission status: Accepted

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

visited = [False for _ in range(n)]

for _ in range(k):
    d = int(input())
    items = list(map(int, input().split()))
    for i in items:
        visited[i - 1] = True

ret = 0
for cur in visited:
    if cur == False:
        ret += 1

print(ret)

Submission status: Accepted

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

list_a = [0]*N

for i in range(K):
    d = int(input())
    list_b = list(map(int, input().split()))
    for j in list_b:
        list_a[j-1] += 1

print(list_a.count(0))

Submission status: Accepted

Solution code:
# coding: utf-8
input1 = input().rstrip().split(" ")
sunuke = [0 for i in range(int(input1[0]))]
array = []
for i in range(int(input1[1])):
    okashi = input()
    okashisunuke = input().rstrip().split(" ")
    for i in range(int(okashi)):
        sunuke[int(okashisunuke[i])-1] += 1
print (sunuke.count(0))

Submission status: Accepted

Solution code:
import numpy as np
N, K = map(int, input().split())
member = np.ones(N, dtype=int)
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(len(A)):
        member[A[j]-1] = 0
print(sum(member))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
A = set()
for _ in range(K):
  d = input()
  A = A.union(set(map(int, input().split())))
print(N - len(A))

Submission status: Accepted

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

for i in range(k):
    a = int(input())
    l = map(int, input().split())
    
    for j in l:
        d[j-1] += 1
        
print(d.count(0))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
N = [0]*(n)
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        if N[j-1]==0: N[j-1] = 1
print(n-sum(N))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
D=[0]*n
for i in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  for j in range(d):
    D[a[j]-1]+=1
res=0
for i in range(n):
  if not D[i]:
    res+=1
print(res)

Submission status: Accepted

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

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

for i in range(K):
    d = int(input())
    A_list = [int(e) for e in input().split()]
    for sunuke in A_list:
        sunuke_list[sunuke] += 1

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

print(ans)

Submission status: Accepted

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

flag = [True for _ in range(N + 1)]
flag[0] = False

for _ in range(K):
    _ = input()
    for a in map(int, input().split()):
        flag[a] = False

print(sum(flag))

Submission status: Accepted

Solution code:
n,k = map(int,input().split()) # n人、k個のお菓子

people = [1] * n

for i in range(k): #お菓子i
  x = int(input()) #お菓子iを持っている人数
  y = list(map(int,input().split()))
  for j in y:
    people[j-1] = 0

print(sum(people))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
list=[]
for i in range(k):
    d = int(input())
    sunuke = map(int,input().split())
    for j in sunuke:
        if j not in list:
            list.append(j)
print(str(n - len(list)))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
ans = 0
list = [0] * n
for i in range(k):
    d = int(input())
    A = map(int,input().split())
    for j in A:
        list[j-1]+=1

for u in  list:
    if u == 0:
        ans += 1
        
print(ans)

Submission status: Accepted

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

sunuke = [False] * N

for i in range(K):
    d = int(input())
    for A in map(int, input().split()):
        sunuke[A - 1] = True

print([x for x in sunuke if not x].__len__())

Submission status: Accepted

Solution code:
import collections

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

snacks = collections.defaultdict(int)

for k in range(0, K):
  d = int(input())
  for n in input().split():
    snacks[int(n)] += 1
    
count = 0
for n in range(1, N + 1): 
  if snacks[n] == 0:
    count += 1
   
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = [int(e) for e in input().split(" ")]
d = [False] * n[0]
for i in range(n[1] * 2):
    raw = [int(e) for e in input().split(" ")]
    if((i+1) % 2 == 0):
        for e_r in raw:
            d[e_r - 1] = True
    else:
        pass
else:
    print(d.count(False))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    A = [0] * N
    for i in range(K):
        input()
        for d in list(map(int, input().split())):
            A[d-1] += 1

    count = 0
    for a in A:
        if a == 0:
            count += 1
    print(count)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
D = [0 for _ in range(N)]
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for i in range(d):
        D[A[i] - 1] += 1
res = 0
for i in range(N):
    if not D[i]:
        res += 1
print(res)

Submission status: Accepted

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

s = []

for i in range(N):
    s.append(False)
    
for i in range(K):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        s[a[j]-1] = True
        
cut = 0
for i in range(N):
    if not s[i]:
        cut += 1

print(cut)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
total = []
for _ in range(k):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    total.append(a)
ans = n - len(set(total))
print(ans)

Submission status: Accepted

Solution code:
A = []
sweetsInfo = [0]*100
empty = 0

N,K = input().split()

for i in range(int(K)):
    d = int(input())
    A = input().split()
    for o in range(d):
        sweetsInfo[int(A[o]) - 1] = 1

for i in range(int(N)):
    if sweetsInfo[i] == 0:
        empty += 1

print(empty)

Submission status: Accepted

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

for _ in range(k):
    d = input()
    l = list(map(int, input().split()))
    for i in l:
        v[i - 1] = False

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

Submission status: Accepted

Solution code:
NK = list(map(int,input().split()))
A = []
c = 0
for i in range(NK[1]):
    dk = int(input())
    Aid = list(map(int,input().split()))
    for k in Aid:
        A += [k]
for i in range(1,NK[0]+1):
    if not i in A:
        c += 1
print(c)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
set_all = set()
for i in range(K):
    d = int(input())
    #assert d != 0, "お菓子は誰かが持っている必要があります"
    #すぬけ君1とすぬけ君3がお菓子を持っている
    li = map(int, input().split())
    set_li = set(li)
    #{1,3}
    set_all = set_all | set_li

s = {i for i in range(1,N+1,1)}
s_xor = s ^ set_all
print (len(s_xor))

Submission status: Accepted

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

Submission status: Accepted

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

data = [list(map(int, input().split())) for _ in range(int(2 * K))]

Sunuke = [0] * N

for i in range(K):
    for j in range(data[int(2 * i)][0]):
        Sunuke[data[int(2 * i + 1)][j] - 1] += 1


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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
arr = [0 for _ in range(n)]

for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for v in a:
        arr[v-1] += 1
ans = 0
for i in arr:
    if i == 0:
        ans += 1
print(ans)

Submission status: Accepted

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

for i in range(K):
    d = input()
    A = map(int, input().split())
    for a in A:
        snukes[a - 1] += 1

print(snukes.count(0))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def main():
    N, K = map(int, sys.stdin.readline().strip().split())
    people = [False for _x in range(N)]
    for i in range(K):
        _ = sys.stdin.readline()
        for k in map(int, sys.stdin.readline().strip().split()):
            people[k-1] = True

    print(sum([1 for i in people if i is False]))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

snukes = [0 for _ in range(N)]
for _ in range(K):
    d = int(input())
    A = map(int, input().split())
    for a in A:
        snukes[a - 1] += 1

print(snukes.count(0))

Submission status: Accepted

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

s = []
for i in range(n):
    s.append(False)

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

cnt = 0
for i in range(n):
    if not s[i] :
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,k = LI()
    s = set()
    for _ in range(k):
        d = I()
        s |= set(LI())

    return n - len(s)


print(main())

Submission status: Accepted

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

Submission status: Accepted

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

sunuke=[0]*n

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

print(sunuke.count(0))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
j = [0 for _ in range(n)]
for _ in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for i in a:
        j[i-1] = 1
print(n - sum(j))

Submission status: Accepted

Solution code:
[n,k]= list(map(int,input().split(" ")))
st = set([i+1 for i in range (n)])
for i in range (k):
    d = int(input())
    sbst = set(list(map(int,input().split(" "))))
    st = st - sbst
print(len(st))

Submission status: Accepted

Solution code:
n,k = [int(_) for _ in input().split()]
mark = [0]*n
for t in range(k):
  m = int(input())
  arr = [int(x) for x in input().split()]
  for i in arr:
    mark[i-1] = 1
print(n-sum(mark))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
cnt=[0]*N
for _ in range(K):
   D=int(input())
   for i in map(int,input().split()):
       cnt[i-1]+=1
print(cnt.count(0))

Submission status: Accepted

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

ct = [0]*n

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

print(n-sum(ct))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
q = set([])
for _ in range(K):
    tmp = int(input())
    A = list(map(int, input().split()))
    for a in A:
        q.add(a)

print(N - len(q))

Submission status: Accepted

Solution code:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, K = read_ints()
    has_snacks = [False]*N
    for _ in range(K):
        _ = read_int()
        A = read_ints()
        for a in A:
            has_snacks[a-1] = True
    return has_snacks.count(False)


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N,K = map(int,input().split())
Nset = set(list(range(1,N+1)))
okasi = []
shojisha = []
for _ in range(K):
    okasi.append(int(input()))
    shojisha.append(list(map(int,input().split())))

for lis in shojisha:
    Nset = Nset - set(lis)

print(len(Nset))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))