Problem:
 Score : 200 points    Problem Statement N  Snukes called Snuke 1 , Snuke 2 , ..., Snuke N live in a town.  There are K kinds of snacks sold in this town, called Snack 1 , Snack 2 , ..., Snack K . The following d_i Snukes have Snack i : Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}} .  Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?      Constraints  All values in input are integers.  1 \leq N \leq 100  1 \leq K \leq 100  1 \leq d_i \leq N  1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N         Input Input is given from Standard Input in the following format:  N  K  d_1  A_{1, 1} \cdots A_{1, d_1}  \vdots  d_K  A_{K, 1} \cdots A_{K, d_K}       Output Print the answer.        Sample Input 1 3 2
2
1 3
1
3      Sample Output 1 1   Snuke 1 has Snack 1 .  Snuke 2 has no snacks.  Snuke 3 has Snack 1 and 2 .   Thus, there will be one victim: Snuke 2 .       Sample Input 2 3 3
1
3
1
3
1
3      Sample Output 2 2

Solution (Python):
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

n, k = load_list()
d = defaultdict(int)
for i in range(k):
    load()
    A = load_list()
    for a in A:
        d[a] += 1

cnt = 0
for i in range(1, n+1):
    if d[i] == 0:
        cnt += 1
print(cnt)

Solution (Python):
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy




def main():
    N,K = map(int, input().split())
    snukes = [0]*N
    for _ in range(K):
        d = int(input())
        A = list(map(int, input().split()))
        for a in A:
            snukes[a-1] += 1
    count = 0
    for snuke in snukes:
        if not snuke:
            count += 1
    print(count)

if __name__ == '__main__':
    main()

Solution (Python):

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

Solution (Python):


def submit():
    n, k = map(int, input().split())
    treat = {i:False for i in range(1, n + 1)}
    
    for _ in range(k):
        d = int(input())
        a = list(map(int, input().split()))
        for s in a:
            treat[s] = True

    print(n - sum(treat.values()))


submit()

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

print(n-len(a))

Solution (Python):

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

Solution (Python):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N, K = map(int, input().split())
    S = [0 for _ in range(N)]
    for i in range(K):
        d = int(input())
        A = list(map(int, input().split()))
        for a in A:
            S[a - 1] += 1
    ans = 0
    for s in S:
        if s == 0:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
def main():

    from bisect import bisect_left as bl, bisect_right as br, insort
    import sys,heapq,math
    from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    out = sys.stdout.write
    
    INF = int(1e9)
    mod = int(1e9)+7

    n,k=mdata()
    l=[0]*n
    for i in range(k):
        d=int(data())
        s=mdata()
        for j in s:
            l[j-1]+=1
    cnt=0
    for i in l:
        if i==0:
            cnt+=1
    print(cnt)


if __name__ == '__main__':
    main()

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

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

Solution (Python):

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

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

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

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

INF = 999999999999999999999999
MOD = 10**9+7

n,k = get_nums_l()

check = [False] * (n+1)

for i in range(k):
    d = int(input())
    for a in get_nums_l():
        check[a] = True

ans = 0

for i,b in enumerate(check):
    if not b:
        ans += 1

print(ans-1)

Solution (Python):



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

print(snk.count(0))

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

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

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

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

Solution (Python):
N, K = list(map(int, input().split()))
ans = [0] * N
for i in range(K):
    d = int(input())
    Ai = list(map(int, input().split()))
    for j in range(d):
        Aij = Ai[j]
        ans[Aij-1] = 1
AC = 0
for i in range(N):
    if ans[i] == 0:
        AC += 1
print(AC)

Solution (Python):
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    n,k = mi()
    a = []
    for i in range(k):
        d = ii()
        atmp = li()
        a.append(atmp)

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

    for _ in range(k):
        for i in a[_]:
            ans[i] = 0
    print(sum(ans))


main()

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

cnt = 0
for sn in s:
    if not sn:
        cnt += 1

print(cnt)

