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

Solution (Python):
def main():
    n, k = list(map(int, input().split()))
    sunukes = [0] * n
    for _ in range(k):
        d_tmp = int(input())
        aList = list(map(int, input().split()))
        for a in aList:
            sunukes[a-1] += 1
    print(sunukes.count(0))


if __name__ == '__main__':
    main()

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

ans = []

for i in range(k*2):
  x = input().split()
  if 1 == i % 2:
    for j in range(len(x)):
      if int(x[j]) not in ans:
        ans.append(int(x[j]))

print(n - len(ans))

Solution (Python):
N,K = map(int, input().split())
A = []
for i in range(0,K):
    d = int(input())
    array = list(map(int, input().strip().split()))
    A.extend(array)
ans = sorted(set(A), key=A.index)
print(N-len(ans))

Solution (Python):
n, k = map(int, input().split())
d = []
a = []
for _ in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))
s = [0] * n
for ai in a:
    for i in range(len(ai)):
        s[ai[i] - 1] += 1
ans = 0
for si in s:
    if si == 0:
        ans += 1
print(ans)

Solution (Python):
import numpy as np
N, K = map(int, input().split())
judge = np.zeros(N)
for k in range(K):
  d = int(input())
  A = input().split()
  for i in range(d):
    judge[int(A[i])-1] += 1
print(np.sum(judge==0))

Solution (Python):


n, k = map(int, input().split())
safe = set()  
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    assert len(a) == d
    safe.update(a)

print(n - len(safe))

Solution (Python):
n, k = map(int,input().split())
d_lst = []
a_lst = []
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    d_lst.append(d)
    a_lst.append(a)

sun_lst = [0] * n
for i in range(k):
    d = d_lst[i]
    a = a_lst[i]

    for j in range(d):
        sun = a[j]
        sun_lst[sun-1] = 1

ans = 0
for i in range(n):
    if sun_lst[i]==0:
        ans += 1

print(ans)

Solution (Python):
a,b = map(int,input().split())
aaa = [list(map(int,input().split())) for i in range(b*2)]

c = set()
e = set([i for i in range(1,a+1)])
for i in range(1,len(aaa),2):
  for k in aaa[i]:
     e.discard(k)

print(len(e))

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

si = [1]*n
di = [0]*k
ai = [0]*k



for l in range(k):
    
    d = int(input())
    di[l] = d
    a = [int(m) for m in input().split()]
    
    for o in range(len(a)):
        if (si[a[o-1]-1] == 1):
            si[a[o-1]-1] = 0

print(sum(si))

Solution (Python):
a,b = map(int,input().split())
aaa = [list(map(int,input().split())) for i in range(b*2)]

c = set()
e = set()
for i in range(1,len(aaa),2):
  for k in aaa[i]:
     c.add(k)
    
print(a - len(c))

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

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

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

have_sunuke = []

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    have_sunuke += A

print(len(set(all_sunuke) - set(have_sunuke)))

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

b = [0]*n
while i<d:
    b[a[i]-1]=1
    i+=1

i=0
ans = 0
while i<n:
    if b[i] ==0:
        ans += 1
    i+=1

print(ans)

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

nukes = set()
for i in range(K):
    int_snacks = int(input())
    
    nukes.update(list(map(int,input().split())))
    

print(str(N-len(nukes)))

Solution (Python):
N, K = map(int, input().split())
l = [0]*N
cnt = 0
for i in range(K):
    D = int(input())
    a = list(map(int, input().split()))
    for d in range(D):
        l[a[d]-1] += 1
for i in l:
    if i == 0:
        cnt += 1
print(cnt)

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

O=[1]*N
for i in range(K):
  d=int(input())
  for j in map(int,input().split()):
    O[~-j]=0
print(sum(O))

Solution (Python):
N, K = [int(_) for _ in input().split()]

X = set()
for i in range(K):
    d = int(input())
    A = [int(_) for _ in input().split()]
    X |= set(A)

