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 math as m

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

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

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

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

print(ans)

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

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


a=[]
for i in range(1,N+1):
    if i in s:
        pass
    else:
        a.append(i)

print(len(a))

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

ans = n

person = []
have = []

for i in range(k):
  person.append(int(input()))
  have.append(input().split())

import itertools
have = list(itertools.chain.from_iterable(have))
sunuke = (list(range(1, n+1)))

have = list(map(int, have))

for j in range(len(have)):
  if have[j] in sunuke:
    sunuke.remove(have[j])

print(len(sunuke))

Solution (Python):
from collections import Counter
N, K = map(int, input().split())
list=[]
for _ in range(1,K+1):
    d = int(input())
    S = input().split()
    list.extend(S)
num = Counter(list)
print(N-len(num))

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

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

for i in range(K):
  n=int(input())
  l=input().split()
  for j in range(n):
    k=int(l[j])
    list[k-1]=1
print(list.count(0))

Solution (Python):
ninzu,okashi=map(int,input().split())
okashimochi=[list(map(int,input().split())) for i in range(okashi*2)]
for i in range(0,okashi,1):
    del okashimochi[i]
okashininzu=sum(okashimochi,[])
print(ninzu-len(set(okashininzu)))

Solution (Python):
N,M=map(int,input().split())
i = 0
B_list = []
for i in range(M):
    d = int(input()) 
    A = list(map(int,input().split()))
    B_list = B_list + A
C = N - len(set(B_list))
print(C)

Solution (Python):
N,K = map(int,input().split())
D = []
A = []
for k in range(1,K+1):
    d = int(input())
    D.append(d)
    a = list(map(int, input().split()))
    for n in a:
        A.append(n)

for i in range(1,N+1):
    x = A.count(i)
    if x >= 2:
        for n in range(1,x):
            A.remove(i)

print(N - len(A))

Solution (Python):
N, K = map(int, input().split())
A_dict = {i: [] for i in range(1, N + 1)}

sunuke_have_not_okashi = 0

okashi = 0
for _ in range(K):
    okashi += 1
    d = input()
    A = map(int, input().split())
    for a in A:
        A_dict[a].append(okashi)


for i in sorted(A_dict.items(), key=lambda x: len(x[1])):
    if i[1]:
        break
    sunuke_have_not_okashi += 1

print(sunuke_have_not_okashi)

Solution (Python):
n,k = map(int,input().split())
sunuke = list(range(1,n+1))
i = 0
kashi_sunuke = []
d = ''
while i < k:
  d = input()
  okashi = list(map(int,input().split()))
  kashi_sunuke += okashi
  i+=1

o = list(set(sunuke) - set(kashi_sunuke))
print(len(o))

Solution (Python):
n,k=map(int,input().split())
x=[]
for i in range(k):
    hoge=int(input())
    c=[int(e) for e in input().split()]
    for j in range(hoge):
        x.append(c[j])
x=set(x)
print(n-len(x))

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

for i in range(k):
    d[i] = int(input())
    A[i] = [0]*d[i]
    A[i] = input().split(' ')
    for j in range(d[i]):
        A[i][j] = int(A[i][j])
N = []
for a in range(n):
    N.append(a+1)

def check(A,n,k):
    for i in range(k):
        for j in range(len(A[i])):
            if A[i][j] in N:
                N.remove(A[i][j])

check(A,n,k)
print(len(N))

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

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

B = [0]*N

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

print(B.count(0))

Solution (Python):
s = input().split();
import sys;

n = int(s[0]);
k = int(s[1]);
count = [];
cnt = 0;
for i in range(n):
    count.append(False);

for i in range (k):
    d = int(input());
    num = list(map(int,input().split()));
    for i in range(d):
        count[num[i] - 1] = True;

for i in range(n):
    if(count[i] == False):
        cnt += 1;

print(cnt);

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

i = 0
dd = []
aa = []
for d in I:
	if (i % 2) == 0:
		dd.append(d)
	else:
		aa.append(d)
	i += 1
    
zz = [0 for i in range(N)]

for ii in aa:
    for i in ii:
        zz[i - 1] = 1
