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):
n,k=[int(x) for x in input().split()]

a=[]

for i in range(n+1):
	a.append(0)

for i in range(k):
	d=int(input())
	temp=[int(x) for x in input().split()]
	for j in range(d):
		a[temp[j]]=1

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

print(ans)

Solution (Python):
from collections import defaultdict,deque
import sys, bisect, math, itertools
from functools import lru_cache

sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

n, k = inpl()
ans={i for i in range(1,n+1)}
for i in range(k):
    d = inp()
    a=set(map(int, input().split()))
    ans -= a
print(len(ans))

Solution (Python):
(N, K) = tuple([int(s) for s in input().split()])
d = {i: 0 for i in range(1, N + 1)}
for _ in range(K):
    n = int(input())
    A = [int(s) for s in input().split()]
    for a in A:
        d[a] += 1
print(len([i for i in d if d[i] == 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 A:
        L[j-1] += 1
print(len([i for i in L if i == 0]))

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

b=[0]*N

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

    for ai in a:
        b[ai-1]-=1

print(b.count(0))

Solution (Python):

"""
Created on Sun May  3 20:56:39 2020
"""

import sys


sys.setrecursionlimit(10 ** 9)


mod = 10**9+7


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







su = [False for _ in range(N)]

for _ in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for a in A:
        su[a-1] = True

ans = 0
for s in su:
    if not s:
        ans += 1
print(ans)

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

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

Solution (Python):
def main():
    n,k = map(int,input().split(" "))
    l =[True]*n
    for i in range(k):
        d = int(input())
        As = list(map(int,input().split(" ")))
        for A in As:
            l[A-1] = False
    
    print(l.count(True))
main()

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

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

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

l = []
for _ in range(K):
    d = input().rstrip()
    As = [int(x) for x in input().rstrip().split()]
    l.extend(As)
    
print(N - len(set(l)))

Solution (Python):


N, K = map(int, input().split(' '))
l = []
for _ in range(K):
    d = input()
    i = input().split(' ')
    l += i
    l = list(set(l))

print(N - len(l))

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

print(sum(people))

Solution (Python):
import sys
sys.setrecursionlimit(10000000)


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

    num = 0
    for i in range(N):
        if nums[i] == 0:
            num += 1

    print(num)


if __name__ == '__main__':
    main()

Solution (Python):
N, K = (int(i) for i in input().split())  
lis = [0] * N 

for _ in range(K):
  d = int(input())
  A = [int(i) for i in input().split()] 
  for a in A:
    if lis[a-1] == 0:
      lis[a-1] = 1
      
print(N - sum(lis))

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 j in a:
        ans[j-1]=1
print(n-sum(ans))

Solution (Python):
from sys import stdin
[N, K] = [int(x) for x in stdin.readline().rstrip().split()]

sunuke = [0 for _ in range(N)]
for i in range(K):
    d = int(stdin.readline().rstrip())
    As = [int(x) for x in stdin.readline().rstrip().split()]
    for j in range(d):
        sunuke[As[j]-1] += 1

tot = 0    
for i in range(N):
    if sunuke[i] ==0:
        tot+=1

print(tot)

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

Solution (Python):

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


p_list = [0]*N


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


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


print(ans)

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

count = [1]*n

for i in range(k):
  m = int(input())
  lst = list(map(int, input().split()))
  for j in range(m):
    if count[lst[j]-1] == 1:
      count[lst[j]-1] = 0

print(sum(count))

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

count = [0 for _ in range(n)]

for i in range(k):
    input()
    snk = [int(a)-1 for a in input().split()]
    for j in snk:
        count[j] += 1

ans = 0
for c in count:
    if c == 0:
        ans += 1

print(ans)

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


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

print(boys.count(0))

Solution (Python):
N, K = map(int,input().split())
sunuke = [0]*N
for k in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for a in A:
    sunuke[a-1] = 1

print(N-sum(sunuke))

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

suke = set()
for _ in range(k):
  _ = input()
  suke |= set([int(i) for i in input().split()])
  
l = list(set(range(1,n+1)) - suke)
print(len(l))

Solution (Python):
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


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


if __name__ == '__main__':
    main()

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

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

ans = [False]*N
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(len(A)):
        ans[A[j]-1] = True

cnt = 0
for i in range(len(ans)):
    if(ans[i] == False):
        cnt += 1
print(cnt)

Solution (Python):
from collections import defaultdict
N, K = [int(x) for x in input().split()]
snukes = defaultdict(list)
for i in range(K):
    d, = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]
    for x in A:
        snukes[x].append(i)
count = 0
for i in range(1, N + 1):
    if len(snukes[i]) == 0:
        count += 1
print(count)

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

Solution (Python):
N, K = map(int,input().split(' '))
sunuke=set()
for k in range(K):
    d=int(input())
    a=list(map(int,input().split(' ')))
    for i in range(d):
        sunuke.add(a[i])

print(N-len(sunuke))

Solution (Python):
n,k= list(map(int, input().split()))
s=set()
for i in range(k):
    d=int(input())
    a=set(map(int,input().split()))
    s|=a

print(n-len(s))

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

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,K = map(int, readline().split())

    D = [0] * N
    for i in range(K):
        d = int(readline())
        A = [int(i) for i in readline().split()]
        for a in A:
            D[a-1] += 1
    
    ans = 0
    for i in D:
        if i == 0:
            ans += 1
    
    print(ans)


if __name__ == "__main__":
    main()

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

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

ans = 0
for x in snk:
  if(x == 0): 
    ans += 1
print(ans)

Solution (Python):
n,k = map(int,input().split())
ans = [i for i in range(1,n+1)]
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        if j in ans:
            ans.remove(j)
print(len(ans))

Solution (Python):
def resolve():
    n, k = map(int, input().split())
    sunuke = [0]*n
    man = []
    for i in range(k):
        d = int(input())
        a = list(map(int, input().split()))
        for j in a:
            if sunuke[j-1] == 0:
                sunuke[j-1] = 1
    print(n-sum(sunuke))

resolve()

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

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

answer = len([person[i] for i in range(n) if person[i]==0])

print(answer)

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

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

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

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

print(ans)

Solution (Python):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

checked = [0] * N
for _ in range(K):
    d = int(readline())
    A = list(map(int1, readline().split()))
    for a in A:
        checked[a] += 1

cnt = sum([c == 0 for c in checked])
print(cnt)

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

for i in range(k):
  d = int(input())
  oyatu = list(map(int, input().split()))
  for i in oyatu:
    n[i-1]+=1
  
  
count = 0
for i in n:
  if i == 0:
    count+=1
print(count)

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

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

    print(sunukes.count(0))



if __name__ == '__main__':
    main()

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

    sunuke = {i:0 for i in range(N)}

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

    answer = 0

    for i in range(N):
        if sunuke[i] == 0:
            answer += 1

    print(answer)


if __name__ == '__main__':
    main()

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

sunuke = [0]*n

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

    for candidate in c:
        sunuke[candidate-1] = 1

print(sunuke.count(0))

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

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

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

print(ans)

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



have_not = [0] + [1] * N
for i in range(K):
    for j in range(len(A[i])):
        
        have_not[A[i][j]] = 0


print(sum(have_not))

Solution (Python):
from collections import Counter
N, K = map(int, input().split())
l = [0]*N
for i in range(K):
    d = int(input())
    tmp = list(map(int, input().split()))
    for j in tmp:
        l[j-1] += 1

c = Counter(l)
print(c[0])

Solution (Python):
n, k = map(int, input().split())
s = set(range(1, n+1))
for _ in range(k):
    d = input()
    for i in map(int, input().split()):
        s.discard(i)
print(len(s))

Solution (Python):
inpl = lambda: list(map(int,input().split()))
N, K = inpl()
B = set()
for _ in range(K):
    d = int(input())
    A = set(inpl())
    B |= A
print(N - len(B))

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

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

    ans = []

    for _ in range(K):
        tmp = input()
        ans.extend(list(map(int,input().split())))
    
    ans_num = N-len(set(ans))

    print(ans_num)

if __name__ == "__main__":
    main()

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

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

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

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

D = []
A = []
for i in range(K):
    D.append(int(readline()))
    A.append(list(map(int, readline().split())))

import itertools

a = set(itertools.chain.from_iterable(A))
print(N - len(a))

Solution (Python):


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

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

Solution (Python):
N, K = map(int, input().split())
box = set()
for i in range(K):
    temp = int(input())
    temp2 = set(map(int, input().split()))
    for j in temp2:
        box.add(j)

ans = 0
for i in range(1, N+1):
    if i not in box:
        ans += 1
print(ans)

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)




















dd = {}
N,K = map(int,input().split())
for _ in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for j in A:
        if j not in dd.keys():
            dd[j] = 1
print(N-len(dd))

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

print(ans)

Solution (Python):
n, k = map(int, input().split())
sunukes = set()
for i in range(1, n + 1):
    sunukes.add(i)

for _ in range(k):
    d = int(input())
    for i in list(map(int, input().split())):
        sunukes.discard(i)

print(len(sunukes))

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

have = [0 for _ in range(N)]
for _ in range(K):
    d = int(input())
    a = [int(v) for v in input().split()]
    for v in a:
        have[v-1] += 1

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

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 a_i in a:
    sunuke[a_i-1] += 1
sum_sunuke = 0
for sunuke_i in sunuke:
  if sunuke_i == 0:
    sum_sunuke += 1
print(sum_sunuke)

Solution (Python):

''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    n, k = _ia()
    ans = set()
    for _ in range(k):
        _ = _i()
        ans |= set(_ia())
    return n - len(ans)


if __name__ == "__main__":
    print(main())

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

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

print(sum(trick))

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

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


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

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


if __name__ == '__main__':
    main()

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

l=[0]*n

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

cnt=0
for ll in l:
    if 0==ll:
        cnt+=1

print(cnt)

Solution (Python):
n,k = map(int, input().split())
d = []
a_s = []
for _ in range(k):
    d.append(int(input().strip()))
    a = list(map(int, input().split()))
    a_s += a
a_s = set(a_s)
count = 0
for i in range(1, n + 1):
    if i not in a_s:
        count += 1
print(count)

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

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







count = [0]*n

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

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

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

a = [0]*n

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

Solution (Python):
N, K = map(int, input().split())
ds = []
As = []
for i in range(K):
    ds.append(int(input()))
    As.extend(list(map(int, input().split())))

all_sunuke = set(range(1, N+1))
some = set(As)
print(len(all_sunuke - some))

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 person in a:
        sunuke[person - 1] += 1

print(sunuke.count(0))

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

check=[0]*N

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

ans=0
for c in check:
    if c==0:
        ans+=1
print(ans)

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

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

Solution (Python):
n,k = map(int, input().split())
d = []
a = []
for _ in range(k):
    d1 = int(input())
    A = list(map(int, input().split()))
    d.append(d1)
    a.append(A)
ans = [0] * n
for s in a:
    for v in s:
        ans[v-1] = 1
print(ans.count(0))

Solution (Python):



import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, K = i2nn()
    sunuke = [1] * N
    for _ in range(K):
        i2s()
        for A in i2nn():
            sunuke[A - 1] = 0
    print(sum(sunuke))
    return

main()

Solution (Python):
n,k=map(int,input().split())
sunuke=set(range(1,n+1,1))
for i in range(k):
    d=int(input())
    okashi=set(map(int,input().split()))
    sunuke-=okashi
print(len(sunuke))

Solution (Python):

import os
import sys
from io import BytesIO, IOBase


def main():
    n,k=map(int,input().split())
    a=[True]*n
    for _ in range(k):
        _=input()
        for x in map(int,input().split()):
            a[x-1]=False
    print(sum(a))


BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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

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

As_has_okashi = [False for i in range(N)]

for _ in range(K):
    d = int(input())
    As = list(map(int, input().split()))
    for i in range(d):
        As_has_okashi[As[i]-1] = True

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

print(count)

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

ans = 0
lis = [0]*N
for _ in range(K):
    d = int(input())
    Ns = list(map(int, input().split()))
    for j in range(d):
        lis[Ns[j]-1] = 1

print(N-sum(lis))

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

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

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

print(N - len(s))

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

sunukes = [False] * N

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

    for a in As:
        sunukes[a-1] = True    

cnt = 0
for v in sunukes:
    if not v:
        cnt += 1

print(cnt)

Solution (Python):















mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

def main():
    n,k = readInt()
    poss = set()
    for i in range(k):
        d = int(input())
        a = readInt()
        for x in a:
            poss.add(x)
    ans = 0
    for i in range(1,n+1):
        if i not in poss:
            ans += 1
    print(ans)
    return

if __name__=='__main__':
    main()

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

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

print(sum(ans))

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

Solution (Python):
N, K = list(map(int, input().split()))
treated = set()
for i in range(K):
    _ = input()
    
    treated = treated | (set(list(map(int, input().split()))))
print(len([x for x in range(N) if not x+1 in treated]))

Solution (Python):
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

MOD = 10 ** 9 + 7
INF = 10 ** 18

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

cnt = [0] * (N + 1)
for i in range(2 * K):
    q = input()
    if i % 2:
        lst = list(map(int, q.split()))
        for l in lst:
            cnt[l] = 1
    
ans = 0        
for i in range(1, N + 1):
    if cnt[i] == 0:
        ans += 1

print(ans)

Solution (Python):
import math

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

p = [0] * n

for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for m in a:
        p[m-1] += 1

ans = 0

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

print(ans)

Solution (Python):

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


if __name__ == '__main__':
    main()

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

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

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for p in A:
        res.add(p)

print(N-len(res))

Solution (Python):


N, K = map(int, input().split())
H = [0] * N

for i in range(K):
    d = int(input())
    A = list(int(x) for x in input().split())
    for j in A:
        H[j-1] += 1

print(H.count(0))

Solution (Python):

"""
Created on Sun May  3 20:55:32 2020

@author: Kanaru Sato
"""

n,k = list(map(int, input().split()))
dic = {}
for i in range(k):
    d = int(input())
    l = list(map(int, input().split()))
    for j in range(d):
        if l[j] not in dic:
            dic[l[j]] = 1
        
count = 0
for i in range(1,n+1):
    if i not in dic:
        count += 1
print(count)

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

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

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

print(cnt)

Solution (Python):

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

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

    kids = [0]*n

    for aa in a:
        for aaa in aa:
            kids[aaa-1] = 1

    print(n-sum(kids))


if __name__ == "__main__":
    main()

Solution (Python):
N, K = map(int, input().split())
ans = [1]*N
for i in range(K):
    d = int(input())
    okashi = [int(num) for num in input().split()]
    
    for j in range(d):
        ans[okashi[j]-1] = 0

print(sum(ans))

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

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

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

print(t.count(0))

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

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

ans = [True for _ in range(N)]

for _ in range(K):
    d = int(input())
    okasi = list(map(int, input().split()))
    for o in okasi:
        ans[o-1] = False

print(sum(ans))

Solution (Python):
n, k = map(int, input().split())
s = set(range(1, n+1))
for i in range(k):
    d = int(input())
    for a in map(int, input().split()):
        s.discard(a)
print(len(s))

Solution (Python):
if __name__ == '__main__':
    n, k = map(int, input().split())
    count = 0
    list = []
    for i in range(k):
        b = int(input())
        c = [int(i) for i in input().split()]
        list.extend(c)
    setList = set(list)
    print(n - len(setList))

Solution (Python):


n, k = map(int, input().split())
kun_list = [1] * n
for i in range(0, k):
    d = int(input())
    a_list = list(map(int, input().split()))
    for a in a_list:
        kun_list[a-1] = 0
print(sum(kun_list))

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

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n,k = map(int,input().split())
A = []
D = []
p = [0 for i in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(len(a)):
        p[a[j]-1]+=1
cnt = 0
for i in range(len(p)):
    if p[i] == 0:
        cnt+=1
print(cnt)