print(N - len(X))

Solution (Python):



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

print(sunuke.count(0))

Solution (Python):
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 a:
        sunuke[j-1]+=1
 
print(sunuke.count(0))

Solution (Python):
N, K = map(int, input().split())
members = set()
for i in range(K):
    input()
    temp = set(map(int, input().split()))
    members |= temp
print(N - len(members))

Solution (Python):
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 a:
        sunuke[j-1]+=1

print(sunuke.count(0))

Solution (Python):
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
print(count)

Solution (Python):
n, k = map(int, input().split())
l = []
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in range(d):
        l.append(a[i])

print(n-len(set(l)))

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

Solution (Python):


n, k = map(int, input().split())
safe = set()  
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    assert len(a) == d
    safe.update(a)

x = sum(1 for s in range(1, n+1) if s not in safe)
print(x)

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

sunuke = [1 for i in range(N)]

for i in range(K):
    di = int(input())
    tmp = [int(t)-1 for t in input().split()] 
    for t in tmp:
        sunuke[t] = 0
print(sum(sunuke))

Solution (Python):
n,k = map(int,input().split())
sunuke = [0] * (n+1)
sunuke[0] = 1
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for x in a:
        sunuke[x] += 1
ans = 0
for s in sunuke:
    if s == 0:
        ans += 1
print(ans)

Solution (Python):
N_nin, K_ko = map(int, input().split())

sunuke = []

for i in range(K_ko):
    d = int(input())
    
    A = list(map(int, input().split()))
    
    for a in A:
        sunuke.append(a)


ans = N_nin - len(set(sunuke))

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline


n, k = map(int, input().split())
sunukes = [0] * (n + 1)

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

ans = 0

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

print(ans)

Solution (Python):
N, K = map(int, input().split())
count = 0
sunuke = [0 for _ in range(N)]
for _ in range(K):
    d = int(input())
    if d == 1:
        A = [int(input())]
    else:
        A = list(map(int, input().split()))
    for s in A:
        if sunuke[s-1] == 0:
            sunuke[s-1] = 1
            count += 1
print(N-count)

Solution (Python):
n, k = map(int, input().split())
p = [0]*n
for _ in range(k):
    _ = input()
    items = list(map(int, input().split()))
    items = [x-1 for x in items]
    for i in items:
        p[i] += 1

print(p.count(0))

Solution (Python):



import itertools

n, k =map(int, input().split())
A = []
for i in range(k):
    d = int(input())
    A.append(list(map(int, input().split())))
A = list(itertools.chain.from_iterable(A))
print(n-len(set(A)))

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

print(y.count(0))

Solution (Python):
set_have = set()
N, K = input().split()
for _ in range(int(K)):
  temp = input()
  lis = input().split()
  for m in lis:
    set_have.add(m)
print(int(N) - len(set_have))

Solution (Python):
n,k = map(int , input().split())
a = []
from collections import defaultdict as dd
dc = dd(lambda : 0)
for i in range(k):
  d = int(input())
  a = list(map(int , input().split()))
  for i in a:
    dc[i] += 1
cnt = 0
for i in range(1 , n + 1):
  if dc[i] == 0:
    cnt += 1
print(cnt)

Solution (Python):
n,k=map(int,input().split())
a=[]
for i in range(k):
    d= int(input())
    e=list(map(int,input().split()))

    for j in e:
        a.append(j)

ans = n-len(set(a))
print(ans)

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

Solution (Python):
n, k = map(int, input().split())
A = [None]*k
for i in range(k):
    d = int(input())
    A[i] = list(map(int, input().split()))

snuke = [0] * n
for i in range(k):
    for j in A[i]:
        snuke[j - 1] += 1

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

Solution (Python):
if __name__ == '__main__':
    [n,k] = [int(i) for i in input().split()]
    m = dict()
    for i in range(1,n+1,1):
        m[i] = []
    for i in range(1,k+1,1):
        d = input()
        for j in input().split():
            m[int(j)].append(i) 

    count = 0
    for i in m.keys():
        if len(m[i]) == 0:
            count+=1
    print(count)