ans = 0
for i in zz:
    if (i == 0):
        ans += 1
print(ans)

Solution (Python):
import itertools

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

d = []
A = []

for i in range(K):
  d.append(int(input()))
  A.append(list(map(int,input().split())))
  
A = list(itertools.chain.from_iterable(A))
A = list(set(A))
kotae = N - len(A)
print(kotae)

Solution (Python):
def d():
    s = input()
    count = 0
    for i in range(1, 60):
        ans = 2019 * i
        if '0' not in str(ans):
            count += 1
            print(i, ans)

    print(count)

def c():
    n = int(input())
    s = ['']*n
    for i in range(n):
        s[i] = input()
    s.sort()
    count = 1
    for i in range(1, n):
        if s[i - 1] != s[i]:
            count += 1
    print(count)

def b():
    n, k = map(int, input().split())
    check = [0] * n
    for i in range(k):
        input()
        for j in list(map(int, input().split())):
            check[j - 1] = 1
    print(check.count(0))
    


def a():
    s = input()
    if s == 'ABC':
        print('ARC')
    else:
        print('ABC')



b()

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

for i in range(k):
    snu|=set(nu[i])

print(n-len(snu))

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

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

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

grid = []
for i in range(2*k):
    array = list(map(int, input().split()))
    grid.append(array)

l = []
for j in range (k):
    l.append(grid[0+2*j+1])

lis = list(itertools.chain.from_iterable(l))

count = 0
for m in range(n):
    if m+1 in lis:
        count = count +1
print(n - count)

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

d = []
A = []

count = []
ans = 0

for i in range(K*2):
  if i % 2 == 0:
    d.append(int(input()))
  else:
    tmp = list(map(int,input().split()))
    for j in range(1,N+1):
      if j in tmp:
        count.append(j)

for k in range(1,N+1):
  if k not in count:
    ans = ans + 1

print(ans)

Solution (Python):
import itertools

n, k = (int(x) for x in input().split())
okashi_count_list = []
okashi_snuke_list = []
l = [0] * n

for i in range(k * 2):

    if i % 2 == 0 :
        okashi_count_list.append(list(map(int,input().split())))
    else :
        okashi_snuke_list.append(list(map(int,input().split())))





okashi_snuke_list = list(itertools.chain.from_iterable(okashi_snuke_list))

okashi_snuke_list = set(okashi_snuke_list)

l_n_str = [str(n) for n in okashi_snuke_list]




for e in l_n_str:
    

    
    

    l[int(e) - 1] = 1

count = 0

for e in l:
    if e == 0 :
        count = count + 1

print(count)

Solution (Python):

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

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

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

cnt = 0
for i in range(n):
    if (dl.count(i+1) == 0):
        cnt += 1

print(cnt)

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

Solution (Python):
import numpy as np

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

d = [0] * k
A = [0] * k

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

list = []
for i in range(k):
    for j in range(d[i]):
        list.append(A[i][j])

count = 0
for i in range(1, n+1):
    if not i in list:
        count += 1

print(count)

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

noTrick=[]

for ik in range(k):

    d =int(input())
    ad = list(map(int,input().split() ))
    for id in range(d):
        for iad in ad:
            noTrick.append(iad)


print( n -  len(set(noTrick)))

Solution (Python):
n, k = map(int, input().split())
li = []
for x in range(k*2):
    li.append(input().split())
li2 = []
i = 1
while i < k*2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))

Solution (Python):
n,k=map(int, input().split())
i=1
okashi_kazu=[]
okashi_hito=[]
okashi_hito2=[]
for i in range(1,2*k+1):
  if i%2==0:
    okashi_hito.extend(input().split())
  else:
    okashi_kazu.append(input().split())

okashi_hito2=set(okashi_hito)
print(n-len(okashi_hito2))

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

print(nlist.count(0))

Solution (Python):
from collections import Counter

NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]

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

lst = Counter(num for sublst in A for num in sublst)
allLst = [0] * N
for sunuke, cnt in sorted(lst.items(), key=lambda x: x[0]):
	allLst[sunuke - 1] = cnt

print(allLst.count(0))

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

