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):
from collections import defaultdict
n, k = map(int, input().split())
a = [[] for _ in range(k)]
cnt = defaultdict(int)

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

for i in range(k):
    for x in a[i]:
        cnt[x] += 1

print(n - len(cnt))

Solution (Python):
N, K = map(int, input().split())
A = list(range(1,N+1))
S = set()
for _ in range(K):
    d = int(input())
    I = list(map(int, input().split()))
    for i in range(d):
        S.add(I[i])

print(len(A)-len(S))

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

def solve(N, K, D, A):
    c = [False for i in range(N+1)]
    for i in range(K):
        for a in A[i]:
            c[a] = True
    ans = sum([1 for x in c[1:] if not x])
    return ans
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))

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

for i in range(k):
  d = input()
  A =  list(map(int, input().split()))
  for a in A:
    ans[a-1] += 1
    
li = list()
for i, num in enumerate(ans):
  if num == 0:
    li.append(i)
    
print(len(li))

Solution (Python):
inp=input
li=list
iinp=lambda : int(inp())
ent=lambda : map(int,inp().split())
lient=lambda : [int(i) for i in inp().split()]
li0= lambda x: [0 for i in range(x)]
livalor=lambda valor,x: [valor for i in range(x)]
stent=lambda : [i for i in inp()]
filldp=lambda valor,x,y: [[valor for i in range(y)] for i in range(x)]

cantsnukes,cantdulces=ent()
personas=[0 for i in range(cantsnukes)]
for i in range(cantdulces):
    cant=iinp()
    numeros=lient()
    for i in numeros:
        personas[i-1]+=1
res=0
for i in personas:
    if i==0: res=res+1
print(res)

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

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

s = set(sum(A,[]))
print(n - len(s))

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 b:
    if a[j-1]==0:
      a[j-1]=1

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

Solution (Python):
n_nin,okasi=map(int,input().split())
okasi_have=[0]*n_nin
for i in range(1,okasi+1):
    di=int(input())
    ai_list=list(map(int,input().split()))
    for j in ai_list:
        okasi_have[j-1]+=1
    
print(okasi_have.count(0))

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

ALL = set()
for _ in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for a in A:
        ALL.add(a)
cnt = 0

for i in range(1,N+1):
    if not i in ALL:
        cnt += 1
print(cnt)

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

print(n-len(se))

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

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

print(n-sum(ans))

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

Solution (Python):


import sys

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    n, k = read_list(int)
    snukes = [0] * n
    for _ in range(k):
        read(int)
        for a in read_list(int):
            snukes[a - 1] += 1
    
    print(len([0 for s in range(n) if snukes[s] == 0]))


if __name__ == "__main__":
    main()

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

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

print(n-len(set(tmp)))

Solution (Python):
import numpy as np

n, k = map(int, input().split())
p = np.ones(n)
for i in range(k):
    d = int(input())
    a = np.array(input().split(), dtype=np.int64) -1
    p[a] = 0
ans = np.count_nonzero(p)
print(ans)

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

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

sunuke = [1]*n
for i in range(k):
    for j in range(len(a_l[i])):
        num = a_l[i][j]
        sunuke[num-1] = 0

ans = 0
for val in sunuke:
    ans += val
print(ans)

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

ans = [False] * N

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

    for i in a:
        ans[i-1] = True

print(ans.count(False))

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

hito = [i+1 for i in range(n)]
for i in a:
    for j in i:
        if j in hito:
            hito.remove(j)

print(len(hito))

Solution (Python):
n, k=list(map(int, input().split()))
list1 = set(range(1, n+1))
for i in range(k):
    d = int(input())
    set1 = set(map(int, input().split()))
    list1 = list1 - set1
print(len(list1))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = [1]*N

for _ in range(K):
	d = INT()
	a = LIST()
	for i in range(len(a)):
		A[a[i]-1] = 0


print(sum(A))

