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):
n, k = map(int,input().split())

l = [list(map(int,input().split())) for i in range(k*2)]
a=[]
for i in range(1,k+1):
    a.append(l[2*i-1])
b = []
for j in a :
    for item in j :
        b.append(item)

ans = 0
for k in range(1,n+1):
    if b.count(k) == 0 :
        ans += 1

print(ans)

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

counter = 0
for j in range(n):
    if j+1 not in li:
        counter += 1

print(counter)

Solution (Python):
import sys
readline = sys.stdin.readline
N, K = map(int, readline().split())
table = [0]*N
for _ in range(K):
    d = int(readline())
    for a in list(map(int, readline().split())):
        table[a-1] += 1

print(table.count(0))

Solution (Python):
N,K = map(int,input().split())
D = list()
Snuke = {x for x in range(1,N+1)}

for i in range(K):
    d = int(input())
    j = list(map(int,input().split()))
    D.append(j)    
    
for i in D:
    Snuke = Snuke.difference(set(i))


print(len(Snuke))

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

result = [0] * N

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

print(cnt)

Solution (Python):
import itertools
N1, K1 = map(int, input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))
    except:
        break;
N = len(listA)

listB = []
for n in range(0,N):
  if n%2==1:
    listB.append(listA[n])

listC = list(itertools.chain.from_iterable(listB))

print(N1 - len(list(set(listC))))

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

S = [False] * N

for i in range (K):
	for j in A[i]:
		S[j-1] = True

print (S.count(False))

Solution (Python):
N, M = map(int, input().split())
res = []
for _ in range(M):
    d = int(input())
    A = list(map(int, input().split()))
    for i in A:
        res.append(i)
ans = set(res)
print(N-len(ans))

Solution (Python):
from sys import stdin
import re
import bisect
import numpy as np

N, K = map(int, stdin.readline().rstrip().split())
frag = np.zeros((K,N), dtype=bool)
for i in range(K):
    _ = stdin.readline()
    line = map(int, stdin.readline().rstrip().split())
    for j in line:
        j -= 1
        frag[i][j] = True
        
count = int(0)
frag = frag.T
for i in range(N):
    if np.count_nonzero(frag[i] == 1) == 0:
        count += 1
print(count)

Solution (Python):

n, k = map(int, input().split())
query = [list(map(int, input().split())) for _ in range(0, k*2)]
a = query[1::2]
sunuke = [0] * n

for a in query[1::2]:
    for s in a:
        sunuke[s-1] += 1
print(sunuke.count(0))

Solution (Python):
N,K=input().split()
N=int(N)
K=int(K)
List = [[int(j) for j in input().split()] for i in range(2*K)]

A=[0]*N

for i in range(K):

  for j in range(0,List[i*2][0]):
    A[List[1+i*2][j]-1]+=1
print(A.count(0))

Solution (Python):
N,K=map(int,input().split())
a = [[0]*N]*K
a = [[0 for n in range(N)] for k in range(K)]

for k in range(K):
    d=int(input())
    have_k=map(int,input().split())
    for h in have_k:
        a[k][h-1]=1

an=[0]*N
for k in range(K):
  for n in range(N):
    an[n] = an[n]+a[k][n]

result=0
for i in an:
  if i == 0:
    result+=1

print(result)

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

while K>0:
    dk=int(input())
    listk=input().split()
    listX.extend(listk)
    K=K-1

listX=[int(s) for s in listX]
listN=list(range(N))
listN.append(N)
listN.remove(0)
listZ=list(set(listN)-set(listX))

L=str(len(listZ))
print(L)

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

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

A = set(A)

print(N-len(A))

Solution (Python):
n, k = [int(x) for x in input().split()]
using = { x:0 for x in range(1, n + 1)}
for _ in range(k):
    nbs = int(input())
    users = [int(x) for x in input().split()]
    for use in users:
        using[use] += 1
    victims = 0

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

Solution (Python):
n, k = list(map(int, input().split()))
D=[]
A=[]
flg = 0
counta = 0
for i in range(k):
    D.append(int(input()))
    A.append(list(map(int, input().split())))

for i in range(n):
    flg = 1
    for j in A:
        if j.count(i+1) == 1:
            flg=0
    if flg==1:
        counta+=1
print(counta)

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