array = []

s = 0
for i in range(k):
  d = int(input())
  array += list(map(int, input().strip().split()))

array = set(array)

for j in range(1,n+1):
  if j not in array:
    s += 1
print(s)

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

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

ans = 0

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

print(ans)

Solution (Python):
n,k=map(int,input().split())
ml=[int(i) for i in range(1,n+1)]
while k>0:
    mm=int(input())
    ll=list(map(int,input().split()))
    result=list(set(ml)-set(ll))
    ml=result
    k-=1
print(len(ml))

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

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

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

d = [0]*K
A = [[0] * K for i in range(N)]
n = 0

for i in range(K):
    d[i] = int(input())
    a = list(map(int, input().split()))
    for j in range(len(a)):
        A[a[j]-1][i] = 1
    
for i in range(N):
    if sum(A[i]) == 0:
        n += 1

print(n)

Solution (Python):
N, K=map(int, input().split())
set_okashi=set()
for i in range(K):
    d=int(input())
    list_d=[i for i in input().split()]
    for j in list_d:
        set_okashi.add(j)
print(N-len(set_okashi))

Solution (Python):
n, k = map(int, input().split())
sunuke=[[]]*n
for i in range(k):
    d=int(input())
    lid=list(map(int, input().split()))
    for i2 in range(d):
        if d not in sunuke[lid[i2]-1]:
            sunuke[lid[i2]-1]=sunuke[lid[i2]-1] + [d]
ans=0
for item in sunuke:
    if item==[]:
        ans+=1
print(ans)

Solution (Python):
n,k = map(int,input().split())
l1 = list(range(1,n+1))
for i in range(k):
    d = input()
    l2 = list(map(int,input().split()))
    for num in l2:
        if num in l1:
        	l1.remove(num)
print(len(l1))

Solution (Python):
NK = input().split()
N = int(NK[0])
K = int(NK[1])
Moratta = []
 
for i in range(0, K):
    D = int(input())
    A = input().split()
    for j in A:
      if j in Moratta:
        continue
      else:
        Moratta.append(j)

sunuke_count = len(Moratta)
result = N-sunuke_count
print(result)

Solution (Python):
N, K = list(map(int,input().split()))
C = []
for _ in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for i in range(len(A)):
    C.append(A[i])
NC = []
for a in range(1,N+1):
  if a <= N and a not in C:
    NC.append(a)
print(len(NC))

Solution (Python):
nk = input().split()
NK =[int(x) for x in nk]
t = []
s = []
for i in range(1 ,NK[0]+1):
	s.append(i)
for i in range(1,NK[1]+1):
    d = int(input())
    A =  input().split()
    a = [int(x) for x in A]
    t += a
set_t = set(t)
set_s = set(s)
r = set_s - set_t
print(len(r))

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

Solution (Python):
N, K = map(int, input().split())
sunuke_list = [1] * N
for j in range(K):
  D = int(input())
  D_list = list(map(int, input().split()))
  for i in D_list:
    sunuke_list[i - 1] = 0
print(sum(sunuke_list))

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

Solution (Python):

import sys
import os
from collections import Counter

n,k = [int(p) for p in input().split()]

a = []
d = []
c = []
for i in range(k):
    d.append(int(input()))
    s = input()
    a.append([int(p) for p in s.split()])
    c.extend([int(p) for p in s.split()])

total = 0

for i in range(1,n+1):
    x = c.count(i)
    
    if x == 0:
        total += 1

print(total)

Solution (Python):
N, K = map(int, input().split())
A = [ ]
D = [ ]
for i in range(K):
  D.append(int(input()))
  A.append(list(input().split()))
B = [ ]
c = 0
for i in range (K):
  B += A[i]
F = [int(B[i]) for i in range(len(B))]
for j in range (1,N+1):
  if F.count(j) == 0:
    c += 1
print(c)

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, readline().split())
lst = []
for _ in range(K):
    d = int(readline())
    lst += list(map(int, readline().split()))

x = N - len(set(lst))
print(x)

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

for i in range(K):
    di = int(input())
    Ai = list(map(int, input().split()))
    for j in range(len(Ai)):
        A[Ai[j]-1] += 1

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

