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
input = sys.stdin.readline

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

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

print(n-len(set(li)))

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

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

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

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

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

treat = 0

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

Solution (Python):
try:
    n,k=map(int, input().split())
    arr=[]
    for i in range(k):
        d=int(input())
        arr.extend(map(int,input().split()))
    check=set(arr)
    ans=n-len(check)
    print(ans)
except EOFError as e:
    pass

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

print(N-len(set(l)))

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

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

Solution (Python):
import numpy as np
n,k=map(int,input().split())
sunuke=np.zeros(n,dtype=int)
for i in range(k):
    number=input()
    data=list(map(int,input().split()))
    for j in data:
        sunuke[j-1]=1
print(np.count_nonzero(sunuke==0))

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

print(n - len(set(ans)))

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

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

	hasSnack += InputA

print(len(list(set(allSunuke) - set(hasSnack))))

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

Solution (Python):
n,k=[int(_) for _ in input().split()]
s=set()
for a in range(k):
    x=int(input())
    y=[int(_) for _ in input().split()]
    for b in y:
        s.add(b)
print(len(set(range(1,n+1))-s))

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




treat = [1]*n



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




  for j in a:
    treat[j-1] = 0



print(sum(treat))

Solution (Python):
import sys
input = sys.stdin.readline



def main():
    N, K = [int(i) for i in input().strip().split()]
    no_sweet_members = set(range(1, N+1))
    for i in range(K):
        d = int(input().strip())
        member = [int(i) for i in input().strip().split()]
        for m in member:
            if m in no_sweet_members:
                no_sweet_members.remove(m)

    return len(no_sweet_members)


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

Solution (Python):
import sys
input = sys.stdin.readline

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

items = []

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

print(N - len(set(items)))

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

sunukes = list()
for i in range(1,n+1):
    sunukes.append(i)

sunukes = set(sunukes)

for i in range(1,k+1):
    input()
    sunukes = sunukes - set(map(int,input().split()))

print(len(sunukes))

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


l = set()
d = [input().split() for _ in range(k*2)]
for i in range(len(d)):
	if i % 2 == 1:
		l = l | set(d[i])
print(n - len(l))

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

Solution (Python):
N,K = map(int,input().split())
Data = [0]*N
for k in range(K):
    _ = input()
    user = list(map(int,input().split()))
    for u in user:
        Data[u-1] += 1
ans = 0
for i in range(N):
    if Data[i] == 0:
        ans += 1
print(ans)

Solution (Python):
temp=input().split(' ')
N=int(temp[0])
K=int(temp[1])

flag=[1 for n in range(N)]

for k in range(K):
  d=int(input())
  A=input().split(' ')
  for a in A:
    flag[int(a)-1]=0

ans=sum(flag)
print(ans)

Solution (Python):



Inputs = []
Input = input().split()

N = Input[0]
N = int(N)
Person = []
for l in range(N):
    Person.append(l+1)

K = Input[1]
K = int(K)
K2 = K * 2
Inputs.append(Input)

for l in range(K2):
    Input = input().split()
    Inputs.append(Input)


for a in range(K):
    A = (a + 1)*2 
    L = Inputs[A - 1][0]
    L = int(L)
    for b in range(L):
        P = Inputs[A][b]
        P = int(P)
        if P in Person:
            Person.remove(P)


print(len(Person))

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

Solution (Python):
n,k=map(int,input().split())
N=[i+1 for i in range(n)]
for i in range(k):
    a=int(input())
    b=list(map(int,input().split()))
    for j in b:
        if N.count(j)>0:
            N.remove(j)
print(len(N))

Solution (Python):
N, K = [int(i) for i in input().split()]
A = [[] for _ in range(N)]
for i in range(K):
    a = int(input())
    b = input().split()
    for j in range(a):
        A[int(b[j])-1] = 1
j = 0
for i in range(len(A)):
    if A[i] != 1:
        j += 1
print(j)

Solution (Python):
import sys
from collections import deque
import numpy as np
import copy
def main():
    N, K = map(int, input().split())
    dp = np.zeros(N)
    count = 0 
    for i in range(K):
        d = int(input())
        A = [int(t) - 1 for t in input().split()]
        for u in range(d):
            dp[A[u]] += 1
    for i in range(N):
        if dp[i] == 0:
            count += 1
    print(count)