for _ in range(K):
    d = input()
    s_list = input().split()

    for s_id in s_list:
        if s_id not in sunuke_dict:
            sunuke_dict[s_id] = [d]
        else:
            sunuke_dict[s_id].append(d)

print(N - len(sunuke_dict))

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n, k = rli()
    ans = [0 for _ in range(n)]
    for i in range(k):
        d = ri()
        la = rli()
        for a in la:
            ans[a-1] += 1
    print(sum(1 for a in ans if a == 0))


if __name__ == '__main__':
    main()

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

Solution (Python):
N, K = map(int, input().split())
Aall = set(list(range(1, N+1)))
A = []
for i in range(N*2):
  try: 
    if i % 2 != 0:
      a = list(map(int, input().split()))
      A.extend(a)
    else:
      d = list(map(int, input().split()))
  except EOFError:
    d = 1
print(len(Aall-set(A)))

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

n = list(range(1,N+1))

for i in range(K):
    for j in range(d[i]):
        for k in range(len(n)):
            if n[k] == a[i][j]:
                n[k] = 0

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

print(ans)

Solution (Python):
l  = []

n, k = map(int, input().split())
for _ in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for i in range(1, n+1):
        for j in A:
            if i == j:
                break
        else:
            l.append(i)

import collections
d = collections.Counter(l)
l2 = []
for u, v in d.items():
    if v == k:
        l2.append(u) 

print(len(l2))

Solution (Python):
n,k=map(int,input().split())
s=[0]*n
count=0
for i in range(k*2):
  if i%2==0:
    d=int(input())
  else:
    *a,=map(int,input().split())
    for j in range(d):
      tmp=a[j]
      s[tmp-1]+=1
for i in range(n):
  if s[i]==0:
    count+=1
print(count)

Solution (Python):

import sys
import itertools
 
 
N, K = map(int, input().split())

nums = [ ]
for _ in range(K):
    _ =  int(input())
    nums.extend([int(x.strip()) for x in input().split(' ') ])

print(N - len(set(nums)))

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

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

n = [0 for _ in range(N)]
for i in range(K):
  d = int(input())
  D = list(map(int,input().split()))
  for j in range(d):
    n[D[j]-1] += 1

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

Solution (Python):
a,b = map(int, input().split())
 
p = [1]*a
 
while True:
  try:
    input()
  except EOFError:
    break
  c = input().split()
  for d in c:
    p[int(d)-1]=0
 
print(sum(p))

Solution (Python):
import itertools
a,b=map(int,input().split())
c=[]
for i in range(1,b*2+1):
    c.append(list(map(int,input().split())))
n=c[1::2]
n=list(itertools.chain.from_iterable(n))
print(a-len(set(n)))

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

funuke_list = []
for j in a:
    funuke_list += j

ans = n - len(set(funuke_list))

print(ans)

Solution (Python):

n,k = map(int,input().split())
d = []
visited = [0]*n
for j in range(k):
    d.append(int(input()))
    jk= [int(i) for i in input().split()]
    for jj in jk:
        visited[jj-1] = 1
print(n-sum(visited))

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

Solution (Python):


import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	n, k = map(int, sys.stdin.readline().split())
	have = [0]*n
	for i in range(k):
		di = int(sys.stdin.readline())
		a = list(map(int, sys.stdin.readline().split()))
		for i in range(di):
			have[a[i]-1] += 1
	cnt = 0
	for i in range(n):
		if have[i] == 0:
			cnt += 1
	print(cnt)


main()

Solution (Python):
N, K = map(int, input().split())
import itertools
A=[]
B=[]
i=0
m=0
for _ in range(2*K):
    a = [int(x) for x in input().split()]
    if i%2!=0:
        A.append(a)
    i=i+1

B=(list(itertools.chain.from_iterable(A)))
print(N-len(set(B)))

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

people_dic = []
have_dic = []
temp_min = []
min_people = []
min_num = 0


for all in range(1, n+1):
    people_dic.append(all)

for cnt in range(k):
    d = int(input())
    have_dic.append(list(map(int, input().split())))

for comparison in range(k):
    temp_min.append((list(set(people_dic) - set(have_dic[comparison]))))

min_people = temp_min[0]
for duplication in range(k):
    min_people = list(set(min_people) & set(temp_min[duplication]))

min_num = len(min_people)

print(min_num)

