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())
sunuke = [0] * N

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

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

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

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

    print(ans)

main()

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

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

Solution (Python):
from collections import defaultdict

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

d = defaultdict(int)

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

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

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

A = set()

for _ in range(K):
    input()
    A |= set(input().split())

print(N - len(A))

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

for i in range(k):
    d = int(input())
    sunuke_tuple = tuple(map(int, input().split()))
    for sunuke in sunuke_tuple:
        sunuke_set.discard(sunuke)

print(len(sunuke_set))

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

for i in range(k):
    d = int(input())
    sunuke_list = list(map(int, input().split()))
    for sunuke in sunuke_list:
        sunuke_set.discard(sunuke)

print(len(sunuke_set))

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


l = [0]*N
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())
d = []
A = []
for _ in range(K):
  d.append(int(input()))
  A.append(list(map(int, input().split())))

l = [1]*N
for i in range(K):
  for j in range(d[i]):
    l[A[i][j]-1] = 0
    
print(sum(l))

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

sunuke = [0]*(N+1)
for i in range(K):
  okashi_category = input()
  
  if okashi_category ==1:
    sunuke[input()]=1
  else:
    sunukelist = list(map(int,input().split()))
    for j in range(len(sunukelist)):
      
      sunuke[sunukelist[j]]=1

print (N-sum(sunuke))

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

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

  for j in A:

    if S[j]==1:
      S[j]=0
      
Ans=sum(S)
print(Ans)

Solution (Python):
n, k = map(int, input().split())
n_list = []
a_int_all = []
for i_n in range(1, n + 1):
    n_list.append(i_n)
for i in range(0, k):
    d_k = input()
    a_int_k = list(map(int, input().split()))
    a_int_all.extend(a_int_k)
n_only = set(a_int_all)
ans = n - len(n_only)
print(ans)

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

l=set()

for i in range(k):
    input()
    l = l | set(map(int,input().split()))

print(n-len(l))

Solution (Python):
def resolve():
    N, K = list(map(int, input().split()))
    snacks = [0 for _ in range(N)]
    for i in range(K):
        d = int(input())
        A = list(map(int, input().split()))
        for a in A:
            snacks[a-1] += 1
    cnt = 0
    for s in snacks:
        if s == 0:
            cnt += 1
    print(cnt)

if '__main__' == __name__:
    resolve()

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

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

print(judge.count(True))

Solution (Python):
import numpy as np
N, K = map(int,input().split())
B = []
C = np.zeros(N)
e = 0
for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(1, N + 1):
    B.append(A.count(j))
  for k in range(N):
    C[k] += B[k] 
  B = []
for l in range(N):
  if C[l] == 0:
    e += 1
print(e)

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


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



for i in range(0, k):
     d = int(input())
     a = [s for s in input().split()]
     for j in range(0, d):
         if a[j] in list_snuke:
             list_snuke.remove(a[j])


print(len(list_snuke))

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())))
ans = 0
for i in range(1,N+1):
    got = False
    for j in A:
        for k in j:
            if i == k:
                got = True
    if not got:
        ans += 1
print(ans)

Solution (Python):
def main():
    n, k = map(int, input().split())
    d_lst = [0 for _ in range(k)]
    a_lst = [0 for _ in range(k)]

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

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

    for i in range(k):
        for a in a_lst[i]:
            snuke_lst[a - 1] = 1

    ans = n - sum(snuke_lst)

    print(ans)


if __name__ == "__main__":
    main()

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

flag = [0] * n
for i in range(int(len(okashi) / 2)):
    i = 2 * i + 1
    for j in okashi[i]:
        flag[j-1] = 1
count = 0
for i in flag:
    if i == 0:
        count += 1

print(count)

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)
A_all=[]
for i in A:
    for j in i:
        A_all.append(j)
A_set=list(set(A_all))
print(N-len(A_set))

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