Solution (Python):
if __name__ == '__main__':
    from sys import stdin
    
    import math
    input = stdin.readline

    

    n, k = map(int, input().split())
    ans = set(range(1, n+1))
    for _ in range(k):
        d = int(input())
        aa = set(map(int, input().split()))
        ans = ans-aa
    print(len(ans))

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    N,K=map(int,readline().split())
    flags=[False]*N
    for i in range(K):
        d=int(readline())
        A=list(map(int,readline().split()))
        for a in A:
            a-=1
            flags[a]=True

    res=0
    for i in range(N):
        if flags[i]==False:
            res+=1

    print(res)

if __name__=="__main__":
    main()

Solution (Python):
def solve():
    N, K = map(int,input().split())
    have = [False] * N
    for i in range(K):
        d = int(input())
        A = list(map(lambda x:int(x)-1, input().split()))
        for a in A:
            have[a] = True
    
    print(N - sum(have))
if __name__ == '__main__':
    solve()

Solution (Python):
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N, K = [int(x) for x in input().strip().split()]
    sunuke = [0] * N
    for k in range(K):
        input()
        for a in [int(x) for x in input().strip().split()]:
            sunuke[a-1] += 1
    
    cnt = 0
    for n in range(N):
        if sunuke[n] == 0:
            cnt += 1
    
    print(cnt)

if __name__ == '__main__':
    main()

Solution (Python):
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))

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

Solution (Python):
from _collections import defaultdict
n,k=map(int,input().split())
X=defaultdict(int)
for i in range(k):
    d=int(input())
    A=list(map(int,input().split()))
    for a in A:
        X[a]+=1
print(n-len(X))

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

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

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

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

print(N-sum(memo))

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

Solution (Python):
def main():

    N, K = map(int, input().split())
    v = [0 for _ in range(N)]
    for _ in range(K):
        d = int(input())
        A = list(map(int, input().split()))
        for u in A:
            v[u-1] += 1
    ans = 0
    for i in range(N):
        if v[i] == 0: ans += 1
    return ans

if __name__ == '__main__':
    print(main())

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

print(memo.count(0))

Solution (Python):
ma = lambda :map(int,input().split())
ni = lambda:int(input())

n,k = ma()
sn = [0]*n
for i in range(k):
    d = ni()
    for a in ma():
        sn[a-1]=1
c = 0
for w in sn:
    if w==0:c+=1
print(c)

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

Solution (Python):
N, K = map(int, input().split())
st = set()
for _ in range(K):
    input()
    st |= set(map(int, input().split()))
print(len(set(range(1, N + 1)) - st))

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

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

Solution (Python):
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]





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

ans = sum(dp)
print(ans)

Solution (Python):


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    

    
    

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

if __name__ == '__main__':
    main()

Solution (Python):
N,K=map(int,input().split())
D=[]
N=[False for i in range(N)]
for i in range(K):
    a=input()
    A=list(map(int,input().split()))
    for i in range(len(A)):
        N[A[i]-1]=True
ans=0
for i in N:
    if not i:
        ans+=1
print(ans)

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

Solution (Python):
def main():
    n,k = map(int,input().split())
    a = []
    for i in range(k):
        d = int(input())
        aa = list(map(int,input().split()))
        a.extend(aa)
    print(n-len(set(a)))
if __name__=='__main__':
    main()

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

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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    n, k = LI()
    per = [False for i in range(n)]
    for i in range(k):
        d = I()
        a = LI_()
        for person in a:
            per[person] = True
    cnt = 0
    for i in range(n):
        if not per[i]:
            cnt += 1
    print(cnt)


main()

Solution (Python):
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

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

cnt = 0
for s in snuke:
    if s == 0:
        cnt += 1

print(cnt)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n,k=MAP()

a=[0 for i in range(n)]
for i in range(k):
    b=INT()
    b=LIST()
    for l in b:
        a[l-1]+=1
ans=0
for i in a:
    if i==0:
        ans+=1
print(ans)

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

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


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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





n,k=mii()

chk=[0]*n
for i in range(k):
    d=ii()
    arr=limii()
    for j in range(d):
        chk[arr[j]-1]=1

print(n-sum(chk))

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

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

Solution (Python):
def main():
    N, K = map( int, input().split())
    ANS = [1]*N
    for _ in range(K):
        d = int( input())
        A = list( map( lambda x: int(x)-1, input().split()))
        for a in A:
            ANS[a] = 0
    print( sum(ANS))