Solution (Python):
n,_,*t=''.join([*open(0)][::2]).split()
print(int(n)-len({*t}))

Solution (Python):
n,_,*t=''.join([*open(0)][::2]).split()
print(int(n)-len({*t}))

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

d = []
A = []
for _ in range(K):
  d.append(int(input()))
  A.extend([int(j) for j in input().split()])
  
print(N-len(set(A)))

Solution (Python):
n, k = map(int, input().split())
arr = [False for i in range(n + 1)]
count = 0
for i in range(k):
    d = int(input())
    darr = list(map(int, input().split()))
    for j in darr:
        arr[j] = True
for i in range(len(arr)):
    if arr[i] == False:
        count+=1
print(count - 1)

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

lst = [0] * N 

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

print(lst.count(0))

Solution (Python):
x,*l=open(0)
print(int(x.split()[0])-len({*''.join(l[1::2]).split()}))

Solution (Python):
n, k = map(int, input().split())
snukes = [0] * n
for _ in range(k):
  d = int(input())
  a = map(int, input().split())
  for i in a:
    snukes[i - 1] += 1
 
print(snukes.count(0))

Solution (Python):
(n,_),*t=[t.split()for t in open(0)][::2]
print(int(n)-len(set(sum(t,[]))))

Solution (Python):
(n,_),*t=[t.split()for t in open(0)][::2]
print(int(n)-len(set(sum(t,[]))))

Solution (Python):
import collections
N,K = map(int, input().split())
myMap = collections.defaultdict(int)
for i in range(K):
    input()
    withSnack =  list(map(int, input().split(" ")))
    for j in withSnack:
        myMap[j] += 1
for d in myMap.keys():
    N -= 1
print(N)

Solution (Python):
import sys
input = lambda:sys.stdin.readline().strip()
n,k = map(int,input().split())
vis = [False]*n
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for i in a:
        vis[i-1]=True
ans = vis.count(False)
print(ans)

Solution (Python):

def main():
    N, K = map(int, input().split())
    has_snacks = set()
    for _ in range(K):
        _ = input()
        has_snacks |= set(map(int, input().split()))
    print(N - len(has_snacks))


if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

n,k=map(int,input().split())
ans = [0]*n
for _ in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for x in a:
        ans[x-1] += 1
cnt = 0
for i in range(n):
    if ans[i] == 0:
        cnt += 1
print(cnt)

Solution (Python):
N, K = map(int, input().split())
A = [0] * N

for i in range(K):
    d = int(input())
    targets = list(map(int, input().split()))
    for j in range(d):
        index = targets[j] -1
        A[index] = 1

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

print(count)

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

a = []

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        if j not in a:
            a.append(j)

ans = 0

for i in range(1,N+1):
    if i not in a:
        ans += 1

print(ans)

Solution (Python):
import numpy as np

N,K=map(int,input().split())
L=[]
for i in range(K):
  d=int(input())
  A=np.array(list((map(int,input().split()))))
  A=np.unique(A)
  for a in A:
    if not(a in L):
      L.append(a)
print(N-len(L))

Solution (Python):
N, K = map(int, input().split())
L = [1 for i in range(N)]
for k in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for i in range(d):
    L[A[i] - 1] = 0
print(sum(L))

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

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

ans=0
for i in l:
    if i==0:
        ans+=1

print(ans)

Solution (Python):
def solve():
    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):
            if sunuke[a[j]-1] == 0:
                sunuke[a[j]-1] = 1
    print(sunuke.count(0))
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
import collections

dic = collections.defaultdict(int)

N, K = map(int, input().strip().split())
for i in range(K):
  di = map(int, input().strip())
  A = map(int, input().strip().split())
  for j in A:
    dic[j] += 1