for i in range(k): 
    d=int(input()) 
    a=list(map(int,input().split())) 
    for j in range(d): 
        if a[j] in data: 
            data.remove(a[j]) 
        else: 
            pass 
print(len(data))

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

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

Q = list(set(num))
print(n-len(Q))

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

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

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

print(ans)

Solution (Python):
n = input()
n = n.split()
k = int(n[1])
n = int(n[0])
c = [0]
for f in range(n-1):
  c.append(0)
for b in range(k):
  d = int(input())
  a = input()
  a = a.split()
  for e in range(d):
    c[int(a[e])-1] = 1
h = 0
for g in range(n):
  if c[g] == 0:
    h = h + 1
print(h)

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

Solution (Python):
n,k=map(int,input().split())
L=[list(map(int, input().split())) for i in range(2*k)]
X=[]
for i in range(1,2*k,2):
  X.extend(L[i])
x=0
print(n-len(set(X)))

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

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

print(ans)

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

Solution (Python):
N,M=list(map(int,input().split()))
si=[0]*N
ans=0
for i in range(M):
    S=int(input())
    who=list(map(int,input().split()))
    for k in range(S):
        si[who[k]-1]+=1
for h in range(N):
  if si[h]==0:
    ans+=1
print(ans)

Solution (Python):

import sys
import numpy as np



n,k = map(int, input().split())
ansList = [False for _ in range(n+1)]

for _ in range(k):
	input()
	tmpList = list(map(int, input().split()))
	for person in tmpList:
		ansList[person] = True

print(ansList.count(False) - 1)

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

while k>0:
    d = int(input())
    b = input().split()
    for e in b:
        a[int(e)-1] = False
    k-=1
print(sum(a))

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

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

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

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

Solution (Python):
N, K = map(int, input().split())
A = [-1] * (N+1)
for i in range(K):
  d_list = int(input())
  B = input().split()
  B = [int(x) for x in B]
  for i in range(1, N+1):
    if i in B:
      A[i] = 1
count = 0
for i in range(1, N+1):
  if A[i] == -1:
    count += 1
print(count)

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

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

for i in range(len(S)):
    if S[i]==0:
        b+=1
print(b)

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

for i in range(K):
    d.append(int(input()))
    holders = list(map(int, input().split()))
    for holder in holders:
        have.append(holder)
print(N - len(set(have)))

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

for i in range(K):
    d.append(int(input()))
    holders = list(map(int, input().split()))
    for holder in holders:
        if holder not in have:
            have.append(holder)
print(N - len(have))

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

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

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

sets = set(lists)
ans = n - len(sets)
print(ans)

Solution (Python):


import sys

input = iter(sys.stdin.read().splitlines()).__next__


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

S = set(list(range(1, N+1)))
for k in range(K):
   d = int(input())
   A = list(map(int, input().split()))
   for x in A:
      if x in S:
         S.remove(x)

print(len(S))

Solution (Python):
r=input().split()
N=int(r[0])
K=int(r[1])
d=[input().split() for i in range(2*K)]
d_2=[]
d_ans=[0]*N
for i in range(2*K):
    d_pre=[int(s) for s in d[i]]
    d_2.append(d_pre)
for i in range(2*K):
    if i%2==0:
        for j in range(d_2[i][0]):
            d_ans[d_2[i+1][j]-1]=1
print(d_ans.count(0))

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

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

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


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

Solution (Python):
import math
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


N,K = LI()
s = set()
for i in range(K):
    _ = I()
    s.update(LI())

print(N-len(s))

Solution (Python):
import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

n, k = I()
ans = [0] * n
for _ in range(k):
  x = I()
  ys = Is()
  for y in ys:
    ans[y-1] += 1

print(len([a for a in ans if a == 0]))

Solution (Python):
from sys import stdin,stdout

n,k=list(map(int,stdin.readline().split()))
s=set()
for _ in range(k):
    x=input()
    for v in map(int,stdin.readline().split()):
        s.add(v)
ans=0
for i in range(1,n+1):
    if i not in s:ans+=1