Solution (Python):
from collections import defaultdict
di = defaultdict(int)
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(N):
    di[i + 1] = 0

for i in A:
    for j in i:
        di[j] += 1

count = 0
for i, k in di.items():
    if (k == 0):
        count += 1

print(count)

Solution (Python):
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
n_list = list(range(1, n+1))
input_map = {}
for i in range(k):
    d = int(input())
    d_list = [ int(ai) for ai in input().split()]
    for h in d_list:
        if n_list.count(h) == 1:
            n_list.remove(h)

print(len(n_list))

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

Solution (Python):
import itertools
N, K = map(int, input().split())
snack = [list(map(int, input().split())) for i in range(2*K)]
answer = [int(i) for i in range(1, N+1)]

for i in snack[1::2]:
  for j in i:
    try:
      answer.remove(j)
    except:
      continue
print(len(answer))

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

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

print(sum(Sunuke))

Solution (Python):
N, K = map(int, input().split())
List = []
void = 0
cnt = 0
for i in range(int(K)):
    void = int(input())
    List.append(list(map(int, input().split())))

arr = [int(x) for y in List for x in y]

for k in range(1,N+1):
    if k in arr:
        pass
    else:
        cnt += 1

print(cnt)

Solution (Python):
import numpy as np
n,k=map(int,input().split())
dlist = []
lists = []
x=np.zeros(n,int)
for i in range(k):
    dlist=input()
    lists.append(input().split())
for list in lists:
  l=len(list)
  for j in range(l):
    index=list[j]
    x[int(index)-1]=1
count = 0
for l in range(n):
  if x[l]==0:
    count+=1
print(count)

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 j in a:
        l[j-1]+=1

print(l.count(0))

Solution (Python):


s = input().split();
n = int(s[0])
k = int(s[1])

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

print(ans)

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

Solution (Python):
n,k = map(int,input().split())
o = 0
g = []
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        g.append(a[j])
g.sort()
for i in range(len(g)-1):
    if g[i] == g[i+1]:
        o += 1
print(n-len(g)+o)

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

k = 0

b = sum(a, [])
    
for i in range(n):
    if i+1 not in b:
        k = k + 1

print(k)

Solution (Python):
N, K = map(int,input().split())
l=list(range(1,N+1))
for i in range(K):
  d=int(input())
  s = input().split()
  for j in range(d):
    l[int(s[j])-1]=0
num=0
for i in range(N):
  if l[i]!=0:
    num=num+1
print(num)

Solution (Python):
N,K = map(int, input().split())
d = []
n = []
for k in range(K):
    d.append(input())
    n.append(input().split())
def flatten(nested_list):
    return [e for inner_list in nested_list for e in inner_list]
nfu = set(flatten(n))
print(N - len(nfu))

Solution (Python):
import collections
N,K = map(int,input().split())
s = []
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for j in range(d):
        s.append(A[j])
c = collections.Counter(s)
print(N-len(c))

Solution (Python):
import numpy as np

n, k = map(int, input().split())
List = [list(map(int, input().split())) for i in range(2*k)]

ans=np.zeros(n)
n=np.array(List[1])

for i in range(1,2*k,2):
  for j in List[i]:
    ans[j-1]=ans[j-1]+1

print(np.count_nonzero(ans==0))

Solution (Python):
import numpy as np

N, K = map(int, input().split())
A = []
for i in range(K):
    d = int(input())
    temp = list(map(int, input().split()))
    A = A + temp
hito = np.ones(N)
for i in range(len(A)):
    hito[A[i]-1] = 0
print(int(np.sum(hito)))

Solution (Python):
n,k = [int(s) for s in input().split()]
freq = [0]*(n+1)
for i in range(k):
    d = int(input())
    arr = [int(s) for s in input().split()]
    for j in arr:
        freq[j]+=1
c = 0
for i in range(1,n+1):
    if  freq[i] == 0:
        c+=1
print(c)

Solution (Python):
n,k = map(int,input().split())
d = [0]*k
A = [[0]*n]*k
l = set()
for i in range(k):
	d[i] = int(input())
	A[i] = list(map(int,input().split()))
for i in range(k):
	l = l.union(A[i])
if set(range(1,n+1)) == l:
	print(0)
else:
	print(len(set(range(1,n+1))-l))

Solution (Python):
N, K = map(int, input().split())
P =[]
for i in range(K):
    d = int(input())
    e = input().split()
    P.append(e)

