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):
import sys, math
import bisect, heapq
import collections

sys.setrecursionlimit(10 ** 6)

input = sys.stdin.readline

gets = lambda: input().rstrip()
getn = lambda: int(input())
getmul = lambda: (int(i) for i in input().split())
getlist = lambda: [int(i) for i in input().split()]

n, k = getmul()
snukes = [1 for _ in range(n + 1)]
for _ in range(k):
    d = getn()
    A = getlist()
    for snuke in A:
        snukes[snuke] = 0

print(sum(snukes) - 1)

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

for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for j in A:
        sunuke[j-1] = True
        
for person in sunuke:
    if not person:
        ans += 1

print(ans)

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

B = set(A)
sunuke = len(B)
print(N-sunuke)

Solution (Python):


N, K = map(int, input().split())
N_list = [0]*N
A = []
cnt = 0

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

print(N_list.count(0))

Solution (Python):
n, k = map(int, input().split())
ans = [0]*n
for i in range(n): ans[i] = set()
for i in range(k):
    input()
    *a, = map(int, input().split())
    for j in a: ans[j-1].add(i+1)
print(sum(len(i)==0 for i in ans))

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

have = 0
d = set()
for _ in range(k):
    have += int(input())
    tmp = [int(i) for i in input().split()]
    for t in tmp:
        d.add(t)

print(n-len(d))

Solution (Python):
import sys
import numpy as np

n,k=map(int,sys.stdin.readline().split())
ans=[0]*n
cnt=0
for i in range(k):
    d=int(sys.stdin.readline())
    a=sys.stdin.readline().split()
    for j in a:
        ans[int(j)-1]=1
for i in range(n):
    if ans[i]==0:
        cnt+=1
print(cnt)

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

Solution (Python):
import numpy as np

N, K = map(int,input().split())
d_list = []
A_list = []
sunuke = np.ones(N)

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

    for j in range(d):
        sunuke[A_list[j]-1] -= 1

nokori = sunuke[sunuke > 0]
print(len(nokori))

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")


def solve():
    n, k = LI()
    ans = [1] * n
    for _ in range(k):
        d = II()
        a = LI_()
        for ai in a:
            ans[ai] = 0
    print(sum(ans))
    return



if __name__ == '__main__':
    solve()

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

for k in range(K):
    d_i = int(input())
    holder_list = [int(x) for x in input().split(" ")]

    for hi in holder_list:
        A[hi-1] += 1

count_non_holder = 0
for a in A:
    if a == 0:
        count_non_holder += 1

print(count_non_holder)

Solution (Python):
def io():
    return map(int,input().split())
def op():
    return list(map(int,input().split()))
n,k=io()
s=set()
c=0
for _ in range(k):
    d=int(input())
    s.update(op())
for i in range(1,n+1):
    if i not in s:
        c+=1
print(c)

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

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

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

sunuke = [False] * N

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

print(len(list(filter(lambda x:not x, sunuke))))

Solution (Python):
import numpy as np
n,k = [int(j) for j in input().split()]
r = np.full(n,False)
for i in range(k):
    d = int(input())
    a = [int(j) - 1 for j in input().split()]
    for j in a:
        r[j] = True
print(n - len(r[r]))

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

max_n = 0
result = set()
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        result.add(j)

print(N - len(result))

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

an = []
for i in a_l:
  for j in i:
    if j not in an:
      an.append(j)
print(n - len(an))

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

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

Solution (Python):
"""
ある街に、N 人のすぬけ君(すぬけ君 1 、すぬけ君 2 、 ...、 すぬけ君 N)が住んでいます。
この街には、 K種類のお菓子(お菓子 1 、 お菓子 2 、....、お菓子 K )が売られています。
お菓子 i を持っているのは、すぬけ君 Ai,1,Ai,2,⋯,Ai,di の計 di人です。
高橋君は今からこの街を回り、お菓子を 1つも持っていないすぬけ君にいたずらをします。
このとき、何人のすぬけ君がいたずらを受けるでしょうか。
制約

    入力は全て整数
    1≤N≤100

1≤K≤100
1≤di≤N
1≤Ai,1<⋯<Ai,di≤N
"""
n,k=map(int,input().split())
a=[[] for ii in range(k)]
d=[0]*k
r=[1]*n
for ii in range(k):
  d[ii]=int(input())
  a[ii]=[]*d[ii]
  a[ii][:]=map(int,input().split())
  for jj in range(d[ii]):
    r[a[ii][jj]-1]=0