print(ans)

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
ans=0
for i in range(len(sunu)):
    if sunu[i]==0:
        ans+=1
print(ans)

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

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

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

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

Solution (Python):
N, K = map(eval, input().split())
candy = []

for i in range(K):
    input()
    candy.append(list(map(eval, input().split())))

result = 0

for i in range(1, N+1):
    for j in range(K):
        if i in candy[j]:
            break
    else:
        result += 1

print(result)

Solution (Python):
N, K = map(int,input().split())
d = 0
A = []
ans = 0
for i in range (K):
    d = int(input())
    A.append(input().split())
for i in range(1,N+1):
    for j in range(len(A)):
        if str(i) in A[j]:
            break
        if j == len(A)-1:
            ans += 1
print(ans)

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

ans = 0
a = []
for _ in range(n):
    a.append(0)
    
for i in range(k):
    d = int(input())
    treat = list(map(int, input().split()))
    for snuke in treat:
        a[snuke-1] += 1
    
for j in range(n):
    if a[j] == 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))
ans = 0
for i in range(1, N + 1):
    if i in A:
        continue
    else:
        ans += 1

print(ans)

Solution (Python):
def main(n, k):
    no_sweet = [x + 1 for x in range(n)]
    for _ in range(k):
        input()
        for v in map(int, input().split()):
            if v in no_sweet:
                no_sweet.remove(v)
    print(len(no_sweet))


if __name__ == "__main__":
    n, k = map(int, input().split())
    main(n, k)

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

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

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

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

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

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

    for e in a:
        t[e-1] += 1
ans = 0
l = [i for i in t if i == 0]

print(len(l))

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

A = []
check = np.ones(n)
for i in range(k):
  d = int(input())
  A = [int(i) for i in input().split()]
  for j in A:
    check[j-1] = 0
print(int(check.sum()))

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

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] = list(map(int, input().split()))
  
lis = [0]*n
for i in range(n):
  lis[i] = i + 1

alis = sum(a, [])

alis = list(set(alis))

for i in range(len(alis)):
  lis.remove(alis[i])
print(len(lis))

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

check = [False]*(N+1)

for k in range(K):
    for sunuke in A[k]:
        if check[sunuke] == False:
            check[sunuke] = True
itazura = 0
for n in range(1, N+1):
    if check[n] == False:
        itazura += 1
print(itazura)

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

d_list = []
A_list = []

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

person = [0 for i in range(N)]

for i in range(K):
    for j in range(d_list[i]):
        person[A_list[i][j]-1] += 1

print(person.count(0))

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

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

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

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

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

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

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

Solution (Python):
N, K = map(int, input().split())
CHECKED=[False]*N
for k in range(K):
  d=int(input())
  A=map(int, input().split())
  for a in A:
    CHECKED[a-1]=True
print(CHECKED.count(False))

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

Solution (Python):
n,k = map(int, input().split())
setn = {x for x in range(1,n+1)}
setd = set()
for i in range(k):
  d = int(input())
  setd |= set(map(int, input().split()))
print(len(setn - setd))

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

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

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

print(oks.count(0))

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

Solution (Python):
n, k = map(int,input().split())
have = [False] * n
for _ in range(k):
    d = input()
    a = list(map(lambda x: int(x)-1, input().split()))
    for x in a:
        have[x] = True

print(have.count(False))

Solution (Python):
n,k=list(map(int, input("").split()))
d=[]
a=[]
t=[]
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input("").split())))
for i in range(n):
    t.append(True)
for i in range(k):
    for j in a[i]:
        if t[j-1]:
            t[j-1]=False
out=0
for i in t:
    if i:
        out+=1
print(out)