if __name__ == '__main__':
    main()

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




S = [1] * N 

for i in range(K):
    d = int(input())
    t = map(int, input().split())
    for i in t:
        
        S[i-1] = 0
print(sum(S))

Solution (Python):
n,k = [int(x) for x in input().split(' ')]
 
def solve(n, k):
    snukes = [None] * n
    victims = 0
    
    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[snukes_snacks[j] - 1] = snukes_snacks[j]
    
    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)
 
solve(n, k)

Solution (Python):
def main():
    n, k = map(int, input().split())
    people = [True for i in range(n)]
    for i in range(k):
        d = int(input())
        for j in map(lambda x: int(x)-1, input().split()):
            people[j] = False
    print(sum(people))
    return


if __name__ == "__main__":
    main()

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

Solution (Python):
n, k = [int(i) for i in input().strip().split()]
result = {}
for _ in range(k):
    input()
    for i in input().strip().split():
        result[i] = 1
print(n - len(result))

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

for _ in range(k) :
    a = int(input())
    b = list(map(int,input().split()))
    for i in b :
        sunukes[i-1] += 1
        
count = 0
for j in sunukes :
    if j == 0 :
        count += 1
print(count)

Solution (Python):
def solve(string):
    n, k, *da = map(int, string.split())
    t, i = [True] * n, 0
    for _ in range(k):
        d = da[i]
        for j in da[i + 1:i + 1 + d]:
            t[j - 1] = False
        i += d + 1
    return str(sum(t))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

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

Solution (Python):



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

S = set()
for _ in range(k):
  _ = input()
  S |= set(map(int, input().split()))

print(n - len(S))

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

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

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

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

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

for i in range(K):
    d = int(input())
    dl = map(int, input().split())
    res =res.difference(dl)

print(len(res))

Solution (Python):
n, k = map(int, input().split())
victim = [True] * n
for _ in range(k):
    input()
    for a in map(int, input().split()):
        victim[a - 1] = False
print(sum(victim))

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

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


print(sum(lst))

Solution (Python):
if __name__ == '__main__':
    nk = input()
    nk = nk.split()
    n = int(nk[0])
    k = int(nk[1])

    d = []
    A = []

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

    s = set()
    for i in range(len(A)):
        for j in range(len(A[i])):
            s.add(A[i][j])

    ans = n - len(s)
    print(ans)

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

li = []
for i in range(k*2):
    d_or_k = list(map(int, input().split()))
    if i % 2 != 0:
        li.extend(d_or_k)

li = list(set(li))
print(n - len(li))

Solution (Python):
import itertools

inp2intlist = lambda inp:list(map(int,inp))

N,K = list(map(int, input().split(" ")))
A = list(itertools.chain.from_iterable([inp2intlist(input().split())  for i in range(K) if input().split()]))

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

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

for _ in range(K):
    _ = int(input())
    treat = list(map(int, input().split()))
    for a in treat:
        a -= 1
        have_treat[a] = False
print(sum(have_treat))

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

snukes = [1]*N

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

    for i in A:
        snukes[i-1] = 0

print(sum(snukes))

Solution (Python):
n, k = map(int, input().split())
d_list, a_list = [], []
ans_list = [1] * n

for i in range(k):
    d_list.append(int(input()))
    a_list = list(map(int, input().split()))
    for j in a_list:
        if ans_list[j-1] == 1:
            ans_list[j-1] = 0
print(sum(ans_list))

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

for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    
    for Ai in A:
        flag[Ai-1] = True

print(flag.count(False))

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

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

print(sum(ans_list))

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

cnt = {}
for i, Ai in enumerate(A):
    for j, Aij in enumerate(Ai):
        key = str(Aij)
        cnt.setdefault(key, 0)
        cnt[key] += 1

ans = 0
for i in range(1, N + 1):
    key = str(i)
    cnt.setdefault(key, 0)
    ans += int(cnt[key] == 0)

print(ans)

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

a = list(set(a))
check = [1] * n
for i in a:
  check[i-1] = 0
print(sum(check))

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

Solution (Python):
n,k = tuple(map(int,input().split()))
ans = [1]*n
for i in range(k):
  d = int(input())
  a_i = tuple(map(int,input().split()))
  for a_ij in a_i:
    ans[a_ij-1] = 0
    
