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())
snuke = [1 for i in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for ai in a:
        snuke[ai-1] = 0
print(sum(snuke))

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

b = [False] * n
for lst in A:
    for i in lst:
        b[i - 1] = True

print(n - sum(b))

Solution (Python):

import glob
import numpy as np


REL_PATH = 'ABC\\166\\B'


TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]
        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class B(Common):

    def resolve(self):

        N, K = map(int, self.input_data().split())

        snack = np.zeros((N+1, K+1), dtype = int)

        for i in range(K):
            d = int(self.input_data())
            tmp = list(map(int, self.input_data().split()))
            for t in tmp:
                snack[t][i+1] = 1

        count = 0
        for i in range(1, N+1):
            if np.sum(snack[i,1:]) == 0:
                count += 1

        print(str(count))


solver = B(REL_PATH)
solver.exec_resolve()

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

Solution (Python):
import sys
def main():
    N,K=tuple(map(int,sys.stdin.readline().split()))
    C=[0 for _ in [0]*N]
    for _ in [0]*K:
        d=int(sys.stdin.readline())
        A=list(map(lambda x:int(x)-1,sys.stdin.readline().split()))
        for a in A:C[a]+=1
    print(C.count(0))
if __name__=='__main__':main()

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

sunuke = [0] * N
for i in range(K):
    _ = input()
    kasi_moti = map(int, input().split())
    for j in kasi_moti:
        sunuke[j - 1] = 1

count = 0
for k in sunuke:
    if k == 0:
        count += 1
print(count)

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

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

Solution (Python):
n,k=[int(x) for x in input().split()]
ok=[]
for i in range(k):
  d_i=int(input())
  a_i=[int(x) for x in input().split()]
  for a in a_i:
    ok.append(a)

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

print(len(bad))

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





ret = 0
for i in chk:
    if i == 0:
        ret += 1

print("{}".format(ret))

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

for people in range(N):
  num_snack.append(0)
  

for i in range(K):
  num_people = map(int, input())
  has_snack = list(map(int,input().split()))
  for people in has_snack:
    num_snack[people-1] += 1


no_snack = 0
for snacks in num_snack:
  if (snacks == 0):
    no_snack += 1
print(no_snack)

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

for k in range(K):
    k=int(input())
    listA=list(map(int,input().split()))
    for j in listA:
        while True:
            try:
                nusuke.remove(j)
            except ValueError:
                break
print(len(nusuke))

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

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

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

for _ in range(K):
    d = int(input())
    A = list(map(int,input().split(" ")))
    for id,value in enumerate(A):
        res[A[id]] = True

ans = res.count(False)
print(ans)

Solution (Python):
line = input().split()
line2 = []
zenin = int(line[0])
snack = int(line[1])

for i in range(zenin):
  line2.append(i+1)

for i in range(snack):
  person = int(input())
  line3 = input().split()
 
  for i in range(person):
    if int(line3[i]) in line2:
      line2.remove(int(line3[i]))
      
print(len(line2))

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

ans=0

for i in range(K):
    _d=int(input())
    _a=list(input().split())
    for _ in _a:
        L[int(_)]+=1

for j in range(1,N+1):
    if L[j]==0:
        ans+=1
print(ans)

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

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

    for i in range(K):
        d = int(input())
        a = map(int, input().split())
        for j in a:
            ans.append(j)

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

    print(count)
    return

main()

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


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

count = 0


for i in range(1,N+1):

  if not i in A:
    count += 1

print(count)

Solution (Python):

import sys
import numpy as np
from collections import deque



N,K = [int(x) for x in sys.stdin.readline().split()]
snu = np.zeros(N)

for _ in range(K):
    d = [int(x) for x in sys.stdin.readline().split()] 
    a = [int(x) for x in sys.stdin.readline().split()]
    n = np.size(a)
    for i in range(n):
        snu[a[i]-1] = snu[a[i]-1]+1

ju = np.count_nonzero(snu)
print(N-ju)

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

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

