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



Sample input:
3 2
2
1 3
1
3


Sample output:
1

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
given = set()
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        given.add(a)
print(N - len(given))

Submission status: Accepted

Solution code:
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))

n,k = mp()
okasi = [0]*n
for i in range(k):
    d = int(input())
    a = lmp()
    for j in a:
        okasi[j-1] += 1
print(okasi.count(0))

Submission status: Accepted

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

is_appear = [False]*N
for _ in range(K):
    _ = int(input())
    A = list(map(int, input().split()))
    for a in A:
        is_appear[a-1] = True

ans = 0
for b in is_appear:
    if b == False:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N, K = rl()
A = []
for i in range(K):
	d = ri()
	a = rl()
	A.append(a)

cnt = [0] * N
for a in A:
	for i in a:
		cnt[i-1] = 1
ans = 0
for c in cnt:
	if c == 0:
		ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
count=[False]*n
for _ in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for i in range(d):
        count[a[i]-1]=True
ans=0
for i in count:
    if not i:
        ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = set()
for i in range(N):
    ans.add(i+1)

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        if a in ans:
            ans.remove(a)

print(len(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
l=[0]*n
for i in range(k):
    d=int(input())
    A=map(int,input().split())
    for a in A:
        l[a-1]+=1
count=0
for i in range(n):
    if l[i]==0:
        count+=1
print(count)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline

N, K = map(int, readline().split())
ok = [0] * (N + 1)
for _ in range(K):
    d = int(readline())
    A = map(int, readline().split())
    for i in A:
        ok[i] = True

print(N - sum(ok))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)
	

N,K = list(map(int, stdin.readline().rstrip().split()))
ans = 0
d = {}
for kk in range(K):
	dd = int(input())
	l = list(map(int, stdin.readline().rstrip().split()))
	for i in l:
		d[i] = 1
for i in range(1,N+1):
	if(i not in d):
		ans += 1
# print('d:',d)
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

people = [0] * n

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

people = np.array(people)
a = np.count_nonzero(people)
print(n - a)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N,K = map(int,input().split())
    treats = [0] * N
    for i in range(K):
        d = int(input())
        A = list(map(int,input().split()))
        for j in range(d):
            treats[A[j]-1] +=1
    def isZero(i):
        return i == 0
    print(len(list(filter(isZero,treats))))
    # Failed to predict input format
    pass

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N,K= map(int, input().split())
okasizu = [0] * (N + 1)
for _ in range(K):
    d = int(input())
    nums = list(map(int, input().split()))
    for num in nums:
        okasizu[num] += 1
ans = 0
for i in range(1,N + 1):
    if okasizu[i] == 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N, K = list(map(int, input().split()))
B = [0]*N
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for one in A:
        B[one-1]+=1
cnt = 0
for one in B:
    if one==0:
        cnt+=1
print(cnt)

Submission status: Accepted

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

print(n-len(ans))

Submission status: Accepted

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

for _ in range(k):
    d = int(input())
    al = list(map(int, input().split()))
    for a in al:
        l[a-1] += 1

print(l.count(0))

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
N,K=list(map(int,input().split()))
child=[False] * N
for _ in range(K):
    d=int(input())
    ppp = list(map(int,input().split()))
    for p in ppp:
        child[p-1]=True
ans = 0
for t in child:
    if not t:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
a = set()
for i in range(k):
    input()
    a = a | set(map(int, input().split()))
ans = set(range(1, n + 1)) - a
print(len(ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N,K = map(int, input().split())

okasi = [1 for i in range(N)]

for i in range(K):
  d = int(input())
  list_okasi = list(map(int, input().split()))
  for sunuke in list_okasi:
    okasi[sunuke-1] = 0
    
print(sum(okasi))

Submission status: Accepted

Solution code:
N, K = list(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))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
snuke = [0] * N
for _ in range(K):
    d = input()
    A = list(map(int, input().split()))
    for a in A:
        snuke[a - 1] = 1

ans = snuke.count(0)

print(ans)

Submission status: Accepted

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

print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import fractions
import collections
import itertools
N,K=map(int,input().split())
snu=[0]*N
for i in range(K):
    d=int(input())
    l=list(map(int,input().split()))
    for i in range(d):
        snu[l[i]-1]=snu[l[i]-1]+1
#print(snu)
cnt=0
for i in snu:
    if i==0:
        cnt=cnt+1
print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n, k = map(int, input().split())
ans = [True] * n
for _ in range(k):
    d = int(input())
    a = [int(item) for item in input().split()]
    for item in a:
        ans[item - 1] = False

print(sum(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
res_list = []
for i in range(k):
    di = int(input())
    a = [int(x) for x in input().split()]
    for aidi in a:
        if not aidi in res_list:
            res_list.append(aidi)

res = n
for i in range(1, n+1):
    if i in res_list:
       res -= 1
print(res)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

aa = [1]*n

for i in range(k):

    d = int(input())
    a = list( map(int, input().split()))
    for a_ in a:
        aa[a_-1]=0

print(sum(aa))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
treat=[True for i in range(n)]
ans=n
for i in range(k):
  input()
  a=list(map(int,input().split()))
  for j in a:
    if treat[j-1]:
      ans-=1
      treat[j-1]=False
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

def main():
    N, K = map(int, input().split())
    d = [None] * K
    A = [[] for _ in range(K)]
    for i in range(K):
        d[i] = int(input())
        A[i] = list(map(int, input().split()))
    
    ans = [1] * N
    for i in range(K):
        for j in range(d[i]):
            ans[A[i][j]-1] = 0
    print(sum(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n ,k = map(int,input().split())
all_li = []
for _ in range(k):
    d = int(input())
    li = list(map(int,input().split()))
    all_li += li
print(n-len(set(all_li)))

Submission status: Accepted

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

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

    for a in A:
        unique.add(a)

print(n-len(unique))

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
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

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
n, k = map(int, input().split())
cnt = [1 for i in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
        cnt[j - 1] = 0
ans = sum(cnt)
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
sunuke = {i for i in range(1, N+1)}

for i in range(K):
    d = int(input())
    A = set(list(map(int, input().split())))
    sunuke = sunuke - A

print(len(sunuke))

Submission status: Accepted

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

result=set([])

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

    for aa in a:
        result.add(aa)

print(n-len(list(result)))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N, K = map(int, input().split())
    D = set([i for i in range(1, N + 1)])
    for _ in range(K):
        _ = int(input())
        A = list(map(int, input().split()))
        for a in A:
            D.discard(a)
    print(len(D))
    


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, K = [int(_n) for _n in input().split()]
li = [0]*N
for i in range(K):
    input()
    A = [int(_n)-1 for _n in input().split()]
    for a in A:
        li[a]+=1
res = 0
for l in li:
    if l == 0:
        res += 1
print(res)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
x = [True] * (N+1)  # 1-indexed
for i in range(K):
    d = ir()
    A = lr()
    for a in A:
        x[a] = False

answer = sum(x) - 1
print(answer)

Submission status: Accepted

Solution code:
N, K = list(map(int, input().split(' ')))
dict_ = {}

for i in range(K):
  d = int(input())
  A = list(map(int, input().split(' ')))
  for p in A:
    dict_[p] = 1

print(N - len(dict_))

Submission status: Accepted

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

snukes = set(range(1, N+1))

for _ in range(K):
    d = input()
    snukes -= set(map(int, input().split()))

print(len(snukes))

Submission status: Accepted

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

s = set()

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
okasi = [1 for i in range(n)]
for i in range(k):
    di = int(input())
    ai = list(map(int, input().split()))
    for j in ai:
        okasi[j-1] = 0
print(sum(okasi))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
D=[]
A=[]
for i in range(K):
    D.append(int(input()))
    A+=list(map(int,input().split()))
A=list(set(A))
A.sort()
ans=0
for i in range(1,N+1):
    if i not in A:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N,K =  list(map(int, input().split()))
a = []
sunuke = [0]*N
for i in range(K):
    d = int(input())
    A =  list(map(int, input().split()))
    for l in range(len(A)):
        sunuke[A[l]-1] += 1

print(sunuke.count(0))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

n,k=l_in()

s = set(range(n))

for _ in range(k):
    d = n_in()
    A = l_in()
    for a in A:
        if a-1 in s:
            s.remove(a-1)

print(len(s))

Submission status: Accepted

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

Submission status: Accepted

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

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

answer = n - sum(map(int, have))
print(answer)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

print(N-sum(okashi))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math


NN = 202020
MOD = 10**9+7
# MOD = 998244353
INF = float("inf")

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

print(sum(kashi))

Submission status: Accepted

Solution code:
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)
print(n - len(set(l)))

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline

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

lis = [0 for _ in range(N)]

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

ans = 0

for l in lis:
    if l == 0:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
cand = {i for i in range(1, N+1)}
for _ in range(K):
    d = int(input())
    *A, = map(int, input().split())
    cand -= set(A)
print(len(cand))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def main():
    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()))

    tmp = [0] * N
    for i in range(K):
        for a in A[i]:
            tmp[a-1] += 1

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
sunukes = [False for i in range(N)] #true→持ってる

for i in range(K):
    d = int(input())
    A = [int(i) for i in input().split()]
    for j in A:
        sunukes[j-1] = True
    
ans = 0
for i in sunukes:
    if not i:
        ans += 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, K = mi()

flag = [0]*N

for i in range(K):
    n = ii()
    A = li()
    for num in A:
        flag[num-1] += 1

cnt = 0
for i in flag:
    if not i:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import bisect
N, K = map(int, input().split())
D = [0]*N
for i in range(K):
    d = int(input())
    for x in input().split():
        x = int(x)
        x -= 1
        D[x] += 1

D.sort()
print(bisect.bisect_left(D, 1))

Submission status: Accepted

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

Submission status: Accepted

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

A = list(set(A))

print(N-len(A))

Submission status: Accepted

Solution code:
import numpy as np
N, K = map(int, input().split())
ans = [0 for _ in range(N)]
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        ans[a - 1] = 1
print(N - np.count_nonzero(np.array(ans)))

Submission status: Accepted

Solution code:
import itertools

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

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

li = list(itertools.chain.from_iterable(li))
li = set(li)

print(n-len(li))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
cnt = [0] * (n)
for _ in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        a -= 1
        cnt[a] += 1
num = 0
for i in range(n):
    if cnt[i] == 0:
        num += 1

print(num)

Submission status: Accepted

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

print(L.count(0))

Submission status: Accepted

Solution code:
def examA():
    S = SI()
    if S=="ARC":
        ans = "ABC"
    else:
        ans = "ARC"
    print(ans)
    return

def examB():
    N, K = LI()
    snuke = set(range(1,N+1))
    for _ in range(K):
        d = I()
        A = LI()
        for a in A:
            snuke.discard(a)
    ans = len(snuke)
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
t=set()
for _ in range(K):
    D=int(input())
    A=list(map(int,input().split()))
    for i in A:
        t.add(i)
ans=0
for i in range(1,N+1):
    if i not in t:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
S = set()
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        S.add(a)
print(N - len(S))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#N = int(input())
N, K = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]

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

Submission status: Accepted

Solution code:
N,K = map(int, input().split())
D = []
A = []
for _ in range(K):
    d = int(input())
    D.append(d)
    a = [int(i) for i in input().split()]
    A.append(a)

L = [1]*N
for a in A:
    for i in a:
        L[i-1] = 0
print(sum(L))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
N,K=map(int,input().split())
okashi=[1 for i in range(N)]

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

print(sum(okashi))

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    d = [0]*n
    for _ in range(k):
        __ = input()
        a = LI()
        for i in a:
            d[i-1] = 1
    print(n-sum(d))
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum(ans))

Submission status: Accepted

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