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 = map(int,input().split())

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

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

print(cnt)

Solution (Python):
def main():
	n,k = map(int,input().split())
	da = []
	for i in range(k*2):
		da.append(list(map(int,input().split())))
	okashi = []
	for i in range(1,k*2,2):
		if len(da[i]) > 1:
			for s in range(len(da[i])):
				okashi.append(da[i][s])
		else:
			okashi.append(da[i][0])
	print(n - len(set(okashi)))




if __name__ == '__main__':
	main()

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


List=[]
for i in range(N):
    for j in range(K):
        check = 0
        for k in range(len(A[1+2*j])):
            if A[1+2*j][k] == i+1:
                check = check + 1
        if check ==0:
            List.append(i+1)


ans = 0
for i in range(1,N+1):
    p = 0
    for j in range(len(List)):
        if List[j] == i:
            p = p+1
    if p == K:
        ans = ans +1
        
        
    
            
print(ans)

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

ans = [0]*n

for i,s in enumerate(S):
    for d in s:
        ans[int(d)-1]+=1


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

Solution (Python):
def solve(n, k, d_arr, arr):
    ans = []
    for _ in range(n):
        ans.append(0)

    for i in range(k):
        ele = arr[i]
        for j in arr[i]:
            ans[j-1] += 1
    return ans.count(0)

if __name__ == "__main__":
    n, k = map(int, input().split(' '))
    d_arr = []
    arr = []
    for _ in range(k):
        d_arr.append(int(input()))
        arr.append([int(s) for s in list(input().split())])
    print(solve(n, k, d_arr, arr))

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

Solution (Python):


N, K = map(int, input().split())
S = [False] * N
cnt=0
while cnt < K:
    d = int(input())
    A = list(map(int, input().split()))
    i=0
    while i < d:
        S[A[i] - 1] = True
        i += 1
    cnt += 1
n = sum(x==False for x in S)

print(n)

Solution (Python):

if __name__ == "__main__":
    N, K = map(int, input().split())
    A = []
    for i in range(K):
        X = int(input())
        A += list(map(int, input().split()))
    cnt = N - len(set(A))
    print(cnt)

Solution (Python):
n,k = map(int,raw_input().split())
dic = {}
for a in range(k):
  x = raw_input()
  x = map(int,raw_input().split())
  for z in x:
    dic[z] = 1
x = [1]*(n+1)
x[0] = 0
for a in dic:
  x[a] = 0
print x.count(1)

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

Okashi = []
for i in range(k):
    for j in range(len(A[i])):
        Okashi.append(A[i][j])
c = collections.Counter(Okashi)

print(n-len(c))

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

A=[]

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

okashi=set()
for a in A:
    for b in a:
        okashi.add(b)

print(n-len(okashi))

Solution (Python):
n,k=map(int,input().split())
S=[0]*n
for _ in range(k):
    input()
    A=tuple(map(int,input().split()))
    for a in A:
        S[a-1]+=1
ans=0
for s in S:
    if s==0:
        ans+=1
print(ans)

Solution (Python):
n, k = map(int, input().split())
treat = list(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 treat:
      treat.remove(j)
print(len(treat))

Solution (Python):
N, K = [int(s) for s in input().split()]
h = []
for _ in range(K):
    d = input()
    h = h + [int(s) for s in input().split()]

print(sum([True for x in range(1, N + 1) if not (x in set(h))]))

Solution (Python):



import sys


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


def resolve():
    n, k = map(int, input().split())
    d_list = []
    a_list = []
    for i in range(k):
        d_list.append(int(input()))
        a_list.append(list(map(int, input().split())))

    remain_list = [i for i in range(1, n+1)]

    for a in a_list:
        for sunuke_no in a:
            try:
                remain_list.remove(sunuke_no)
            except:
                pass

    print(len(remain_list))



if __name__ == "__main__":
    resolve()

Solution (Python):


k = input().split(" ")

num_sunuke = int(k[0])
kind = int(k[1])

counter = [False for i in range(num_sunuke)]

for i in range(kind):
    d = int(input())
    a = input().split(" ")
    for j in range(d):
        counter[int(a[j])-1] = True
        
print(counter.count(False))

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

def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())

import itertools
n, k = LI()
s = []
for i in range(k):
    d = int(input())
    a = LI()
    s.append(a)
s = list(itertools.chain.from_iterable(s))
ans = 0
for i in range(1, n+1):
    if i not in s:
        ans += 1