print(sum(ans))

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

    
resolve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)


def input():
    return sys.stdin.readline()[:-1]


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

print(A.count(0))

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

print(sum(snuke))

Solution (Python):
import sys
input = sys.stdin.readline

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

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

print(dp.count(0))

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

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

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

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

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

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

for i in range(K):
    for item in A[i]:
        if item in sunuke:
            continue
        sunuke.append(item)

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

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


sunuke=[False]*n
for i in range(len(a)):
    for j in range(len(a[i])):
        sunuke[a[i][j]-1] = True
print(sunuke.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())))
for i in range(1,len(a)):
    a[0].extend(a[i])
ans=set(a[0])
count=0
for an in ans:
    for i in range(1,n+1):
        if an == i:
            count+=1
print(n-count)

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

check = [0] * N

for i in range(K):
    d_i = int(input())
    A_i = map(int, input().split())
    for j in A_i:
        check[j-1] = 1

print(sum(1 for x in check if x == 0))

Solution (Python):
N, K = [int(x) for x in input().split()]
d = []
Snuke = [0] * N
for k in range(K):
    d.append(input())
    A = [int(a) for a in input().split()]
    for a in A:
        Snuke[a - 1] += 1
count = 0
for i in Snuke:
    if i == 0:
        count += 1
print(count)

Solution (Python):

import numpy as np
N, K = map(int,input().split())
A = np.array([0]*N)
for i in range(K):
    d = input()
    have = list(map(int,input().split()))
    for a in have:
        A[a-1] += 1
print(len(A[A==0]))

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

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

print(n - len(a))

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

candy = [0] * N

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

count = 0
for i in candy:
    if i == 0:
        count += 1

print(count)

Solution (Python):


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

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

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

d=[]
sunu = set()

for i in range(k):
    d.append(int(input()))
    dummy = [int(e) for e in input().split()]
    dummy = set(dummy)
    sunu = sunu.union(dummy)
print(n-len(sunu))

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

Solution (Python):
N, K = map(int, input().split())
S = set()
for _ in range(K):
    d = int(input())
    S = S.union({int(x) for x in input().split()})
print(N-len(S))

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

ans = [False] * N
for i in range(K):
    for j in range(d[i]):
        ans[A[i][j] - 1] = True

res = 0
for i in range(N):
    if not ans[i]:
        res += 1;

print(res)

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

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

Solution (Python):
import sys
input = sys.stdin.readline

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

visited = [False] * N
for i in range(K):
    for j in range(d[i]):
        visited[A[i][j]-1] = True

print(visited.count(False))

Solution (Python):
n,k =map(int,input().split())
result=list(range(1,n+1))
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in range(d):
        if a[j] in result:
            b=result.pop(result.index(a[j]))
print(len(result))

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

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

A = list(set(A))


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

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

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

bu = [0 for i in range(n)]
for a_ in a:
    for _ in a_:
        bu[_-1]+=1

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

Solution (Python):
n,k = map(int,input().split())
lis = [0 for i in range(n)]
for turn in range(k):
  nn = int(input())
  li = list(map(int,input().split()))
  for num in li:
    lis[num-1] = 1
print(lis.count(0))

Solution (Python):
from collections import Counter

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

l = []
counter = 0

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

for i in range(1,N+1):
    if Counter(l)[i]==0:
        counter += 1
    else:
        continue

print(counter)

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

result = [0]*N
ans = 0

for i in range(K):
  p = input()
  tmp = list(map(int, input().split()))
  
  
  for j in tmp:
    result[j-1] = 1
  
for i in result:
  if i == 0:
    ans += 1

print(ans)

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

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

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

for k in range(K):
    sunuke |= set(A[k])

result = len(all_sunuke - sunuke)

print(result)

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

print(human.count(-1))

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

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


ans = 0
count = [0] * (N+1)
for i in range(K):
    for j in range(d[i]):
        
        count[A[i][j]]=1 


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

print(ans)

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

for i in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  for j in a:
    s.add(j)
print(n-len(s))

Solution (Python):

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

for i in range(k):
    for j in range(d[i]):
        
        people[a[i][j]-1] += 1
ans = 0

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

Solution (Python):
n, k = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(k * 2)]
di = {}
for i in d[1:: 2]:
    for j in i:
        if j not in di:
            di[j] = None
        else:
            pass