Solution (Python):

n, k = map(int, input().split())
lst = []
cou = 0
for i in range(k):
    a = int(input())
    lst = lst + input().split()
    set(lst)
for j in range(1, n+1):
    if str(j) not in lst:
        cou += 1
print(cou)

Solution (Python):
n,k = map(int,input().split())
ls = [0 for p in range(k)]
new = [0 for q in range(k)]
for i in range(k):
    ls[i] = int(input())
    new[i] = list(map(int,input().split()))
for l in range(1,k):
    new[0] = new[0] + new[l]
c = len(set(new[0]))
print(n-c)

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

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

for i in range(k):
    _ = input()
    bx = [ int(x) - 1 for x in input().split() ]

    for b in bx:
        have[b] += 1

print(len(list(filter(lambda x: x == 0, have))))

Solution (Python):
import numpy as np


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

Ai_list = []
 
for i in range(K):
    di = int(input())
    Ai_list += input().split()
 

print(N - len(set(Ai_list)))

Solution (Python):
n, k = (int(x) for x in input().split())

D = []
E = []
for i in range(k):
    d = int(input())
    D.append(d)
    F = list(int(x) for x in input().split())
    E.append(F)

count = []
for i in E:
    for j in i:
        count.append(j)

number = set(count)

apple = list(number)

counter = 0
for i in range(1, n + 1):
    if i in apple:
        pass
    else:
        counter += 1

print(counter)

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

Solution (Python):
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in range(K):
    for j in range(d[i]):
            if A[i][j] in person:
                person.remove(A[i][j])

print(len(person))

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

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

C=[0]*N
for i in range(0,K*2,2):
  d=A[i][0]
  for j in range(d):
    C[A[i+1][j]-1]+=1
    
print(C.count(0))

Solution (Python):

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

R = []
for i in range(N):
    R.append(i + 1)
    
for i in range(K):
    d = input()
    A = list(map(int, input().split(' ')))
    for j in range(len(A)):
        try:
            R.remove(A[j])
        except ValueError:
            pass

print(len(R))

Solution (Python):
N,K = map(int, input().split())
sunuke_list = [str(i+1) for i in range(N)]
d_list = []
A_list = []
t_list = []

for j in range(K):
  d_list.append(input())
  A_list.append(input().split())
  
t_list = list(set(sunuke_list) - set(A_list[0]))
for j in range(K-1):
  t_list = list(set(t_list) - set(A_list[j+1]))
  
print(len(t_list))

Solution (Python):
import numpy as np
n,k = map(int,input().split())





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

alist = set(alist)
print(n -len(alist))

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

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

count = 0
have = [0]*n
for i in range(k*2):
    if i % 2 != 0:
        for j in range(len(a[i])):
            have[a[i][j]-1] += 1

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

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

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

for i in range(1, N + 1):
    check.append(i)

for i in range(0, N):
    for j in range(0, len(A_row)):
        if check[i] == A_row[j]:
            check[i] = 'None'

for i in range(0, len(check)):
    if check[i] != 'None':
        count += 1
print(str(count))

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

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


  for j in range(D):
    sunu[A[j]-1] = 1


z = 0
for i in sunu:
  if i == 0:
    z += 1

print(z)

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

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

print(N - len(mark.keys()))

Solution (Python):

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

sunuke = [0]*n

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

sum = 0
for k in sunuke:
    if k == 0:
        sum += 1

print(sum)

Solution (Python):
N, K = map(int, input().split())
S = [input().split() for _ in range(K*2)]
new_list = []
for i in range(5):
    S.append([])
S.append([])
for i in range(1,len(S)-2,2):
    for j in S[i]:
        new_list.append(j)

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

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

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

c = collections.Counter(l)

print(N-len(c))

Solution (Python):
R = lambda: map(int, input().split())
n, k = R()
s = set()
for _ in range(k):
  input()
  s.update(R())
print(n - len(s))

Solution (Python):
nk = list(input().split())
n = nk[0]
k = nk[1]
a = []
c = 0
for i in range(int(k)):
  d = int(input())
  b = list(input().split())
  a.extend(b)