print(ans)

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

Solution (Python):
n, k = map(int, input().split(" "))
snukes = [0] * n
result = 0
for i in range(0, k):
    number_temp = input()
    snakes_temp = list(map(int, input().split(" ")))
    for n in snakes_temp:
        snukes[n-1]+=1
for i in snukes:
    if i==0:
        result+=1
print(result)

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

l=[n for n in range(1,N+1)]
for n in range(K):
    d=int(input())
    A=list(map(int,input().strip().split()))
    for n in range(d):
        if A[n] in l:
            l.remove(A[n])

print(len(l))

Solution (Python):
import numpy as np
N,K = map(int,input().split())
numberList = np.array(range(1,N+1)).tolist()
for d in range(1,K+1):
    num = input()
    array = list(map(int, input().strip().split()))
    for i in array:
        if i in numberList:
            numberList.remove(i)
print(len(numberList))

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

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

print(len(ans))

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

d = []
All = set()

for k in range(K):
    d.append(int(input()))
    X = list(map(int,input().split()))
    All = All | set(X)

print(N-len(All))

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

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

print(N-len(s))

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


zisyo = {} 
zisyo = set(zisyo)

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

print(N-len(zisyo))

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

for i in range(N):
    a.append(False)

for i in range(K):
    dam = int(input())
    d = [int(x) for x in input().split()]
    for j in d:
        a[j-1] = True

c=0
for i in a:
  if i==False:
    c = c + 1
print(c)

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

sunuke = []
list_sunuke=[]
for i in range(K):
    d = int(input())
    
    sunuke.append(input().split())

for i in sunuke:
    for j in i:
        list_sunuke.append(j)

set_sunuke = set(list_sunuke)
print(N-len(set_sunuke))

Solution (Python):
N, K = map(int,input().split())
sunuke = [1 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] = 0
print(sum(sunuke))

Solution (Python):


import sys






















def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, k = mi()
    member = set()
    for _ in range(k):
        d = ii()
        L = lmi_0()
        for person in L:
            member.add(person)
    cnt = 0
    for i in range(n):
        if i not in member:
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

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

lis = []
for n in range(K):
    d = int(input())
    lis.append(list(map(int, input().split())))

ans_lis = []
for v in lis:
    for sunuke_num in v:
        ans_lis.append(sunuke_num)

print(N-len(set(ans_lis)))

Solution (Python):
N, K = map(int, input().split())
A = []
for _ in range(K):
    d = int(input())
    A.append(list(map(int, input().split())))
nusuke = [i+1 for i in range(N)]
N_nusuke = [0 for i in range(N)]
for a in A:
    for i in range(len(a)):
        N_nusuke[a[i]-1] += 1
print(N_nusuke.count(0))

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

d_list = []
a_list = []

for i in range(k):
  d_list.append(int(input()))
  a_list.append([int(x) for x in input().split()])
  
lis = {i:0 for i in range(1,n+1)}

for a in a_list:
  for a2 in a:
    lis[a2] += 1

print(list(lis.values()).count(0))

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


item_num_list = [0 for i in range(N)]
for i in range(K):
    d = int(input())
    Aid = map(int, input().split())
    for a in Aid:
        item_num_list[a - 1] += 1

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

Solution (Python):
from sys import stdin
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd
n,k=map(int,input().split())
s=set()
for i in range(k):
	a=int(input())
	l=list(map(int,input().split()))
	for j in  l:
		s.add(j)
print(n-len(s))

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

Solution (Python):

import sys

DEBUG = True if (len(sys.argv) > 1 and sys.argv[1] == "DEBUG") else False


def dp(value):
    if DEBUG:
        print(value)
    return


def input_text(split=" "):
    
    result = []
    while True:
        try:
            row = list(
                map(lambda x: int(x) if x.isdecimal() else x, input().split(split))
            )
            result.append(row)
        except EOFError:
            break
    return result



it = input_text()

n = it[0][0]
row = len(it)

s = set()
i = 1
while row >= i * 2:
    s = s | (set(it[i * 2]))
    i += 1

print(n - len(s))

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

Solution (Python):


n, k = map(int, input().split())
s = []
for i in range(k):
    input()
    a = list(map(int, input().split()))
    s.extend(a)

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

Solution (Python):
N, K = list(map(int, input().split()))
haves = [False for _ in range(N)]