Solution (Python):
N, K = map(int, input().split())
A = [[]] * K
d = [0] * K
for i in range(2 * K):
    if i % 2:
        A[i // 2] = list(map(int, input().split()))
    else:
        d[i // 2] = int(input())
print(N - len(set([flatten for inner in A for flatten in inner])))

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

A = sum(A, [])
A = list(set(A))

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

print(ans)

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

Solution (Python):

def main():
    N, K = map(int,input().split(' '))
    snuke = [0] * (N+1)
    for _ in range(K):
        d = input()
        A = list(map(int,input().split(' ')))
        for j in A:
            snuke[j] = 1
    
    print(N-sum(snuke))
    
    
if __name__ == "__main__":
    main()

Solution (Python):
N,K = list(map(int,input().split()))
d=[]
e=[]
f=[]
for i in range(N):
	f.append(-1)
count=0
for i in range(K):
	d.append(0)
	e.append([]*N)
	d[i]= int(input())
	e[i]=list(map(int,input().split()))


for i in range(K):
	for j in range(d[i]):

			f[e[i][j]-1] = 1
		


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

Solution (Python):
def solve():
    N, K = map(int, input().split())
    h = [0 for _ in range(N)]
    for _ in range(K):
        d = int(input())
        A = map(int, input().split())
        for i in A:
            h[i-1] += 1
    print(h.count(0))




if __name__ == '__main__':
    solve()

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

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 i in a:
    s.add(i)
print(n-len(s))

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

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

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

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

print(ans)

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

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

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

a=set()

for _ in range(K):
  X=int(input())
  Y=list(map(int,input().split()))
  for b in Y:
    a.add(b)
print(N-len(a))

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


s= set()

for _ in range(K):
    d = int(input())
    A = map(int, input().split())
    b = set(A)
    s = s | b
    
print(N -len(s))

Solution (Python):
n,k = map(int,input().split())
human = [0]*n
for i in range(k*2):
  if i % 2 == 0:
    num = map(int,input())
  else:
    list1=list(map(int, input().split()))
    for i in list1:
      human[i - 1] = 1

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

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

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

print(sunuke.count(0))

Solution (Python):
import numpy as np
N,K = (int(x) for x in input().split())
Sweet = np.zeros(N,dtype=bool)
for T in range(0,K):
    Di    = int(input())
    DiWho = [int(x) for x in input().split()]
    for TT in range(0,Di):
        Sweet[DiWho[TT]-1] = True
print(N-sum(Sweet))

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

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

Solution (Python):
from __future__ import annotations

from dataclasses import dataclass, field
from typing import List, Optional, Generator


@dataclass
class Sweet:
    id: int


@dataclass
class User:
    id: int
    sweets: List[Sweet] = field(default_factory=list)

    def has_no_sweets(self) -> bool:
        return len(self.sweets) == 0

    def register_sweet(self, sweet: Sweet) -> None:
        self.sweets.append(sweet)


@dataclass(frozen=True)
class Users:
    values: List[User] = field(default_factory=list)

    @classmethod
    def create(cls, num_people: int) -> Users:
        users = [User(id=i) for i in range(1, num_people + 1)]

        return Users(users)

    def find_by_id(self, user_id: int) -> Optional[User]:
        return self.values[user_id - 1]

    def count_users_have_no_sweets(self) -> int:
        return sum([user.has_no_sweets() for user in self.values])


@dataclass
class DistributePlan:
    """どのお菓子をどのユーザに配布するか情報"""
    sweet_id: int
    user_ids: List[int] = field(default_factory=list)


@dataclass
class DistributePlans:
    num_people: int
    values: List[DistributePlan] = field(default_factory=list)

    @classmethod
    def create(cls, num_people, sweet_ids, distribution_plans) -> DistributePlans:
        plans = []

        for sweet_id, distribution_plan in zip(sweet_ids, distribution_plans):
            distribution_plan = DistributePlan(sweet_id, distribution_plan)
            plans.append(distribution_plan)

        return DistributePlans(num_people, plans)

    def gen(self) -> Generator:
        for plan in self.values:
            for user_id in plan.user_ids:
                yield plan.sweet_id, user_id

    def distribute(self) -> Users:
        users = Users.create(self.num_people)

        for sweet_id, user_id in self.gen():
            user = users.find_by_id(user_id)
            user.register_sweet(Sweet(id=sweet_id))

        return users


def actual(n, k, sweet_ids, distribution_user_ids):
    plans = DistributePlans.create(n, sweet_ids, distribution_user_ids)

    users = plans.distribute()

    return users.count_users_have_no_sweets()


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

sweet_ids = []
distribution_user_ids = []

for k_i in range(1, k + 1):
    d_i = int(input())
    a_i = list(map(int, input().split()))

    sweet_ids.append(d_i)
    distribution_user_ids.append(a_i)

print(actual(n, k, sweet_ids, distribution_user_ids))

Solution (Python):
N, K = list(map(int, input().split()))
haves = [False for _ in range(N)]
 
def judge_Flag(flags, num):
    As = list(map(int, input().split()))
    for i in range(num):
        flags[As[i] - 1] = True
        
for _ in range(K):
    people_num = int(input())
    judge_Flag(haves, people_num)
print(haves.count(False))

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

Solution (Python):

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

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

Solution (Python):
import sys


def main():
    read = lambda: sys.stdin.readline().rstrip()

    N, K = map(int,read().split())
    cnt = [0]*N
    
    for _ in range(K):
        d = int(read())
        A = list(map(int,read().split()))
        for num in A:
            cnt[num-1] += 1
    
    print(cnt.count(0))


 
if __name__ == "__main__":
    main()

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

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

Solution (Python):
import itertools

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

B = []

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

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

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

for j in range(k):
  d = int(input())
  a = map(int, input().split())
  for k in a:
    check[k-1] = True

print(check.count(False))

Solution (Python):
n, k = map(int, input().split())
people = [False for i in range(n)]
for i in range(k):
    input()
    a = map(int, input().split())
    for j in a:
        people[j-1] = True
print(people.count(False))

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

d = [0] * k
a = [0] * k
sunuke = [0] * n

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

print(sunuke.count(0))

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

print(sum(people))

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

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

print(n - len(np.unique(L)))

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

s = 0
for i in range(1, n + 1):
    tf = False
    for j in range(k):
        if i in a[j]:
            tf = True
            break
    if tf == False:
        s += 1

print(s)

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

Solution (Python):
(N, K) = [int(n) for n in input().split()]
C = [1 for _ in range(N)]
for _ in range(K):
    d = int(input())
    A = [int(n) - 1 for n in input().split()]
    for a in A:
        C[a] = 0

print(sum(C))

Solution (Python):
person,okasi = map(int,input().split())
have = []
ans = 0

for i in range(okasi):
    a = int(input())
    b = input().split()
    for j in range(a):
        have.append(int(b[j]))

for k in range(person):
    if k+1 in have:
        ans = ans
    else:
        ans = ans + 1
    
print(ans)

Solution (Python):
N,K = [int(x) for x in input().split()]
P = dict([(i,True) for i in range(1,N+1)])
for k in range(K):
    d = input()
    for p in [int(x) for x in input().split()]:
        P[p] = False
print(sum(list(P.values())))

Solution (Python):
n,k=map(int,input().split())
i=0
d=[]
a=[]
while i<k:
    d.append(int(input()))
    a.extend(list(map(int,input().split())))
    i+=1
i=1
count=0
while True:
    if((i in a)!=True):
        count+=1
    i+=1
    if(i>n):
        break

print(count)

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 a in A:
        
        t[a-1] += 1
print(t.count(0))

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

ans = [i + 1 for i in range(N)]

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


diff = set(ans) - set(A)

print(len(diff))

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

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

print(ans)

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

having_okashi = [False] * N

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

print(N-sum(having_okashi))

Solution (Python):
def main():
    n, k = map(int, input().split())
    nl = list(range(1, n+1))
    al = list()
    for i in range(k):
        d = int(input())
        a = list(map(int, input().split()))
        al.extend(a)
    trick = list(set(nl) ^ set(al))
    print(len(trick))

if __name__ == '__main__':
    main()

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

for i in range(K):
    d = int(input())
    A = [int(s) for s in input().split()]
    for a in A:
        sunuke[a-1] += 1

print(sunuke.count(0))

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

Solution (Python):
x=input()
x0=x.split()
n=int(x0[0])
k=int(x0[1])
l=list()
z=0
for i in range(k):
    d=input()
    x=input()
    x0=x.split()
    l.extend(x0)
for p in range(n):
    c=str(p+1) in l
    if c==False:
        z=z+1
print(z)

Solution (Python):
A,B=map(int,input().split())
R=list(range(1,A+1))
for i in range(2*B):
  L=list(map(int,input().split()))
  if i%2==1:
    for j in range(len(L)):
      if L[j] in R:
        R.pop(R.index(L[j]))
  if R==list():
    break
print(len(R))

Solution (Python):

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

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

for m in range(0, k):
  d = int(input())
  li = [int(i) for i in input().split()]
  lis = lis + li
  
for s in range(1, n+1):
  if s in lis:
    count += 0
  else:
    count += 1

print(count)

Solution (Python):
import sys 

count = 0
list_ = []
N = 0

for i in sys.stdin:
    if count == 0:
        N = int(i.split()[0])
        count += 1
    else:
        list1 = []
        count += 1
        if count%2 == 0:
            pass
        else:
            list1 = list(map(int, i.split()))
            for j in list1:
                list_.append(j)

lista = list(set(list_))
x = 0
for k in range(1, N+1):
    if not(k in lista):
        x += 1
print(x)

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())
S=[0]*N
d=0
count=0
for i in range(K):
    d=int(input())
    L=list(map(int,input().split()))
    for j in range(d):
        S[L[j]-1]=1
    
for i in range(len(S)):
    if S[i]==0:
        count+=1
print(count)

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

print(A.count(0))

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

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

Solution (Python):
def check(human):
    sum = 0
    for i in human:
        if(i == 0):
            sum += 1
    return sum

def resolve():
    data = [int(i) for i in input().split()]
    
    human = [0 for i in range(data[0])]
    sweet = data[1]
    
    for i in range(sweet):
        mem = int(input())
        have = [int(j) for j in input().split()]
        
        for k in have:
            human[k-1] += 1
    
    print(check(human))
resolve()

Solution (Python):
import itertools

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

People = []

for i in range(2 * K):
    if i % 2 == 1:
        People.append(U[i])

for i in range(1, N + 1):
    if str(i) in list(itertools.chain.from_iterable(People)):
        N -= 1

print(N)

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

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

ans = 0

for i in range(n):
    if (i+1) not in safe:
        ans += 1
        
print(ans)

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

Solution (Python):


N, K = map(int, input().split())
d = []
a = []

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

child = list(range(N))
x = [0]*N

for j in child:
    for c in range(K):
        if j+1 in a[c]:
            x[j] += 1

count = 0

for h in child:
    if x[h] == 0:
        count += 1

print(count)

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

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

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

Solution (Python):
n,k=map(int,input().split())
binbo=[0]*n
for i in range(k):
  d=int(input())
  okasi=list(map(int,input().split()))
  for j in okasi:
    binbo[j-1] = 1
print(binbo.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())))
flag = [False]*N
for i in A:
    for j in i:
        flag[j-1] = True