ans = 0
for i in range(1, N+1):
  if dic.get(i) is None:
    ans += 1

print(ans)

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

member = list(range(1, n+1))

for i in range(0,k):
    a = int(input())
    if a == 1:
        b = int(input())
        if b in member:
            member.remove(b)
        else:
            pass
    else:
        b = list(map(int, input().split()))
        for j in range(0,a):
            if b[j] in member:
                member.remove(b[j])
            else:
                pass

print(len(member))

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

snuke = [0]*N

for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  
  for j in range(d):
    if snuke[A[j]-1] == 0:
      snuke[A[j]-1] = 1
      N = N-1
      
print(N)

Solution (Python):



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


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

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

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

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

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

snuke = [] 
for i in range(n):
    snuke.append(0) 

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

print(n)

Solution (Python):
import numpy as np

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

A=[]
l=[]
for _ in range(K):
    d = map(int, input())
    l=list(map(int,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(np.count_nonzero(np.all(a==0, axis=1)))

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

ans = 0
l = []

for i in range(k):
    x = int(input())
    d = list(map(int,input().split()))
    l.extend(d)

for j in range(1,n+1):
    if j not in l:
        ans += 1

print(ans)

Solution (Python):
N, K = input().strip().split(" ")
N = int(N)
K = int(K)
checkbox = [False for i in range(N)]
for k in range(K):
    input()
    seq = input().strip().split(" ")
    for j in seq:
        checkbox[int(j)-1] = True
print(checkbox.count(False))

Solution (Python):
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(1,NK[0]+1):
    if table.count(j) != 0:
      ans[j-1] = 1
print(NK[0]-sum(ans))

Solution (Python):
n,k = map(int,input().split())
ans = []
for _ in range(k):
    d = int(input())
    ans += list(map(int,input().split()))
print(n - len(set(ans)))

Solution (Python):
def run():
  N, K = map(int, input().split())
  C = [0] * N
  counter = 0
  for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    
    for j in range(d):
      C[A[j]-1] += 1
  
  for i in range(N):
    if C[i]==0:
      counter+=1
    else:
      pass
  print(counter)

if __name__ == "__main__":
  run()

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

Solution (Python):
total, kinds = map(int, input().split())

l = [False]*total

for i in range(kinds):
    non = input()
    people = list(map(int, input().split()))
    for j in range(len(people)) :
        l[people[j]-1] = True
    
print(l.count(False))

Solution (Python):



def solve(*args: str) -> str:
    n, k = map(int, args[0].split())

    T = set()
    for A in args[2::2]:
        T |= set(map(int, A.split()))

    return str(n-len(T))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Solution (Python):
import numpy as np

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

p = np.zeros(n)


for i in range(k):
  input()
  l = np.array(list(map(int, input().split())))
  p[l-1] += 1

print(len(np.where(p==0)[0]))

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

Solution (Python):
import sys

L = []
"""
while True:
    l = input()
    if l == "":
        break
    else:
        L.append(list(map(int,l.split())))
        print(L)
"""
N,K = list(map(int,input().split()))



for a in range(2 * K):
    n = list(map(int,input().split()))
    L.append(n)



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

new_L = L[1::2]


new_LL = sum(new_L, [])
for n in new_LL:
    if n in Num:
        Num.remove(n)

print(len(Num))

Solution (Python):
N, K = map(int, input().split())
d = []


C = [0 for i in range(N+1)]
for i in range(K):
    d.append(input())  

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


    for v in A:
        C[v-1] = 1


print(N-sum(C))

Solution (Python):
N,K = map(int,input().split())
pos = set()
for i in range(K):
    d = int(input())
    A = map(int,input().split())
    for x in A:
        pos.add(x)
ans = 0
for i in range(1,N+1):
    if i not in pos:
        ans += 1
print(ans)

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

print(sum(a))

Solution (Python):
N, K = [int(ipt) for ipt in input().split(' ')]

sunukekuns = [str(i+1) for i in range(N)]

for k in range(K):
  _ = input()
  sunukekun = input().split(' ')
  for kun in sunukekun:
    if kun in sunukekuns:
      sunukekuns.remove(kun)

print(len(sunukekuns))

Solution (Python):
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 9)


def input():
    return stdin.readline().strip()


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

s = set()
for i in range(K):
    d = int(input())
    s |= set(map(int, input().split()))

ans = N - len(s)
print(ans)

Solution (Python):
N, K = map(int, input().split())
ans = [True]*N
for i in range(K):
  d = int(input())
  l = list(map(int, input().split()))
  for a in l:
    ans[a-1] = False
print(sum(ans))

Solution (Python):
N,K=map(int,input().split())
A=[list(map(int,input().split())) for i in range(K*2)]
count=0
a=0
for i in range(K):
    del A[i]
a_list=[]
for i in range(K):
    for j in range(len(A[i])):
        a_list.append(A[i][j])
for i in range(1,N+1):
    
    
    if (i in a_list)==True:
        count+=1

print(N-count)

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




has_snack = set()  
for i in range(K):
    d = int(input())  
    A = set(map(int, input().split()))  
    has_snack |= A  


print(N-len(has_snack))

Solution (Python):
N, K = map(int, input().split())
has_snack = [False]*N



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




print(N - sum(has_snack))

Solution (Python):
n,k = map(int,input().split())
t = [1]*n
for i in range(k):
    input()
    for j in map(int,input().split()):
        t[j-1] = 0
print(sum(t))

Solution (Python):
a,b = map(int,input().split())
lis = [0]*a
for i in range(b):
  c = int(input())
  d = input().split()
  
  for l in range(c):
    lis[int(d[l])-1] += 1
    
count = 0
for i in range(a):
  if(lis[i] == 0):
    count += 1

print(count)

Solution (Python):
n,k=map(int,input().split())
a=set()
for i in range(k):
  d=input()
  for j in input().split():
    a.add(j)
print(n-len(a))

Solution (Python):

n, k = map(int, input().split())
d = []
a = []

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

check = [False] * n

for i in range(k):
    for j in a[i]:
        check[j-1] = True

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

print(ans)

Solution (Python):
N, K =map(int, input().split())
snuke = [0]*N

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

print(snuke.count(0))

Solution (Python):
s = []
n, k = map(int, input().split())
for i in range(n):
    s.append(0)
for i in range(k):
    m = int(input())
    na = list(map(int, input().split()))
    for j in na:
        s[j - 1] = 1
         
print(s.count(0))

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

Solution (Python):
N,K = map(int,input().split())
check = N*[0]

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

print(check.count(0))

Solution (Python):
n,k = input().split()
n = int(n)
k = int(k)
s = set()
for _ in range(k):
  m = int(input())
  l = list(map(int, input().split()))
  for item in l:
    s.add(item)

print(n-len(s))

Solution (Python):
n, k = map(int, input().split())
a = [list(map(int, input().split())) for i in range(2*k)]
ans = [0]*n
for i in range(k):
    for j in range(a[i*2][0]):
        s = a[i*2+1][j]
        ans[s-1] += 1
ans = [str(i) for i in ans]
print(ans.count('0'))

Solution (Python):
n, k = [int(x) for x in input().split()]
s = set()
for _ in range(k):
    d = int(input())
    s |= set(int(x) for x in input().split())
print(sum(1 for i in range(1, n + 1) if i not in s))

Solution (Python):
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()



N, K = In.ints()

has = [0]*(N+1)
for i in range(K):
    d = In.int()

    for snuke in In.ints():
        has[snuke]+=1

ans = 0

for h in has:
    if h==0:
        ans+=1

Out.int(ans-1)
 


if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Solution (Python):
n, k  = map(int, input().split())
snuke = []
for i in range(k):
    d = int(input())
    nums = list(map(int, input().split()))
    for j in nums:
        snuke.append(j)
ans = n-len(set(snuke))
print(ans)

Solution (Python):
n,k = map(int,input().split())
e=[]
for i in range(k):
  s= int(input())
  l=list(map(int,input().split()))
  e=e+l
r=set(e)
print(n-len(r))

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

has_snack = set()
for i in range(K):
    d = int(input())
    A = set(map(int, input().split()))
    has_snack |= A

print(N-len(has_snack))

Solution (Python):
N,K = map(int,input().split())
s = [input() for i in range(K*2)]
l = []
c = 0
k = 0
m = 0
f = []

num = []
for i in range(K*2):
  if i%2==1:
    for m in range(int(s[i-1])):
      num.append(s[i].split()[m])
for j in range(1,N+1):
  f.append(num.count(str(j)))
print(f.count(0))

Solution (Python):
n, k = map(int, input().split())
d = [0] * k
sunuke = {}
for i in range(n):
    sunuke.setdefault(str(i), 0)
    

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

ans = list(sunuke.values()).count(0)

print(ans)

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

Solution (Python):
num_sunuke, num_okashi_kind = map(int, input().split())
sunuke = [0] * (num_sunuke+1)

ans = 0
for idx_okashi_kind in range(1, num_okashi_kind+1) :
    num_have_okashi = int(input())
    idx_sunuke_with_okashi = map(int,input().split())

    for i in range(1, num_have_okashi+1) :
        for j in idx_sunuke_with_okashi :
            sunuke[j] = 1

for s in sunuke :
    if s == 1 :
        ans = ans + 1

print(num_sunuke - ans)

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

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

A = [-1] * n

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

ans = 0

for i in range(n):
    if A[i] == -1:
        ans += 1

print(ans)

Solution (Python):
N, K = map(int, input().split())
has_snack = [False]*N

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

print(N-sum(has_snack))

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    Count = [0] * N
    for k in range(K):
        d = int(input())
        A = [int(a) - 1 for a in input().split()]
        for a in A: Count[a] += 1
    print(Count.count(0))

    return 0

if __name__ == "__main__":
    solve()

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

Solution (Python):
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n, k = map(int, input().split())
check = [0]*(n)
for _ in range(k):
    d = int(input())
    a = readints()
    
    
    for i in range(d):
        check[a[i]-1] = a[i]
cnt = 0
for i in range(len(check)):
    if check[i] == 0:
        cnt += 1
print(cnt)

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

sunuke = []

for i in range(0,k):
    d = int(input())
    a = list(map(int,input().split()))
    sunuke +=a

print(n-len(set(sunuke)))

Solution (Python):
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.extend(numlist[i])
    i+=1
    
ans=0
j=0
while j<N:
    check=j+1
    if check not in anslist:
        ans+=1
    j+=1
    
print(ans)

Solution (Python):
n, k = map(int, input().split())
s = set([])
for i in range(k):
    d = int(input())
    s |= set(list(map(int, input().split())))
print(n - len(s))

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


sunuke =[0] * n
for i in range(k):
    
    for j in range(int(d[i])):
        temp = a[i][j] -1 
        sunuke[temp] += 1


print(sunuke.count(0))

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

s = set()


for i in range(K):
  d = int(input())
  ad = list(map(int,input().split()))
  for a in range(d):
    s.add(ad[a])

print(N - len(s))

Solution (Python):
N,K = map(int, input().split())
p = []
for s in range(1,N+1):
    p.append(s)
for i in range(K):
    d = int(input())
    A = [int(x) for x in input().split()]
    B = len(A)
    for i in range(B):
        if A[i] in p:
            p.remove(A[i])
ans = len(p)
print(ans)

Solution (Python):
n, k = map(int, input().split())
s = [0 for i in range(n)]
for z in range(k):
	hoge = input()
	l = list(map(int, input().split()))
	for i in l:
		s[i-1] += 1

def fuga(x): return x==0

print(len(list((filter(fuga, s)))))