Solution (Python):
n,k = list(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(sum(sunuke))

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

for i in range(N):
    if i+1 not in li:
        count += 1

print(count)

Solution (Python):


N, K = map(int, input().split())
count = [0] * N
for _ in range(K):
    d = int(input())
    treat = list(map(int, input().split()))
    for val in treat:
        count[val-1] += 1

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

print(ans)

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

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

print(n - len(ans))

Solution (Python):
list_K = []
N,K = map(int,input().split())
for i in range(K):
    d = int(input())
    A = [int(j) for j in input().split()]
    for k in range(d):
        list_K.append(A[k])
list_K0 = list(set(list_K))
list_K0.sort()
list_N = list(range(1,N+1))
set_NK = set(list_N)-set(list_K0)
print(len(set_NK))

Solution (Python):

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

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


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

ans = count.count(0)
print(ans)

Solution (Python):
from collections import defaultdict

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

d = {i: [] for i in range(1, N+1)}
for _ in range(K):
    candy = int(input())
    for i in map(int, input().split()):
        d[i].append(candy)

print(list(d.values()).count([]))

Solution (Python):
def Qb():
    n, k = map(int, input().split())
    ans = set()
    for v in range(k):
        d = int(input())
        ns = [int(v) for v in input().split()]
        for N in ns:
            ans.add(N)
    print(n - len(ans))


if __name__ == '__main__':
    Qb()

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

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

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

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

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

Solution (Python):


def main():
    n, k = map(int, input().split())
    
    a = []
    for i in range(k):
        d = int(input())
        tmp_a = list(map(int, input().split()))
        a.extend(tmp_a)
    ans = len(set(range(1, n+1)) - set(a))
    print(ans)
    
main()

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

Solution (Python):

N, K = map(int,input().split())
sweets = [0]*N
for _ in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for a in A:
        sweets[a-1] += 1
ans = sum([e == 0 for e in sweets])
print(ans)

Solution (Python):
def solve():
    N,K = [int(i) for i in input().split()]
    ans = set([i for i in range(1, N+1)])
    for i in range(K):
        d = int(input())
        target = set([int(j) for j in input().split()])
        ans -= target
    print(len(ans))

if __name__ == "__main__":
    solve()

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

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

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

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

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

for _ in range(k):
  d = input()
  hv_lst = list(map(int, input().split()))
  for i in hv_lst:
    lst[i-1] = 0
print(lst.count(1))

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

Solution (Python):
import numpy as np
def main():
  n, k  = list(map(int,(input().split())))
  a = np.array([])
  for i in range(k):
    d  = int(input())
    ak = list(map(int,(input().split())))
    a = np.append(a,ak)
    

  a = set(a)
  ans = n - len(a)
  print(ans)
  
  
  
  
if __name__ == '__main__':
  main()

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

print(sum(A))

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

candy_set = set()
for i in range(k):
    d = int(input())
    snuke = list(map(int,input().split()))
    for s in snuke:
        candy_set.add(s)

count = 0
for i in range(n):
    if not i+1 in candy_set:
        count+=1
print(count)

Solution (Python):
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

n,k = inm()
s = [0] * n
for i in range(k):
    d = ini()
    a = inl()
    for b in a:
        s[b-1] += 1
ans = sum(s[i] == 0 for i in range(n))
print(ans)

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

    for kk in range(k):
        kn = int(input())
        s = list(map(int,input().strip().split()))
        for kk in range(kn):
            nn[s[kk] - 1] += 1
    
    c = 0
    for ni in nn:
        if ni == 0:
            c += 1
    
    print(c)
    return 

main()

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

Solution (Python):
n, k = (int(i) for i in input().split())
used = [0 for i in range(n)]
for i in range(k):
    val = int(input())
    a = [int(j) for j in input().split()]
    for aa in a:
        used[aa - 1] = 1
cnt = 0
for i in used:
    cnt += i == 0
print(cnt)

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

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

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

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

Solution (Python):
N,K = map(int,input().split())
list1 ={i for i in range(1,N+1)}
list2 = set()
for i in range(K):
  NN = int(input())
  MM = map(int,input().split())
  for j in MM:
    list2.add(j)

ans = list1 -list2
print(len(ans))