for j in range(1,int(n)+1):
  if str(j) not in a:
    c = c+1
print(c)

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

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

c = collections.Counter(l)

print(N-len(c))

Solution (Python):
N, K = map(int, input().split())
S = [input().split() for _ in range(K*2)]
new_list = []
for i in range(5):
    S.append([])
S.append([])
for i in range(1,len(S)-2,2):
    for j in S[i]:
        new_list.append(j)

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

Solution (Python):
lis = input().split()
N = int(lis[0])
K = int(lis[1])
lis = list(range(N+1))

for i in range(K):
    d = int(input())
    A = input().split()
    
    for j in range(d):
        if int(A[j]) in lis:
            lis.remove(int(A[j]))

print(len(lis) - 1)

Solution (Python):
import numpy as np
N, K = map(int, input().split())
N_lis=np.zeros(N)
for i in range(K):
    d=int(input())
    sweet=np.array(list(map(int, input().split())))
    
    sweet-=1
    for j in sweet:
        N_lis[j]+=1

no_sweet=N_lis==0

print(no_sweet.sum())

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

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

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

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

d = [0 for i in range(k)]
a = [0 for i in range(k)]

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

l=[]
for c in range(len(a)):
    l.extend(a[c])
ls=list(set(l))
print(n-len(ls))

Solution (Python):
N, K = list(map(int, input().split(" ")))
length = {}
list1 = {}
for i in range(K):
    length[i] = int(input())
    list1[i] = list(map(int, input().split(" ")))
count = 0
List = []
for i in range(K):
    List.extend(list1[i])
Set = set(List)
print(N-len(Set))

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

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

print(len(setA^setN))

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

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

print(ans.count(0))

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

Solution (Python):
N,K = map(int,input().split())
l =[]
for i in range(K):
    input()
    l.extend(list(map(str,input().split())))
count = 0
for i in range(1,N+1):
             if str(i) not in l:
                     count+=1
             else:
                 pass
print(count)

Solution (Python):
n,k=map(int,input().split())	
x=[list(map(int, input().split())) for i in range(2*k)]
ans=[range(1,n+1)]
num=[]
many=x[0:2*k:2]
cookie=x[1:2*k:2]
for y in range(len(cookie)):
    for z in range(len(cookie[y])):
        num.append(cookie[y][z])
Q=set(num)
W=list(Q)
print(n-len(W))

Solution (Python):
n, k = map(int, input().split())
l = []
import collections
for i in range(k*2):
    if (i%2)!=0:
        a = list(map(int, input().split()))
        l.extend(a)
    else:
      b = int(input())

l = collections.Counter(l)

print(n-len(l))

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

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

Solution (Python):
R = lambda: map(int, input().split())
n, k = R()
s = set()
for _ in range(k):
  R()
  s.update(R())
print(n - len(s))

Solution (Python):


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

l = [0] * N

i = 1
for i in range(1, K+1):
   di = int(input())
   Aidi = input().split()
   for sunuke_num in Aidi:
       l[int(sunuke_num) - 1] += i

trick_num = 0
for sunuke_okasi in l:
    if sunuke_okasi == 0:
        trick_num += 1

print(trick_num)

Solution (Python):
import itertools

n,k = map(int,input().split())
d = [0]*k
A =[]
ans = 0

for i in range(k):
  d[i] = int(input())
  a = list(map(int,input().split()))
  A.append(a)
 
AS = list(itertools.chain.from_iterable(A))

for i in range(1,n+1):
    if i not in AS:
      ans += 1

print(ans)

Solution (Python):
l = list(map(int,input().split()))
n = l[0]
l_all = list(range(1,n+1))

k = l[1]

a = [list(map(int,input().split()))  for l in range(k*2)]

lh = []
for i in range(1,(k*2)+1):
  
  if (i+1)%2 == 0:
    lh.extend(a[i])
    

lnh = list((set(l_all) - set(lh)))
print( len(lnh) )

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

list = []
for i in range(k):
    d = int(input())
    a = input().split()
    list.append(a)
list = sum(list, [])
list = set(list)
print(n - len(list))