Solution (Python):
def resolve():
    n, k = map(int, input().split())
    sunuke = set()
    for i in range(k):
        input()
        for men in list(map(int, input().split())):
            sunuke.add(men)

    print(n - len(sunuke))
resolve()

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

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

Solution (Python):
import sys
from math import log2,floor,ceil,sqrt



Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

n,k  = Ri()
s = set([i+1 for i in range(0,n)])
for i in range(k):
    val = int(ri())
    temp  = Ri()
    for j in temp:
        if j in s:
            s.remove(j)
print(len(s))

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

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

Solution (Python):
x = [int(i) for i in input().split()]
n = x[0]
k = x[1]
ans =[]
for i in range(k):
    a = int(input())
    b = [int(i) for i in input().split()]
    ans = ans + b
print(n-len(set(ans)))

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

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

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

B = []

for _ in range(K):
    d = int(input())
    B += list(map(int, input().split()))

B = list(set(B))

cnt = 0
for i in range(1, N + 1):
    if i not in B:
        cnt += 1

print(cnt)

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

Solution (Python):




def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



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



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, k = input_to_int_map()

    a_list = []
    for i in range(k):
        ninsu = int(input())
        a_list.append(set(map(int, input().split())))

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

    ret = all_sunukes
    for a in a_list:
        ret -= a

    return len(ret)


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

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

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

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

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

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

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

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

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

print(sum([1 for n in ns if n == 0]))

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

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

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

no_okashi = [1 for ok in okashi if ok == 0]

print(len(no_okashi))

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N, K = LI()
    d = []
    A = []
    for i in range(K):
        d.append(I())
        A.append(LI_())

    snuke = [False]*N
    ans = 0
    for i in A:
        for j in i:
            snuke[j] = True

    print(len([i for i in snuke if not i]))
        
if __name__ == '__main__':
    resolve()

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 range(d):
        s[a[j]-1] = 1

num = s.count(0)
print(num)

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

Victims = [True] * N

for _ in range(K):
    Snack = int(input())
    Snukes = list(map(int, input().split()))
    for snuke in Snukes:
        Victims[snuke - 1] = False

print(Victims.count(True))

Solution (Python):
N,K=map(int,input().split())
ha=set()
for i in range(K):
    d=int(input())
    a=set(map(int,input().split()))
    ha=ha|a
print(N-len(ha))

Solution (Python):

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

Solution (Python):
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N, K = input_number_list()
    ls = [0] * N

    for i in range(K):
        d = input_number()
        L = input_number_list()
        for l in L:
            ls[l - 1] = 1
    print(ls.count(0))


if __name__ == '__main__':
    main()

Solution (Python):




def main():
    
    pass

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

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

    print(cnt)
    main()

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

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

Solution (Python):
import math


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

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

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

    for a in A:
        for i in a:
            sunuke.discard(i)

    print(len(sunuke))





if __name__ == '__main__':
    main()

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

Solution (Python):


N,K = map(int,input().split())
n=[a for a in range(1,N+1)]
c=[]
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for j in A:
            if j in n and j not in c:
                c.append(j)


print(len(n)-len(c))

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

Solution (Python):
if __name__ == "__main__":
    n, k = map(int, input().split())
    buckets = [0 for x in range(n+1)]
    for i in range(k):
        d = input()
        a = [int(x) for x in input().split()]
        for item in a:
            buckets[item] += 1
    print(buckets.count(0) - 1)

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

Solution (Python):
N,K = map(int,input().split())
all_snuke = [0] * N
have_snuke = []
for i in range(K) :
    d = int(input())
    li = [i for i in input().split()]
    for snuke in li :
        if (snuke not in have_snuke) :
            have_snuke.append(snuke)
    
print(len(all_snuke) - len(have_snuke))

Solution (Python):
import numpy as np
import sys
import math
read = sys.stdin.readline

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

ans = [1] * n

for a in A:
    for j in a:
        ans[j-1] = 0

print(sum(ans))