print(N - sum(flag))

Solution (Python):
n, k = map(int,input().split())
n_k = [0 for i in range(n)]
for i in range(k):
  _n = int(input())
  _k = list(map(int, input().split()))
  for i in _k:
    n_k[i-1] += 1

print(len([1 for i in n_k if i==0]))

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np
import math
from collections import deque
from collections import defaultdict
from math import gcd

N, K = map(int, input().split())
snuke = defaultdict(int)
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for n in A:
        snuke[n] += 1

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

print(ans)

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

Solution (Python):
def main():
    N, K = map(int, input().split())
    A_have = [0]*N
    num = N

    for k in range(0, K):
        d = int(input())
        A = map(int, input().split())
        for a in A:
            if A_have[a-1] == 0:
                A_have[a-1] = 1
                num -= 1
    print(num)
                    
if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

sunuke = []
ans = 0

for i in range(N):
    sunuke.append([])

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

for i in sunuke:
    if len(i) == 0:
        ans += 1

print(ans)

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

ans = set([i+1 for i in range(n)])

for i in range(k):
    d.append(int(input()))
    ans.difference_update(set(map(int, input().split())))

print(len(ans))

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

snuke = [False] * N

for _ in range(K):
  input()  
  for s in input().split():
    snuke[int(s) - 1] = True
    