Solution (Python):
N,K = map(int,input().split())
N_set = set(range(N+1))
N_set = N_set - {0}
kari = []
for i in range(2*K):
  if i % 2 == 0:
    a = input()
    pass
  else:
    kari.append([int(k) for k in input().split()])
flatten = lambda x: [z for y in x for z in (flatten(y) if hasattr(y, '__iter__') and not isinstance(y, str) else (y,))]
kari = set(flatten(kari))
sa = N_set - kari
print(len(sa))

Solution (Python):
if __name__ == '__main__':
    N,K=input().split(" ")
    p=int(N)
    q=int(K)
    a=[0]*p
    judge=0
    for i in range(0,q):
        k=int(input())
        b=[int(t) for t in input().split()]
        for j in range(0,len(b)):
            a[b[j]-1]+=1
    for m in range(0,p):
        if a[m]==0:
            judge+=1
    print(judge)

Solution (Python):


N,K = map(int, input().split())
n_l = list(range(1, N+1))

while K > 0:
    i = int(input())
    j_l  = list(map(int, input().split()))
    for k in range(1, i+1):
        j = j_l[k-1]
        if j in n_l:
            n_l.remove(j)
    K -= 1

print(len(n_l))

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

s = {i: 0 for i in range(1, n+1)}
for i in range(k):
    d = int(input())
    a = list(map(str, input().split()))

    for kasi in a:
        s[int(kasi)] = s[int(kasi)] + 1

ans_list = list(s.values())
ans = ans_list.count(0)
print(ans)

Solution (Python):
N ,K = input().split()
list1=[]
for i in range(int(K)):
    new = input()
    list2= list(input().split())
    for  j in range(int(new)):
        list1.append(list2[j])
list1= set(list1)
length = len(list1)
print(int(N) - length)

Solution (Python):
import collections

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


num = collections.Counter(X)
print(N - len(num))

Solution (Python):
n,k = map(int,input().split())
a=list()
for i in range(1,k+1):
  d=input()
  a.extend(list(map(int,input().split())))
set(a)
cnt=0
for f in range(1,n+1):
  if not(f in a):     
      cnt=cnt+1

print(cnt)

Solution (Python):
import sys
import itertools
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K=nm()
A=[0 for i in range(N)]
for i in range(K):
    d=int(input())
    tmp=nl()
    for j in range(d):
        A[tmp[j]-1]+=1
c=0
for i in range(N):
        if(A[i]==0):
            c+=1

print(c)

Solution (Python):
from collections import Counter

n,k = map(int, input().split())
l=[]
for i in range (k):
    d = int(input())
    a = input().split()
    lena = int(len(a))
    for j in range(lena):
        l.append(a[j])

c = Counter(l)
print(n-len(c))

Solution (Python):
import itertools

n, k = map(int, input().split())
d = [0]*k
a = []
for i in range(k):
    d[i] = int(input())
    sn = list(map(int, input().split()))
    a.append(sn)
res = itertools.chain(*a)
res = list(res)
res_s = list(set(res))
print(n - len(res_s))

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

lists = []
for j in range(k):
  d = int(input())
  a = list(map(int, input().split()))
  for b in range(d):
    lists.append(a[b])
    
    
c = len(set(lists))
print(n-c)

Solution (Python):
import numpy as np
n, k=map(int, input().split())

pp = []
for i in range(2*k):
    pp.append(list(input().split()))

p = pp[1::2]
s = 0
l = []

for i in range(k):
    q = p[i]
    l.extend(q)


ll = set(l)

print(n - len(ll))

Solution (Python):



s = input().rstrip().split(' ')
trick = int(s[0])
sunuke = []

for i in range(int(s[1])):
  kind = str(input())
  has = input().rstrip().split(' ')
  
  for j in range(len(has)):
    sunuke.append(has[j])

sunuke = set(sunuke)


print(trick - len(sunuke))

Solution (Python):
N,K=map(int,input().split())
l=[1 for _ in range(N)]
for i in range(K):
  d=int(input())
  A=[int(x) for x in input().split()]
  for j in A:
    l[j-1] = 0
print(sum(l))

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