def judge_Flag(flags):
    As = list(map(int, input().split()))
    for A in As:
        flags[A - 1] = True

for _ in range(K):
    people_num = int(input())
    judge_Flag(haves)
print(haves.count(False))

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

for zzz in range(k):
    for i in a[zzz]:
        if i in ans:
            pass
        else:
            ans.append(i)

print(n-len(ans))

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

for k in range(K):
    d_i = int(input())
    
    l = list(map(int, input().split()))
    for i in l:
        N_list[i-1] += 1

print(N_list.count(0))

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

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for k in range(d):
        sunuke_num = A[k]
        possess[sunuke_num - 1] = 1

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

print(count)

Solution (Python):
N, K = map(int, input().split())
sum_list = []
for i in range(K):
  d = int(input())
  own_list = list(map(int, input().split()))
  sum_list += own_list
count = 0

for i in range(1, N+1):
  if i not in sum_list:
    count += 1
print(count)

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

treat_list = set()

for i in range(K):
    a = int(input())
    Line = [int(s) for s in input().split()]
    for x in Line:
        treat_list.add(x)
        
print(N - len(treat_list))

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

s=[0]*n

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

print(s.count(0))

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

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

for i in range(K):
    for j in range(ds[i]):
        sunuke[A[i][j]-1]=True


for i in range(N):
    if sunuke[i]==False:
        ans+=1
print(ans)

Solution (Python):


import sys
import math
import time

import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools










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

print(Human.count(0))

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

d = []
A = []
for n in range(K):
    d.append(int(input()))
    

    if d[-1] > 1:
        A.append(list(map(int, input().split(' '))))
        
    else:
        A.append([int(input())])
        

itazurasareru = [0] * N

for k in range(K):
    
    cnt = d[k]
    a = A[k]
    
    for i in range(cnt):
        
        itazurasareru[a[i]-1] += 1

print(sum([ 1 for sunuke in itazurasareru if sunuke == 0 ]))

Solution (Python):
import sys



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



cnt = N
for i in range(1,N+1):
    if i in A:
        cnt -= 1








print(cnt)

Solution (Python):
N, K = map(int, input().split())
S=[]
for i in range(2*K):
    a = input().split()
    if i%2 ==1:
        S.extend(a)

print(N-len(set(S)))

Solution (Python):

N,K=map(int,input().split())
d=0
A=[]
SET=[]

for i in range(K):
    d=int(input())
    A=[int(x) for x in input().split()]
    for j in range(d):
        SET.append(A[j-1])
SET=set(SET)    
print(N-len(SET))

Solution (Python):
n,k = map(int,input().split())
N = list(range(1,n+1))
A = set()
count = 0
for i in range(k):
  d = int(input())
  Ad = list(map(int,input().split()))
  for j in range(d):
    A.add(Ad[j])

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

print(n-count)

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

snuke_list = [0]*N
for i in range(K):
  snuke_sayisi = int(input())
  snukes = list(map(int, input().split()))
  for snuke in snukes:
    snuke_list[snuke-1] += 1
ans = 0
for i in snuke_list:
  if i == 0:
    ans += 1
print(ans)

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

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

print(len(person))

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

listn = []
for i in range(n):
    listn.append(i+1)

for i in range(len(a)):
    a_ex = a[i]
    for j in range(len(a_ex)):
        if (a_ex[j] in listn):
            listn.remove(a_ex[j])

print(len(listn))

Solution (Python):
n, k = list(map(int, input().split(" ")))
L = [0]*n

for v in range(k):
    d_ = int(input())
    d__ = input()
    d_l = list(map(int, d__.split(" ")))
    for v in range(d_):
        m = d_l[v]
        L[m-1] += 1
print(L.count(0))

Solution (Python):
N,K=map(int,input().split())
l=[0]*N
count=0
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for index ,m in enumerate(A):
        l[m-1]+=1
for i in range(N):
    if l[i]==0:
        count+=1
print(count)

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

flag=1
ans=0
for i in range(n):
    for j in a:
        if str(i+1) in j:
            flag=0
    if flag==1:
        ans+=1
    flag=1
print(ans)

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

cnt = 0
ans = []
for a in A:
  for i in a:
    if i not in ans:
      ans.append(i)
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())))

sunuke = [0] * (N+1)

for k in A:
  for a in k:
    sunuke[a] += 1

print(sunuke.count(0)-1)

Solution (Python):
import collections

n,k = map(int,input().split())
listA=[] 
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        