print(n - len(di))

Solution (Python):
n,k=map(int,input().split(' '))
a=[0 for i in range(n+1)]
for z in range(k):
  x=int(input())
  temp=map(int,input().split(' '))
  for i in temp:
    a[i]+=1
c=0
for i in range(1,n+1):
  if(a[i]==0):
    c+=1
print(c)

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

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

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

print(cnt)

Solution (Python):
N,K=map(int,input().split())
l = []
for k in range(K):
    a = int(input())
    lis=list(map(int,input().split()))
    l.extend(lis)
c=0
for j in range(N):
    if not j+1 in l:
        c+=1
print(c)

Solution (Python):



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

    n, k = map(int, input().split())
    count = [[] for _ in range(n)]

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

        for ai in a:
            count[ai - 1].append(i)

    ans = 0

    for c in count:
        if len(c) == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())
 
snukes = [0] * N
for i in range(K):
  d_i = int(input()) 
  a_i = map(int, input().split())
  for a in a_i:
    snukes[a-1] += 1
 
counter = 0
for i in range(N):
  if snukes[i] == 0:
    counter += 1
 
print(counter)

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

count = 0
for i in range(N):
    if all([x == 0 for x in lis[i]]) == True:
        count += 1

print(count)

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

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

print(sum(cur))

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

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

print(N - len(x))

Solution (Python):
def main() :
    N, K    = list(map(int, input().split()))
    sunukes = []
    for itr in range(N) :
        
        sunukes.append(False)
    itr = 0

    for itr in range(K) :
        d = int(input())
        A = list(map(int, input().split()))
        for inner_itr in range(d) :
            sunukes[A[inner_itr] - 1] = True
        A = None
    
    count = 0
    for itr in range(N) :
        if sunukes[itr] == False :
            count+=1
    
    print(count)
    
if __name__ == "__main__":
    main()

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

O = [1] * N

for i in range(K):
    d = int(input())

    for j in list(map(int, input().split())):
        O[j-1] = 0

print(sum(O))

Solution (Python):
N, K = [int(i) for i in input().split()]
result = []
for i in range(K):
    d = int(input())
    x = [int(i) for i in input().split()]
    for i in x:
        if i not in result:
            result.append(i)

print(N - len(result))

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

x = set([i+1 for i in range(N)])
for _ in range(K):
    d = int(input())
    A = map(int, input().split())
    for a in A:
        if a in x:
            x.remove(a)

print(len(x))

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

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

ans={0}
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    
    for j in range(d):
        s=A[j]
        ans.add(s)

print(N-len(ans)+1)

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

sunuke = [1] * N

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

print(sum(sunuke))

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

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

sunuke = [1] * N

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

Solution (Python):
N,K = map(int, input().split(' '))
a=list(range(1,N+1))
for i in range(K):
  count=int(input())
  b=[int(x.strip()) for x in input().split(' ')]
  for j in range(count):
    if b[j] in a:
      a.remove(b[j])
print(len(a))

Solution (Python):
N,K = map(int, input().split(' '))
a=list(range(1,N+1))
for i in range(K):
  count=int(input())
  b=input().split(' ')
  for j in range(count):
    if int(b[j]) in a:
      a.remove(int(b[j]))
print(len(a))

Solution (Python):
import numpy as np

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

d = []
ai = []
count = 0

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

for i in range(N):
    if i + 1 not in ai:
        count += 1

print(count)

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

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

B = [m + 1 for m in range(N)]
print(len(list(set(B) - set(A))))

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

list = [0 for i in range(N)]

for i in range(K):
    for j in range(d[i]):
        list[A[i][j]-1] += 1

print(list.count(0))

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

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

Solution (Python):

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

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

for j in range(k):
  d.append(int(input()))
  A.append(list(map(int,input().split())))
  
  
for i in A:
  for j in i:
    if j in a:
      a.remove(j)
      
      
print(len(a)-1)

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

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

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

Solution (Python):


def main():
    sunukes, eating = map( int, input().split() )
    counts = [ 0 for _ in range(sunukes) ]

    for _ in range(eating):
        has = int( input() )
        having = list( map( int, input().split() ) )

        for i in range( len(having) ):
            counts[ having[i] - 1 ] += 1
    
    print(counts.count(0))


if __name__ == "__main__":
    main()