Q = []
for j in range(len(P)):
    for k in range(N):
        if str(k+1) in P[j]:
            if str(k+1) not in Q:
                Q.append(str(k+1)) 

print(N-len(Q))

Solution (Python):








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

    sunuke = [True for _ in range(N)]

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

        for s in ds:
            sunuke[s-1] = False

    print(sum(sunuke))


if __name__ == "__main__":
    main()

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

check = [1]*N

for p in range(0,M):
	d = int(input())
	k = list(map(int,input().split()))
	for i in range (0, len(k)):
		check[k[i]-1]=0

print(sum(check))

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

s = set()
for i in range(K):
    for d in range(D[i]):
        s.add(A[i][d])
ans = N - len(s)
print(ans)

Solution (Python):
num= map(int, input().split())
A=list(num)
B=[]
for i in range(A[1]):
    snake=int(input())
    S= map(int, input().split())
    for n in S:
        B.append(n)
D=0
for x in range(1,A[0]+1):
    if x not in B:
        D =D+1
print(D)

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

Solution (Python):
import itertools
N,K = map(int, input().split())
c = []
for i in range(K):
	a = int(input())
	b=list(map(int,input().split()))
	c.append(b)
f = list(itertools.chain.from_iterable(c))
d = []
for i in range(1,N+1):
	e =  i in f
	if e  == False:
		d.append(i)
length = len(d)
print(length)

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

print(N - len(set(lis)))

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

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

for i in range(K):
    d = 0
    d = int(input())
    list_a = input().split()
    for i in range(len(list_a)):
        list_b.append(int(list_a[i]))
    list_a = []

a = set(list_b)
ans = N - len(a)
print(ans)

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

for i in range(K):
    d = int(input())
    data = [int(i) for i in input().split()]
    for j in data:
        J = j -1
        lst[J].append(d)

print(lst.count([]))

Solution (Python):
N, M = list(map(int, input().split()))
result = set([i for i in range(1, N+1)])
s = set([])
for i in range(M):
  d = int(input())
  s |= set(map(int, input().split()))
print(len(result-s))

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

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

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

for a in A:
  for k in range(1, N+1):
    if k in a:
      ari.append(k)


print(N-len(set(ari)))

Solution (Python):
N,K = map(int,input().split())
D = list()
Snuke = {x for x in range(1,N+1)}

for i in range(K):
    d = int(input())
    j = list(map(int,input().split()))
    D.append(j)    
    
for i in D:
    Snuke = Snuke.difference(set(i))


print(len(Snuke))

Solution (Python):
def inputlist():
    return [int(i) for i in input().split()]


def main():
    N, K = inputlist()
    aryNum = [0] * N

    aryInput = []
    for i in range(K):
        intNumType = int(input())
        aryInput = inputlist()
        for j in range(len(aryInput)):
            aryNum[aryInput[j] - 1] += 1

    sum = 0
    for i in range(N):
        if aryNum[i] == 0:
            sum += 1

    print(sum)


if __name__ == '__main__':
    main()

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

for i in range(1, N + 1):
    lists.append(int(i))

for _ in range(K):
    d = int(input())
    A = input().split()
    for p in range(len(A)):
        res.append(int(A[p]))

res_l = set(lists)
res_s = set(res)
result = res_l - res_s

li = list(result)
cnt = len(li)
print(cnt)

Solution (Python):

import numpy as np

hairetsu = input().split(' ')
sunuke = int(hairetsu[0])
okashi = int(hairetsu[1])
books = [[0]*sunuke]*okashi

for i in range(0, okashi):
  kaisu = int(input())
  whohas = list(map(int, input().split(' ')))
  for j in range(0, kaisu):
    k = int(whohas[j])-1
    books[i][k] = 1


result = np.sum(books,axis=0)
a = np.count_nonzero(result)
print(sunuke - a)

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

for i in range(N):
    sunuke.append(0)

for j in range(K):
    
    d = int(input())
    numberL = input().split()
    numberI = []
    
    for l in range(len(numberL)):
        numberI.append(int(numberL[l]))
    
    for m in range(len(numberI)):
        sunuke[numberI[m]-1] = sunuke[numberI[m]-1] + 1   
       

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

Solution (Python):
import numpy as np

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


snk = range( n )
snk = list( snk )
snk = [ snki + 1 for snki in snk ]