listB=[] 

for i in range(k):
  listB+=listA[2*i+1]
  
c = collections.Counter(listB)  
print(n-len(c))

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

x = list()
for i in range(k):
  d = int(input())
  y = list(map(int,input().split()))
  x += y 
    
x = sorted(x)
cnt = 0
for i in range(n):
  if i+1 in x:
    cnt +=1
    
print(n-cnt)

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

has_n = []

for i in range(k):
    d = int(input())
    a = input()
    tmp = a.split()
    has_n.extend(tmp)
has_n = set(has_n)
print(n - len(has_n))

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

Solution (Python):
N,K=map(int, input().split()) 
d=list()
a=list()
have_snack=set()
for i in range(K):
    input()
    have_snack |=set([int(x) for x in input().split()])

print(N-len(have_snack))

Solution (Python):
n, k = map(int,input().split())
sets = set(range(1, n + 1))
for i in range(k):
    d = int(input())
    li = list(map(int,input().split()))
    for j in li:
        if j in sets:
            sets.discard(j)

print(len(sets))

Solution (Python):

import sys


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()

    N = int(next(tokens))  
    K = int(next(tokens))  
    
    g = set()
    for _ in range(K):
        d = int(next(tokens))
        g = g | set([int(next(tokens)) for i in range(d)])

    print(N - len(g))    

    return


if __name__ == '__main__':
    main()

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

r = set()
for i in range(K):
  d = int(input())
  r |= set(map(int,input().split()))
print(N-len(r))

Solution (Python):
N, K = [int(n) for n in input().split()]
o = {}
for i in range(1, N+1):
    o[i] = False
for j in range(K):
    d = int(input())
    for k in [int(n) for n in input().split()]:
        o[k] = True
print(list(o.values()).count(False))

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

cou = []
for i in range(len(A)):
    if (i+1) % 2 == 0:

        for j in A[i]:

            cou.append(j)   


print(N - len(set(cou)))

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

L = [] 

for i in range(K):
  d = int(input())
  A = input().split()
  for k in range(d):
    if not int(A[k]) in L:
      L.append(int(A[k]))


solution = N - len(L)
print(solution)

Solution (Python):
N,K = map(int,input().split())
number_of = [0]*N
for i in range(K):
  d = int(input())
  who_has = [int(x) for x in input().split()]
  for j in range(d):
    number_of[who_has[j]-1]+=1
print(number_of.count(0))

Solution (Python):
(N,K) = map(int,input().split())
man_list = []
for i in range(K):
    D = int(input())
    man_ele = list(map(int,input().split()))
    for j in man_ele:
        man_list.append(j)

man_list = list(set(man_list))
count = 0
for i in range(1,N+1):
    if i  not in man_list:
        count += 1
print(count)

Solution (Python):


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

s = set()

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

print(n-len(s))

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

l =[]
okashi = set(l)

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

print(n - len(okashi))

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

Solution (Python):
n,k=list(map(int, input().split()))
dic={}
for i in range(k):
  j=int(input())
  l=list(map(int, input().split()))
  for a in l:
    if a not in dic:
      dic[a]=True
x=len(list(dic.keys()))
print(n-x)

Solution (Python):
N, K = map(int, input().split())
treat = []
for i in range(K):
    d = int(input())
    snack = input().split()
    for l in snack:
        if l not in treat:
            treat.append(l)
print(N-len(treat))

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


import itertools
Alist=list(itertools.chain.from_iterable(Alist))

Alist=list(set(Alist))

print(N-len(Alist))

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

for i in range(K):
    d = int(input())
    

    A_d = list(map(int, input().split()))
    for i in A_d:
        N_i[i-1] = 1
        




print(N_i.count(0))

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

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

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

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




n, k = map(int, input().replace("\n","").split())

snuke =  [0] * n


havelist = []

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

    havelist.extend(a)

have = len(list(set(havelist)))
print(n-have)

Solution (Python):
N, K = map(int, input().split())
X = [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):
    X[A[j]-1] += 1

print(X.count(0))

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

set_i = set()

for i in range(k):
  d = input()
  s = map(int,input().split())
  for s_ in s:
    set_i.add(s_)

print(n-len(set_i))

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

print(n-len(b))

Solution (Python):
n, k = [int(i) for i in input().split(' ')]
a, d = [], []
for i in range(2*k):
  if (i%2)==0:
    d.append(int(input()))
  else:
    a.extend([int(j) for j in input().split(' ')])

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

