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())
d={i+1:0 for i in range(n)}

for i in range(k):
    n=input()
    q=list(map(int,input().split()))
    for j in q:
        d[j]+=1
ans=0
for i in d.values():
    if i==0:
        ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a = [0] * n

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

    for j in range(len(t)):
        a[t[j]-1] = 1

#print(a)
print(a.count(0))

Submission status: Accepted

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

print(sum(sunuke))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
L = [True for _ in range(n)]

for _ in range(k):
    input()
    A = list(map(int, input().split()))
    for a in A:
        L[a - 1] = False
print(sum(L))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
hashMap = {i+1:0 for i in range(n)}
for _ in range(k):
  input()
  for i in map(int, input().split()):
    hashMap[i] += 1

ans = 0
for i,v in hashMap.items():
  if v == 0:
    ans += 1
print(ans)

Submission status: Accepted

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

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 = list(set(ans) | set(a))

print(N - len(list(ans)))

Submission status: Accepted

Solution code:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
n,k = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
tr = [0] * n
for i in range(k):
    d =int(stdin.readline().rstrip())
    As = list(map(int, stdin.readline().rstrip().split()))
    for a in As:
        tr[a-1] = 1

print(tr.count(0))

Submission status: Accepted

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

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

ans = 0
for i in d:
    if d[i] == []:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def m():
    n, k = map(int, input().split())
    dic = {}
    for _ in range(k):
        d = int(input())
        a = list(map(int, input().split()))
        for i in a:
            dic[i] = 1
    return n - len(dic.keys())


print(m())

Submission status: Accepted

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

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

a = [1] * (n + 1)
a[0] = 0

for _ in range(k):
    d = int(input())
    b = [int(x) for x in input().split()]

    for x in b:
        a[x] = 0

print(sum(a))

Submission status: Accepted

Solution code:
# n = int(input())
n,k = [int(j) for j in input().split()]
dif = [False for i in range(n)]
for i in range(k):
	d = input()
	l = [int(j) for j in input().split()]
	for j in l:
		dif[j-1] = True
print(dif.count(False))

Submission status: Accepted

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

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

Submission status: Accepted

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


lst = [False] * N

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

    for y in x:
        if lst[y - 1]:
            continue
        else:
            lst[y - 1] = True



cnt = 0
for a in lst:
    if not a:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

l = [0]*n

for i in a:
    for j in i:
        l[j-1] += 1

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

Submission status: Accepted

Solution code:
n , k = map(int,input().split())
p = {i+1 for i in range(n)}
kar = set()
for j in range(k):
    d = int(input())
    a = set(list(map(int,input().split())))
    kar = kar | a

p = p - kar

print(len(p))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    N,K=mis()
    s = set()
    for _ in range(K):
        input()
        s |= set(lmis())
    print(N-len(s))

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

def MII_split():
    return map(int, input().split())

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

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

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

N, K = MII_split()
sunukes = [0 for _ in range(N)]  # お菓子の個数
for k in range(K):
    _ = input()
    As = MII_split()
    for A in As:
        sunukes[A - 1] += 1

print(sunukes.count(0))

Submission status: Accepted

Solution code:
import numpy as np
N,K = map(int,input().split())
L = np.zeros(N+1)
for _ in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for i in A:
        L[i] += 1

print(len(L[L==0])-1)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
s = []
for _ in range(k):
    d = int(input())
    list_score = list(map(int, input().split()))
    s += list_score

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
has = [0] * n
for _ in range(k):
    d = int(input())
    for a in map(int, input().split()):
        has[a - 1] = 1

print(n - sum(has))

Submission status: Accepted

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

Submission status: Accepted

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

print(n-len(ans))

Submission status: Accepted

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, K = list(map(int,_in[0].split(' ')))  # type:list(int)
    d_arr = []
    for i in range(K):
        _ = int(_in[2*i+1])  # type:int
        d_arr.append(_)
    A_arr = []
    for i in range(K):
        _ = list(map(int,_in[2*i+2].split(' ')))  # type:list(int)
        A_arr.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    _ = list(set(sum(A_arr,[])))
    cnt = N-len(_)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, k = map(int,input().split())
d = []
a = []
for _ in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
check = [False] * n
for i in range(k):
    for j in a[i]:
        check[j-1] = True

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

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()))
print(n-len(set(A)))

Submission status: Accepted

Solution code:
import itertools
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
import bisect
import sys
import math
sys.setrecursionlimit(10**9)

def main():
    N,K = map(int,input().split())

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


    print(N-len(kashi))


if __name__ == "__main__":
  main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(n-len(aset))

Submission status: Accepted

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


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    N, K = list(map(int, input().split()))
    A = []
    for _ in range(K):
        _ = input()
        A.append(list(map(int, input().split())))
    B = set()
    for a in A:
        for aa in a:
            B.add(aa)
    print(N - len(B))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k =map(int, input().split())
res = 0
a = [0 for x in range(n)]
for i in range(k):
    d = int(input())
    array = [int(x) for x in input().split()]
    for j in array:
        a[j-1]+=1
for aa in a:
    if aa == 0:
        res += 1
print(res)

Submission status: Accepted

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

nums = [0] * N

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

ans = 0
for num in nums:
    if num == 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
s = set()
for _ in range(K):
    D = int(input())
    s.update(map(int, input().split()))
print(N - len(s))

Submission status: Accepted

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

for _ in range(m):
    d = int(input())
    data = list(map(int, input().split()))
    for d in data:
        count[d-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 = set()
for _ in range(K):
    d = int(input())
    S |= set(input().split())
print(N-len(S))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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


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


print(ans)

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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 j in a:
        l[j-1] += 1
ans = 0
for i in l:
    if i == 0:
        ans +=1
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N,K = inputIL()

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

for k in range(K):
  n = input()
  l_ = inputIL()
  for item in l_:
    l[item-1] += 1
ans = 0
for item in l:
  if item == 0:
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, K = iim()

    okasi = set()
    for i in range(K):
        input()
        for i in iim():
            okasi.add(i)

    print(N-len(okasi))

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
ans = [0]*N
for i in range(K):
    di=int(input())
    ai = list(map(int,input().split()))
    for j in range(di):
        ans[ai[j]-1]+=1
print(ans.count(0))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(n - sum(have_candy))

Submission status: Accepted

Solution code:
def main():
    n, k = map(int, input().split())
    ans_list = []
    for i in range(k):
        d = int(input())
        num_list = list(map(int, input().split()))
        for j in range(d):
            ans_list.append(num_list[j])

    ans_list = list(set(ans_list))

    print(n - len(ans_list))

if __name__ == '__main__':
    main()

Submission status: Accepted

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


snk = [False]*n

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

print(snk.count(False))

Submission status: Accepted

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

sunu = [1 for i in range(n)]
for i in range(k):
    for a in a_list[i]:
        sunu[a-1] = 0
print(sum(sunu))

Submission status: Accepted

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

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

B = set(A)
print(N - len(B))

Submission status: Accepted

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, K = lr()
    c = [1]*N
    for i in range(K):
        d = ir()
        A = lr()
        for j in range(d):
            c[A[j]-1] = 0
    print(sum(c))
resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

s = set()
for i in range(k):
  d =input()
  s |= set(list(input().split()))
  
  
print(n-len(s))

Submission status: Accepted

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