print(sum(r))

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

from collections import defaultdict
from sys import exit
import math


def main():
    n, m= getList()
    snu = [0 for _ in range(n)]

    for _ in range(m):
        a = getN()
        nums = getList()
        for num in nums:
            snu[num-1] += 1
    ans = 0
    for sn in snu:
        if sn == 0:
            ans += 1

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

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

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

l=[]

for x in range(k):
    for y in a[2*x+1]:
        l.append(y)
print(n-len(set(l)))

Solution (Python):
N,K = map(int, input().split())
AD = []
D = []
A = []
for i in range(K):
    D_temp = input()
    A_temp = input().split()
    AD.append([[D_temp],[A_temp]])
    D.append(D_temp)
    for i2 in A_temp:
        A.append(i2)
print(N - len(set(A)))

Solution (Python):
input_line = input().split(" ")
N, K = list(map(int, input_line))
A_i = []
for i in range(K):
	d_i = int(input())
	A_i = A_i + list(map(int, input().split(" ")))

A_i = set(A_i)
print(N - len(A_i))

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

Solution (Python):
l1=input().split(" ")
n=int(l1[0])
k=int(l1[1])
list=[range(n)]
kashi=[]
for i in range(k):
  tmp=input()
  num=input().split(" ")
  for j in num:
    kashi.append(j)
kashi=set(kashi)
print(n-len(kashi))

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

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

snack_cnt = set()

for _ in range(K):
    d = int(input())
    array = [int(i) for i in input().split()]
    for p in array:
        snack_cnt.add(p)

print(N - len(snack_cnt))

Solution (Python):
n,k=map(int,input().split())
hashmap=dict()
for _ in range(k):
  d=int(input())
  arr=[int(p) for p in input().split()]
  for key in arr:
    hashmap[key]=d
count=0
for i in range(1,n+1):
  if hashmap.get(i)==None:
    count+=1
print(count)

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,K=MI()
    used=[0]*N
    for i in range(K):
        d=I()
        A=LI()
        for j in range(d):
            used[A[j]-1]=1
            
    print(N-sum(used))
        
    

main()

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

have = set()

for i in range(k):
    d = int(input())
    astr = input()
    ai = astr.split(' ')
    for a in ai:
        have.add(int(a))

print(n-len(have))

Solution (Python):
N,K=map(int,input().split())
Okashi=[0 for _ in range(N)]
for _ in range(K):
    d=int(input())
    Ai= list(map(int,input().split()))
    for a in Ai:
        Okashi[a-1]+=1

print(Okashi.count(0))

Solution (Python):
import numpy as np

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

mat = np.array([[False] * N for i in range(K)])

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

mat = mat.T

ans = 0
for i in range(N):
    flg = False
    for j in range(K):
        if mat[i][j]:
            flg = True

    if not flg:
        ans += 1

print(ans)

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

for k in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        result[a-1] = 1
    A.clear()

ans = 0

for r in result:
    if r == 0:
        ans += 1

print(ans)

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

for i in range(k):
  d = int(input())
  if d == 1:
    ans_list.append(int(input()))
  else:
    ans_list[len(ans_list):len(ans_list)] = map(int, input().split())

print(n - len(list(set(ans_list))))

Solution (Python):
n, k = [int(i) for i in input().split(' ')]
counts = [0 for i in range(n)]
ans = 0
for i in range(k):
  input()
  for owner in [int(o) for o in input().split(' ')]:
    counts[owner - 1] = 1
for i in range(n):
  if counts[i] == 0:
    ans += 1 
print(ans)

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

Solution (Python):
import numpy as np

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

di = np.zeros((K), dtype='int64')
Ai = np.ones((N),  dtype='int8')

for i in range(K):
    di[i] = int(input())
    Sunuke = map(int, input().split())
    for s in Sunuke:
        Ai[int(s)-1] = 0
        
print (Ai.sum())

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