Solution (Python):

MOD = 10 ** 9 + 7
RLIMIT = 1000
DEBUG = 1

def main():
    for _ in inputt(1):
        n, k = inputi()
        l = [0] * (n + 1)
        for _ in range(k):
            d, = inputi()
            for c in inputi():
                l[c] = 1
        debug(l)
        print(n - sum(l))







from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(RLIMIT)





BUFSIZE = 8192
class FastIO(io.IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = io.BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(io.IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
    if args:
        sys.stdout.write(str(args[0]))
        split = kwargs.pop("split", " ")
        for arg in args[1:]:
            sys.stdout.write(split)
            sys.stdout.write(str(arg))
    sys.stdout.write(kwargs.pop("end", "\n"))
def debug(*args, **kwargs):
    if DEBUG and not __debug__:
        print("debug", *args, **kwargs)
        sys.stdout.flush()
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip()
inputt = lambda t = 0: range(t) if t else range(int(input()))
inputs = lambda: input().split()
inputi = lambda k = int: map(k, inputs())
inputl = lambda t = 0, k = lambda: list(inputi()): [k() for _ in range(t)] if t else list(k())





def len(a):
    if isinstance(a, range):
        return -((a.start - a.stop) // a.step)
    return builtins.len(a)
def bisect_left(a, x, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    while lo < hi:
        mid = (lo + hi) // 2
        if key(a[mid]) < x: lo = mid + 1
        else: hi = mid
    return lo
def bisect_right(a, x, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    while lo < hi:
        mid = (lo + hi) // 2
        if x < key(a[mid]): hi = mid
        else: lo = mid + 1
    return lo
def insort_left(a, x, key = None, lo = 0, hi = None):
    lo = bisect_left(a, x, key, lo, hi)
    a.insert(lo, x)
def insort_right(a, x, key = None, lo = 0, hi = None):
    lo = bisect_right(a, x, key, lo, hi)
    a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right
def index(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    i = bisect_left(a, x, key, lo, hi)
    if lo <= i < hi and key(a[i]) == x: return a[i]
    if default != None: return default
    raise ValueError
def find_lt(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_left(a, x, key, lo, hi)
    if lo < i <= hi: return a[i - 1]
    if default != None: return default
    raise ValueError
def find_le(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_right(a, x, key, lo, hi)
    if lo < i <= hi: return a[i - 1]
    if default != None: return default
    raise ValueError
def find_gt(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_right(a, x, key, lo, hi)
    if lo <= i < hi: return a[i]
    if default != None: return default
    raise ValueError
def find_ge(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_left(a, x, key, lo, hi)
    if lo <= i < hi: return a[i]
    if default != None: return default
    raise ValueError






class Tree:
    def __init__(n):
        self._n = n
        self._conn = [[] for _ in range(n)]
        self._list = [0] * n
    def connect(a, b):
        pass





class Sieve:
    def __init__(self):
        self._n = 6
        self._list = [2, 3, 5, 7, 11, 13]
    def extend(self, n):
        if n <= self._list[-1]: return
        maxbase = int(n ** 0.5) + 1
        self.extend(maxbase)
        begin = self._list[-1] + 1
        newsieve = [i for i in range(begin, n + 1)]
        for p in self.primerange(2, maxbase):
            for i in range(-begin % p, len(newsieve), p):
                newsieve[i] = 0
        self._list.extend([x for x in newsieve if x])
    def extend_to_no(self, i):
        while len(self._list) < i: 
            self.extend(int(self._list[-1] * 1.5))
    def primerange(self, a, b):
        a = max(2, a)
        if a >= b: return
        self.extend(b)
        i = self.search(a)[1]
        maxi = len(self._list) + 1
        while i < maxi:
            p = self._list[i - 1]
            if p < b:
                yield p
                i += 1
            else: return
    def search(self, n):
        if n < 2: raise ValueError
        if n > self._list[-1]: self.extend(n)
        b = bisect(self._list, n)
        if self._list[b - 1] == n: return b, b
        else: return b, b + 1
    def __contains__(self, n):
        if n < 2: raise ValueError
        if not n % 2: return n == 2
        a, b = self.search(n)
        return a == b
    def __getitem__(self, n):
        if isinstance(n, slice):
            self.extend_to_no(n.stop + 1)
            return self._list[n.start: n.stop: n.step]
        else:
            self.extend_to_no(n + 1)
            return self._list[n]
sieve = Sieve()
def isprime(n):
    if n <= sieve._list[-1]:
        return n in sieve
    for i in sieve:
        if not n % i: return False
        if n < i * i: return True
prime = sieve.__getitem__
primerange = lambda a, b = 0: sieve.primerange(a, b) if b else sieve.primerange(2, a)
def factorint(n):
    factors = []
    for i in sieve:
        if n < i * i: break
        while not n % i:
            factors.append(i)
            n //= i
    if n != 1: factors.append(n)
    return factors
factordict = lambda n: Counter(factorint(n))





if __name__ == "__main__":
    main()

Solution (Python):
[N,K] = [int(s) for s in input().rstrip().split(' ')]
L = [0]*N
for i in range(K):
    d_i = int(input())
    A_i = [int(s) for s in input().rstrip().split(' ')]
    for a_i in A_i:
        L[a_i-1] += 1
print(L.count(0))

Solution (Python):
def resolve():
    N,K = map(int,input().split())
    children=[False for i in range(N)]
    for i in range(K):
        d= int(input())      
        for i in map(int,input().split()):
            children[i-1]=True
    
    ans = 0
    for i in children:
        if not i:
            ans +=1
    
    print(ans)

        

    


if __name__ == "__main__":
    resolve()

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

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

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

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

having = set()
for k in range(K):
    _ = input()
    As = list(map(lambda x: int(x), input().split(" ")))
    having |= set(As)

result = N - len(having)
print(result)

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

L = set(sum(A,[]))
print(N - len(L))

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

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

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

oks = [False] * n
for xs in arr:
    for x in xs:
        oks[x - 1] = True

ans = 0
for x in oks:
    if x == False:
        ans += 1

print(ans)

Solution (Python):


inp = input().split(' ')
N, K = int(inp[0]), int(inp[1])

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

for i in range(K):
    di = int(input())
    tmp = [int(t)-1 for t in input().split(' ')]
    for t in tmp:
        sunuke[t] = 0
print(sum(sunuke))

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


have=[]
for i in range(K):
	d=int(input())
	A=list(map(int,input().split()))
	for j in range(d):
		if A[j] not in have: have.append(A[j])

print(N-len(have))

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, K = MAP()

    l = [1 for _ in range(N)]
    for _ in range(K):
        d = INT()
        A = LIST()

        for a in A:
            l[a-1] = 0

    print(sum(l))


if __name__ == '__main__':
    main()

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

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

print(N-len(set(S)))

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

""" Input
S = input().rstrip()
N = int(input())
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""

N, K = map(int, input().split())
people = [0] * N

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

print(people.count(0))

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

Solution (Python):
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N, K = mapint_inp()

sunuke_set = set()

for _ in range(K):
    d = intinp()
    A = list(mapint_inp())
    for A_i in A:
        sunuke_set.add(A_i)

print(N - len(sunuke_set))

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 = [1 for _ in range(N)]
for i in range(K):
    for j in range(len(A[i])):
        S[A[i][j]-1] = 0

print(sum(S))

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

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

S = []
S = set(S)
for i in range(K):
    for j in range(data[2*i][0]):
        S.add(data[2*i+1][j])

print(N-len(S))

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

a_ls = [0] * n
for i in range(k):
    d = int(input())
    a = [int(i) for i in input().split()]
    for j in a:
        if a_ls[j-1] == 0:
            a_ls[j-1] = 1
print(n - sum(a_ls))