for i in range( k ):
    di = int( input() )
    ai = input().split()
    ai = [ int( aix ) for aix in ai ]


    for aij in ai:
        if any( si == aij for si in snk ):
            snk.remove( aij )
            





print( len( snk ) )

Solution (Python):
n,k=(int(x) for x in input().split())
ii=[]
for i in range(k):
    d=int(input())
    ad=[int(x) for x in input().split()]
    for j in ad:
        if j not in ii:
            ii.append(j)

print(n-len(ii))

Solution (Python):
import itertools

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

a = [ flatten for inner in a for flatten in inner ]

for j in range(n):
   if a.count(j+1)==0:
       ans +=1

print(ans)

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

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

for k in range(N):
    if kashi[k] == 0:
        cnt += 1

print(cnt)

Solution (Python):
n, k = map(int, input().split())
s = set(range(1, n + 1))
for d in range(k):
    snack = int(input())
    aa = map(int, input().split())
    for a in aa:
        if a in s:
            s.remove(a)

print(len(s))

Solution (Python):
n, k = map(int, input().split())
ns = []
ans =0
for i in range(k):
    p = int(input())
    s = str(input())
    for i in list(s.split()):
        ns.append(int(i))
for i in range(1,n+1):
    if( i not in ns):
        ans+= 1
print(ans)

Solution (Python):
N , K = map(int,input().split())
dA = [list(map(int,input().split()))for k in range(2*K)]

L = list(sum(dA[1::2],[]))
print(N-len(set(L)))

Solution (Python):
N,K=map(int,input().split())
who_have=[]
while(K!=0):
    k=int(input())
    someone_have=list(map(int,input().split()))
    if(len(someone_have)!=0):
        for i in someone_have:
            if(i in range(1,N+1)):
                who_have.append(i)
    K-=1
print(N-len(set(who_have)))

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

klist =[0]*k

for i in range(0,k):
    a = int(input())
    if a ==1:
        temp = int(input())
        klist[i] = [temp]
    else:
      	tlist= list(map(int, input().split())) 
      	klist[i]=tlist


unil = set(sum(klist,[]))
treat =  len(set(unil))
res = n - treat
print(res)

Solution (Python):
N,K=list(map(int,input().split()))
h=[]
for k in range(K):
    d_i=int(input())
    a=list(map(int,input().split()))
    for i in range(d_i):
        h.append(a[i])
h2=set(h)
ans=N-len(h2)
print(ans)

Solution (Python):
l = list(map(int, input().split()))
d = []
li = []
for i in range(l[1]):
    d += [int(input())]
    li += list(map(int, input().split()))
len_ = len(set(li))
result = l[0] - len_
print(result)

Solution (Python):
import numpy as np
N,K=map(int, input().split())
D = np.zeros((K, N))
for i in range(K):
    d=int(input())
    A=np.array(list(map(int, input().split())))
    for j in range(len(A)):
        D[i][A[j]-1] = 1
ans = D.sum(axis=0)
print(sum(ans == 0))

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

t = a[1::2]

ans = [0]*n
count = 0

for i in t:
    for j in i:
        ans[j-1] += 1

print(ans.count(0))

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

have = []
result = 0

for i in range(N):
    have.append([1]*K)


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

    for a in A:
        have[a-1][i-1] = 0

        
for j in have:
    if j == [1]*K:
        result += 1

print(result)

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



a_list=[]
for i in range(1,n+1):
    a_list.append(i)

a=a+a_list
a = [x for x in set(a) if a.count(x) == 1]
print(len(a))

Solution (Python):
snukes, kinds = map(int, input().split())
d = []
snacks = []
for x in range(kinds):
    d.append(int(input()))
    snacks  += ([int(x) for x in input().split()])

print(snukes - len(set(snacks)))

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


t = []
for i in range(n+1):
    t += [i]
t = set(t)
s = set()
for j in range(k):
    di = int(input())
    s.update(map(int,input().split()))
t = t-s-{0}
print(len(t))

Solution (Python):
N, K = list(map(int, input().split()))
d = []
A = []
B = set()
for i in range(K):
    _d = int(input())
    _A = list(map(int, input().split()))
    d.append(_d)
    A.append(_A)
    _B = set(_A)
    B = B | _B
print(N - len(B))

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