for i in range(k):
    d = int(input())
    lis = list(map(int, input().split()))
    for m in lis:
        ans[m-1] = 0

print(sum(ans))

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

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

ARR = []

for i in range(K):
    num = int(input())
    ele = list(map(int,input().split()))
    ARR.append({"num": num, "ele": ele})

def calculate(n, k, arr):
    result = {}
    for i in range(1, n + 1):
        result.__setitem__(i, False)

    for ar in arr:
        for sr in ar["ele"]:
            result.__setitem__(sr,True)
    tt = 0

    for index,res in result.items():
        if res == False:
            tt = tt + 1

    print(tt)


calculate(N, K, ARR)

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
N,K = [int(i) for i in readline().split()]
d = []
A = []
for _ in range(K):
  d.append(int(input()))
  A.append([int(i) for i in readline().split()])

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

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

l = [True]
for _ in range(n):
    l.append(False)
    
for _ in range(k):
    d = int(input())
    al = map(int, input().split())
    for a in al:
        if l[a] == False:
            l[a] = True
    
count = 0
for v in l:
    if v == False:
        count += 1
        
print(count)

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

Solution (Python):



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


def main():
    s = {i for i in range(1, N + 1)}
    for l in A:
        for a in l:
            if a in s:
                s.remove(a)

    ans = len(s)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N, K = map(int, input().split())
ans = [0 for _ in range(N)]
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for num in A:
        ans[num-1] += 1

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

print(count)

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

sunuke = []
for n in range(int(N)):
  sunuke.append([])
for k in range(int(K)):
  people = input()
  no = input().split()
  for i in no:
    sunuke[int(i)-1].append(int(K))
target = []
for i in range(int(N)):
  if len(sunuke[i]) == 0:
    target.append(i)
print(len(target))

Solution (Python):
N, K = map(int, input().split())
a = []
res = []
for k in range(K):
    d = input()
    for l in list(map(int, input().split())):
        a.append(int(l))
for i in range(1, N + 1):
    if a.count(i) == 0:
        res.append(i)
print(len(res))

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

su = [0] * n

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


    for j in range(d):

        su[tmp[j]-1] = su[tmp[j]-1] + 1

print(su.count(0))

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

x = list(range(1, n+1))
for i in range(k):
    for b in a[i]:
        if b in x:
            x.remove(b)
print(len(x))

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

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

ans = 0
for i in range(n) :
    check = 1
    for j in range(k) :
        if s[j][i] == 1 :
            check = 0
            break
    if check == 1 :
        ans += 1

print(ans)

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

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

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


resolve()

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

  for i in input_line:
    data[i-1] += 1

result = 0
for i in data:
  if i == 0:
    result += 1

print(result)

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


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

cnt = 0
for i in sunuke:
    if not i:
        cnt += 1
print(cnt)

Solution (Python):
n,k = map(int,input().split())
lst = [0] * n
ans = 0

for i in range(k):
  lenc = int(input())
  candy = input().split()
  for c in range(lenc):
    
    lst[int(candy[c])-1] += 1


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


print(ans)

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

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

a = {}
for i in range(n):
    a[i] = 0
    
for i in range(k):
    d = int(input())
    tmp  = list(map(int, input().split()))
    for t in tmp:
        a[t-1] = 1

print(len([k for k, v in a.items() if v == 0]))

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

print(N - len(set(sum(ans, []))))

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

Solution (Python):
N, K = map(int, input().split())
lst = []
for i in range(K):
    input()
    lst.append(list(map(int, input().split())))
res = [0 for i in range(N)]
for l in lst:
    for i in l:
        res[i-1] += 1
res1 = 0
for i in res:
    if i == 0:
        res1 += 1
print(res1)

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

s=list(s)

s.sort()

print(N-len(s))

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

d = {}
for i in range(N):
    d[i] = 0

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

c = 0
for i in d:
    if d[i] == 0:
        c += 1
        
print(c)

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

d = []
a = []

for i in range(k):
    di = int(input())
    ai = list(map(int, input().split()))
    d.append(di)
    a.append(ai)
dic = {}
for al in a:
    for aln in al:
        if aln not in dic:
            dic[aln] = aln    