print(N - sum(snuke))

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

alls = set(i + 1 for i in range(n))
done = set()

for _ in range(k):
  input()
  for i in list(map(int, input().split())):
    done.add(i)
print(len(alls - done))

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

a = []
d = []
for i in range(k):
  d.append(input())
  a+=(map(int,input().split()))
set_a = set(a)
count = 0
for i in range(1,n+1):
  if i in set_a:
    continue
  else:
    count+=1
print(count)

Solution (Python):

import itertools

N, K = list(map(int, input().split()))
s_list = []

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

s_list = set(itertools.chain.from_iterable(s_list))
ans = N - len(s_list)

print(ans)

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

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

for i in range(k):
    d = int(input())
    a = input().split()
    for k in range(len(a)):
        b.append(a[k])

print(n - len(set(b)))

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

Solution (Python):
snukes = input().split(" ")
n = int(snukes[0])
k = int(snukes[1])

village = [0] * n
for i in range(k):
    numOwners = int(input())
    candyOwners = input().split(" ")
    for j in range(numOwners):
        village[int(candyOwners[j])-1] += i+1

print(village.count(0))

Solution (Python):
n,m=map(int,input().split())
d=[list(map(int, input().split())) for i in range(m*2)]

s=[]
for i in range(1,m*2,2):
  s.extend(d[i])
s=list(set(s))

print(n-len(s))

Solution (Python):

n,k = map(int, input().split())
n_list = []
tmp = []

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

for i in range(k):

    d = int(input())

    a = input().split()
    for j in range(len(a)):
        if int(a[j]) in n_list:
            n_list.remove(int(a[j]))

print(len(n_list))

Solution (Python):
n,k=map(int, input().split())
ans=set()
for x in range(k):
    d=int(input())
    a=list(map(int, input().split()))
    for y in a:
        ans.add(y)
print(n-len(ans))

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


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