Solution (Python):
from itertools import chain

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

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

A=sum(A,[])

print(n-len(set(A)))

Solution (Python):
n, k = map(int, input().split())
D = [0] * k
A = [0] * k
for i in range(k):
    D[i] = int(input())
    Atemp = [0] * D[i]
    Atemp = list(map(int, input().split()))
    A[i] = Atemp
    
    
    
AA = []
for elem in range(k):
    AA += A[elem]


AA = set(AA)









print(n - len(AA))

Solution (Python):


N, K = map(int, input().split())
ls = []
for _ in range(K):
    d = int(input())
    A = [int(a) for a in input().split()]
    ls += A

print(N - len(set(ls)))

Solution (Python):

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

A = list(range(1, N+1))
d = []
B = []
c = []
for i in range(K):
    tmp = int(input())
    d.append(tmp)
    a = list(map(int, input().split()))
    
    B.append(a)
    c = list(set(A) & set(a))
    for j in range(len(c)):
        A.remove(c[j])

print(len(A))

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

Solution (Python):

import itertools

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

for k in range(1,N+1):
    if A.count(k) == 0:
        count+=1
print(count)

Solution (Python):
n,k=map(int,input().split())
list_a=[]
list_b=[]
for _ in range(k):
    if int(input())==1:
        list_b.append(int(input()))
    else:
        list_b+=list(map(int,input().split()))
print(n-len(set(list_b)))

Solution (Python):
def main():
    n, k = map(int, input().strip().split())
    d = []
    a = []

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

    flg = [False] * n

    for i in range(k):
        for j in range(d[i]):
            flg[a[i][j]-1] = True

    print(flg.count(False))

main()

Solution (Python):
n,k = map(int, input().split())
s = [ input() for i in range(k*2) ]
nl = [i for i in range(1,n+1)]
t = []
for i in range(1,k*2,2):
    l = []
    l = s[i].split()
    for j in range(len(l)):
        t.append(int(l[j]))
l = list(set(t))
for i in range(len(l)):
    nl.remove(l[i])
print(len(nl))

Solution (Python):
import sys

if __name__ == "__main__":
    line1 = sys.stdin.readline().strip()
    param1 = line1.split(" ")
    n = int(param1[0])
    k = int(param1[1])

    d = []
    A = set()

    for i in range(k):
        d_i = int(sys.stdin.readline().strip())
        A_i = [int(a) for a in sys.stdin.readline().strip().split(" ")]

        for a_i in A_i:
            A.add(a_i)
    
    print(len(set([i+1 for i in range(n)]) - A))

Solution (Python):
N,K = input().split()
n = int(N)
k = int(K)
list = [input() for i in range(2,2*k+2)]

n_list=[]
for x in range(k):
  n_list=n_list+list[2*x+1].split()
  
n_list.sort()

s=1
for y in range(len(n_list)-1):
  if n_list[y]==n_list[y+1]:
    s=s
  else:
    s=s+1
print(n-s)

Solution (Python):
import itertools
N,K = map(int,input().split())
h =2*K
d = [input().split() for l in range(h)]
z=[]
t=[]
for a in range(h+1):
  if a%2==1:
    z.append(d[a])
s=list(itertools.chain.from_iterable(z))
o=set(s)

print(N-len(o))

Solution (Python):
def getN():
    return int(input())

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


def main():

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

    slist = [0] * N

    for i in range(K):
        d = getN()
        A = getIntList()
        for j in range(d):
            slist[A[j]-1] += 1
    
    print(slist.count(0))
    
    return

if __name__ == "__main__":
    main()

Solution (Python):

hyo1 = input().split()
N = int((hyo1[0]))
K = int((hyo1[1]))
lis = []

for i in range (N):
    lis.append(i+1)
set_lis = set(lis)

for i in range(K):
    okasi = input()
    hito = list(map(int, input().split()))
    set_hito = set(hito)
    set_lis = (set_lis-set_hito)

print(len(set_lis))

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

t_1 = [n+1 for n in range(N)]

t_2 = []
t_3 = {}


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

    for a in A:
            
        t_2.append(int(a))

    t_3 = set(t_1) - set(t_2)
    
print(len(t_3))

Solution (Python):
s1, s2 = map(int, input().split())
A = set()

for i in range(s2):
    N = input()
    A |= set(map(int, input().split()))

print(s1 - len(A))