print(n-len(dic))

Solution (Python):
N,K=[int(i) for i in input().split(" ")]
sunuke=[i for i in range(1,N+1)]
for i in range(K):
    d=[int(input())]
    A=[int(i) for i in input().split(" ")]
    for a in A:
        for i in range(len(sunuke)):
            if sunuke[i]==a:
                del sunuke[i]
                break
print(len(sunuke))

Solution (Python):
raw_input = list(map(int, input().split()))
n = raw_input[0]
k = raw_input[1]
sunuke = [0 for _ in range(n)]
for i in range(k):
    d = int(input().strip())
    a = list(map(int, input().split()))
    for j in a:
        sunuke[j-1] += 1
counter = 0
for i in sunuke:
    if i == 0:
        counter += 1
print(counter)

Solution (Python):
N, K = map(int,input().split())
ans = {i for i in range(1,N+1)}
A = set()
for i in range(K):
	d = int(input())
	A |= set(map(int,input().split()))
ans -= A
print(len(ans))

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

d=[0]*K
A=[[0]*K]*100
sunuke=[0]*N
count=N

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

print(count)

Solution (Python):
N, K = map(int,input().split())
ans = set(range(1,N+1))
for i in range(K):
    d = input()
    tmp = set(map(int,input().split()))
    ans = ans - tmp


print(len(ans))

Solution (Python):
N,K=map(int,input().split())
cnt=0
Z=[]
for i in range(K):
    d=int(input())
    A=[int(i) for i in input().split()]
    for t in A:
        Z.append(t)
print(N-len(set(Z)))

Solution (Python):
a=input().split()
N=int(a[0])
K=int(a[1])

d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    A.append([int(x) for x in input().split()])
ans=0
for i in range(1,N+1):
    index=0
    for j in range(K):
        if (i in A[j])==False:
            index+=1
    if index==K:
        ans+=1

print(ans)

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

okashi = set(list(range(1, n+1)))

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

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()))
    A = list(map(lambda x: x - 1, a))
    for j in range(d):
        ans[A[j]] = 0
print(sum(ans))

Solution (Python):
import numpy as np
N,K = map(int,input().split())
datas = np.zeros(N)
for i in range(K):
    n = int(input())
    A = list(map(int,input().split()))
    for a in A:
        datas[a-1] += 1
print(np.count_nonzero(datas == 0))

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

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

print(sunuke.count(1))

Solution (Python):
N, K = map(int, input().split())
d_list = []
A_list = []
for i in range(K):
    d_list.append(int(input()))
    A_list += list(map(int, input().split()))

A_list = list(set(A_list))
ans = 0
for A in range(1, N + 1):
    if A not in A_list:
        ans += 1

print(ans)

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

sunukes = [0 for i in range(n)]

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

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

r=0
for sunuke in sunukes:
  if sunuke == 0:
    r+=1

print(r)

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

for _ in range(k):
    _ = int(input())
    for a in input().split():
        if a in s:
            continue
        else:
            s.add(a)

print(n - len(s))

Solution (Python):

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

d = []
a = [0 for _ in range(n)]
for _ in range(k):
    d.append(int(input()))
    for i in input().split():
        a[int(i)-1] += 1
        
print(a.count(0))

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

people = [0] * n
for i in range(k):
    for j in range(len(a[i])):
        
        people[a[i][j] - 1] += 1

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

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

answer_list = [0]*N

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

Solution (Python):
N,K = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(K*2)]
T = [True for _ in range(N)]
for i in range(len(S)):
  if i%2 == 1:
    for s in S[i]:
      T[s-1] = False
      
print(sum(T))

Solution (Python):
def main():
    n, k = map(int, input().split())
    i = 0
    s = []
    for _ in range(k):
        d = int(input())
        v = map(int, input().split())
        s += list(v)

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


if __name__ == '__main__':
    main()

Solution (Python):


def main():
    n, k = map(int, input().split())
    okashi = set()
    for i in range(k):
        d = int(input())
        okashi |= set(list(map(int, input().split())))
    print(n - len(okashi))
    
if __name__ == '__main__':
    main()

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

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

ans=[1]*n

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

print(sum(ans))

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