if __name__ == '__main__':
    main()

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

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

count = 0
for t in treats:
	if not t:
		count += 1

print(count)

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

dic = {}
for i in range(n):
    dic[i] = 0

for i in range(k):
    d = int(input())
    a = [int(i)-1 for i in input().split()]
    for j in a:
        dic[j] = 1
print(n-sum(dic.values()))

Solution (Python):
N, K = map(int, input().split())
dic = {i: 0 for i in range(1, N+1)}
for _ in range(K):
  dt = int(input())
  A = list(map(int, input().split()))
  for a in A:
    dic[a] += 1

ans = 0
for k, v in dic.items():
  if v == 0:
    ans += 1

print(ans)

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k = map(int, readline().split())
aa = []
for i in range(k):
    d = int(readline())
    aa += list(map(int, readline().split()))
aa = set(list(aa))
cnt = 0
for i in range(1, n + 1):
    if i not in aa:
        cnt += 1
print(cnt)

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

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

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

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

print(n - len(A))

Solution (Python):
import bisect
import collections
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 62


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


def llmi(n):
    return [lmi() for _ in range(n)]

N,C = lmi()

x = { i for i in range(1,N+1)}
for _ in range(C):
    input()
    x = x - set(lmi())
print(len(x))

Solution (Python):
N, K = map(int, input().split())
S = set()
for k in range(K):
    input()
    S |= set(map(int, input().split()))
print(N-len(S))

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N, K = Scanner.map_int()
    M = [False for _ in range(N)]
    for _ in range(K):
        D = Scanner.int()
        A = Scanner.map_int()
        for a in A:
            M[a - 1] = True
    print(sum([not m for m in M]))


def main():
    
    solve()


if __name__ == "__main__":
    main()

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

for x in c:
    if x == 0:
        ans += 1
print(ans)

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    snk = [0] * N
    for n in range(K):
        d = ii()
        A = il()
        for a in A:
            snk[a-1] += 1
    print(sum(1 for s in snk if s == 0))


if __name__ == '__main__':
    main()

Solution (Python):
N,K  = [int(hoge) for hoge in input().split()]
Hito = [True]*N
for i in range(K):
    input()
    A = [int(hoge) for hoge in input().split()]
    for a in A:
        Hito[a-1] = False
print(sum(Hito))

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

Solution (Python):
n,k = map(int,input().split())
x = [1]*n
for _ in range(k):
  di = int(input())
  ai = list(map(int,input().split()))
  for y in ai:
    if x[y-1] == 1:
      x[y-1] = 0
print(sum(x))

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

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

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

    for j in lis:
        li[j-1]=0

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

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

S = [0 for i in range(n)]

for i 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 = map(int,input().split())
cnt=[0 for _ in range(n)]
for i in range(k):
    d=int(input())
    a= list(map(int,input().split()))
    for x in a:
        cnt[x-1]+=1
ans=0
for x in cnt:
    if x==0:
        ans+=1
print(ans)

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

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

for i in range(k):
    d = input()
    target = list(map(int,input().split()))
    for t in target:
        n_list[t-1] = 1

print(len(n_list)-sum(n_list))

Solution (Python):
n, k = map(int,input().split())
nlist=[0]*n
for i in range(k):
    d=int(input())
    alist=list(map(int, input().split()))
    for al in alist:
        nlist[al-1]+=1

answer=0
for nl in nlist:
    if nl==0:
        answer+=1

print(answer)

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

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

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

print(sum(X))

Solution (Python):
n, k = map(int, input().split())
l = list(range(1, n+1))

for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in a:
        if i in l:
            l.remove(i)
print(len(l))

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

if __name__ == "__main__":
    main()

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

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

ans = 0

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

print(ans)

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

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]

def to_bin(x: int) -> str: return format(x, 'b') 
def to_oct(x: int) -> str: return format(x, 'o') 
def to_hex(x: int) -> str: return format(x, 'x') 
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]

from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left


def main():
    n, k = MII()
    snk = [0]*n
    for i in range(k):
        d = II()
        aa = MIIZ()
        for a in aa:
            snk[a] = 1
    z = [1 for s in snk if s == 0]
    print(sum(z))

if __name__ == '__main__':
    main()

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