Solution (Python):
import collections

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

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


c = collections.Counter(A)

print(N - len(c))

Solution (Python):


import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        
        
        lines.append(input())
        (n, k) = [int(e) for e in lines[0].split(' ')]
        for i in range(2*k):
            lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]
        (n, k) = [int(e) for e in lines[0].split(' ')]

    d = [] 
    a = []
    for i in range(1, 2*k+1):
        if i % 2 == 1:
           d.append(int(lines[i]))
        else:
           a.append([int(e) for e in lines[i].split(' ')])

    return (n, k, d, a)


def solve(n, k, d, a):


    candy_a = set() 
    for i in range(k):
        for e in a[i]:
            candy_a.add(e)

    result = n - len(candy_a)

    return result
    


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

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

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

Solution (Python):
x = []

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

for i in range(n):
    x.append(0)

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

    for sweet in sweets:
        x[sweet-1] = 1

print(x.count(0))

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



d = []
A = []
count = []

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

for i in range(K):
    for j in range(d[i]):
        count.append(A[i][j])

answer = list(set(count))

print(N - len(answer))

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

p = [0]*N
for i in range(K):
    n = int(input())
    ks = [int(j) for j in input().split()]
    
    for k in ks:
        p[k-1] = 1
print(p.count(0))

Solution (Python):
line = input()
n, k = line.split(" ")
n, k = int(n), int(k)
kashi_list = []

for i in range(k):
    d = int(input())
    line = input()
    temp = line.split(" ")
    for t in temp:
        kashi_list.append(t)

print(n - len(set(kashi_list)))

Solution (Python):
def main():
    input1 = input().split()
    N = int(input1[0])
    K = int(input1[1])
    d = [0]*K
    count = [0]*N
    for i in range(K):
        input2 = input()
        d[i] = int(input2)
        input3 = input().split()
        for j in range(d[i]):
            count[(int(input3[j]))-1] += 1

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

if __name__ == "__main__":
    main()

Solution (Python):
N,K = map(int,input().split())
A =[]
B =[]
count = 0
for _ in range(K):
  d = int(input())
  B = list(map(int,input().split()))
  A += B
set(A)

for i in range(1,N+1):
  if not i in list(A):
    count += 1
print(count)

Solution (Python):

def main():
  n, k = map(int, input().split(" "))

  arr = [0] * n

  for _ in range(k):
    input()
    for a in map(int, input().split(" ")):
      arr[a - 1] += 1

  print(len(tuple(filter(lambda count: count == 0, arr))))


main()

Solution (Python):
N,K=map(int,input().split())
jud=[0]*N
for i in range(K):
  a=int(input())
  lis=list(map(int,input().split())) 
  for j in lis:
    jud[j-1]+=1
print(jud.count(0))

Solution (Python):
N,K = map(int, input().split())
A=[]
d=[0 for i in range(K)]
recode={}
for i in range(K):
    d[i]=int(input())
    a=list(map(int, input().split()))
    A.append(a)
for i in range(K):
    for j in range(d[i]):
        recode[A[i][j]]=1
count=0
for i in range(1,N+1):
    if i in recode.keys():
        continue
    else:
        count+=1
print(count)

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

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

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

answer=0
for i in range(1,n+1):
  t=0
  for j in range(k):
    if i in a[j]:
      t=1
  if t==0:
    answer+=1

print(answer)

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

Solution (Python):


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


persons = set()
for A_i in A:
    for A_ij in A_i:
        persons.add(A_ij)

result = N - len(persons)


print(result)

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 j in range(d):
        ans[a[j]-1]=0



sum=0
for i in range(n):
    sum+=ans[i]
print(sum)

Solution (Python):
N, K = map(int, input().split())
s1 = []
for i in range(1, N+1):
  s1.append(i)
s2 = set(s1)
  
d = []
A = []
for i in range(K):
  d.append(int(input()))
  A.append(list(map(int, input().split())))

for i in range(len(A)):
  for j in range(len(A[i])):
    if A[i][j] in s2:
      s2.remove(A[i][j])

print(len(s2))

Solution (Python):

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

snu = [ False for i in range(n)]
count=0

for _ in range(k):
  d = int(input())
  snukes = [ int(x) for x in input().split()]
  for elem in snukes:
    if(not snu[elem-1]):
      snu[elem-1]=True
      count+=1
      
print(n-count)