c = []
for i in range(N):
    c.append(0)


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

print(c.count(0))

Solution (Python):
N, K = map(int, input().split())
d_a = [input() for _ in range(2 * K)]
length = len(d_a)
people = []
answer = []
for i in range(length):
    if i % 2 == 1:
        people.append(d_a[i])

for data in people:
    if len(data) > 1:
        data = data.split()
        for d in data:
            if d not in answer:
                answer.append(d)
    else:
        if data not in answer:
            answer.append(data)

print(N - len(answer))

Solution (Python):
import sys
import math
import bisect

def main():
    n, k = map(int, input().split())
    s = set()
    for i in range(1, n + 1):
        s.add(i)
    for i in range(k):
        d = int(input())
        for a in list(map(int, input().split())):
            if a in s:
                s.remove(a)
    print(len(s))

if __name__ == "__main__":
    main()

Solution (Python):
i = list(map(int, input().split()))
a=[]
c=[]
for j in range(i[0]):
    a.append(0)
for j in range(i[1]):
    b=int(input())
    c=list(map(int, input().split()))
    for k in range(b):
        a[c[k]-1]=1
print(a.count(0))

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

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

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

Solution (Python):
N, K = map(int, input().split())
banlist = [False]*N
for k in range(K):
    D = int(input())
    l = list(input().split())
    for i in l:
        if banlist[int(i)-1] == False:
            banlist[int(i)-1] = True
print(banlist.count(False))

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

for ll in l:
    a = ll[1]
    for sunuke in a:
        treat.append(sunuke)

print(N-len(set(treat)))

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

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

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

Solution (Python):
n, k = map(int, input().split())
heh = set()
for x in range(1, n + 1):
    heh.add(x)
for _ in range(k):
     d = int(input())
     heh.difference_update(set(list(map(int, input().split()))))
print(len(heh))

Solution (Python):
n,k = map(int,input().split())
s = [0]*n
ans=0

for i in range(k):
  d = int(input())
  m = input().split()
  m_int = [int(s) for s in m]


  
  for j in range(d):
    s[m_int[j]-1] = 1

for k in range(n):
  if s[k] == 0:
    ans += 1

print(ans)

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


for i in range(K):
    for j in range(d[i]):
        ps[A[i][j]-1]=0

print(sum(ps))

Solution (Python):
n,k = list(map(int, input().split()))
s =  [[int(_) for _ in input().split()] for __ in range(2*k)]

import itertools
d = s[0::2]
a = s[1::2]
a = list(set(list(itertools.chain.from_iterable(a))))

res = []
for i in range(1, n+1):
        if i not in a:
            res.append(i)

print(len(res))

Solution (Python):
import math
 
def readInt():
	return int(input())
 
def readInts():
	return list(map(int, input().split()))
 
def readChar():
	return input()

def readChars():
	return input().split()
 
n,k = readInts()
d = []
a = []

for i in range(k):
	d.append(readInt())
	a.append(readInts())

su = [0]*(n+1)

for i in range(1,k+1):
	for j in range(len(a[i-1])):
		su[a[i-1][j]]+=1
print(su.count(0)-1)

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

a = []
d = []
kashi = []
for i in range(k):
    dapp = int(input())
    d.append(dapp)
    aapp = list(map(int, input().split()))
    a.append(aapp)

for i in range(n):
    kashi.append(False)

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

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

print(count)

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

data = [0] * n

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

    for j, val in enumerate(people):
        tar = val - 1
        data[tar] += 1

ans = 0

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

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

candy_list = []

for i in range(K):
  d = int(input())
  A = [int(x) for x in input().split()]
  candy_list.append(A)
  
member_list = [0] * N

for k in range(K):
  target_candy = candy_list[k]
  
  for n in target_candy:
    member_list[n-1] += 1

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

print(ans)

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

sunukes = set()

for i in range(k):
    d = int(input())
    li = input().split()
    for j in range(d):
        sunukes.add(li[j])

print(n - len(sunukes))

Solution (Python):
n,k=map(int,input().split())
a=[]
for i in range(k):
    d=int(input())
    a+=list(map(int,input().split()))
import collections
c=collections.Counter(a)
print(n-len(c))

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