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):
if __name__ == '__main__':
    N,K=input().split(" ")
    p=int(N)
    q=int(K)
    a=[0]*p
    judge=0
    for i in range(0,q):
        k=int(input())
        b=[int(t) for t in input().split()]
        for j in range(0,len(b)):
            a[b[j]-1]+=1
    for m in range(0,p):
        if a[m]==0:
            judge+=1
    print(judge)

Solution (Python):
N, K = (int(i) for i in input().split(' '))
N = str(N)
listN = [str(n+1) for n in range(int(N))]
for i in range(K):
    d = int(input())
    A = input().split(' ')
    for j in A:
        if j in listN:
            listN.remove(j)
print(len(listN))

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

for i in range(1,k+1):
    d = int(input())
    a.append(input().split())

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

for j in range(0, len(res)):
    l[int(res[j])-1]+=1

cnt = 0
for k in range(0, len(l)):
    if(l[k]==0):
        cnt+=1

print(cnt)

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

Solution (Python):
from sys import stdin

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

print(N-len(A))

Solution (Python):
n,k = map(int,input().split())
a={i for i in range(1,n+1)}
b={0}
for _ in range(k):
    m=int(input())
    l=set(list(map(int,input().split())))
    b|=l
print(len(a-b))

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

for i in range(N):
  arr.append(i+1)

for j in range(K):
  S = input()
  d1 = input().split()
  for k in range(len(d1)):
    if int(d1[k]) in arr:
      arr.remove(int(d1[k]))

print(len(arr))

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

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

for i in range(1,N+1):
    for j in range(K):
        if A[j].count(i) == 0:
            flag += 1
    if flag == K:
        count += 1
        flag = 0
    else:
        flag = 0

print(count)

Solution (Python):
NK = list(map(int, input().split()))
N=NK[0]
K=NK[1]
sunukes = [i+1 for i in range(N)]
for i in range(K):
  d = int(input())
  A = map(int, input().split())
  for a in A:
    if a in sunukes:
      sunukes.remove(a)

print(len(sunukes))

Solution (Python):
N, K =list(map(int, input().split()))
okashi_list =[]
child_list = []
for i in range(K):
    okashi = input()
    okashi_list.append(okashi)
    child = list(map(int, input().split()))
    child_list.extend(child)
child_list = set(child_list)
D = list(range(1,N+1))
count = 0
for i in D:
    if i not in child_list:
        count = count + 1
print(count)

Solution (Python):
import collections
N,K=map(int,input().split())
sunuke=[]
for i in range(K):
    d=int(input())
    okashi=input().split()
    for i in range(d):
        sunuke.append(okashi[i])

have_okashi=collections.Counter(sunuke)
print(N-len(have_okashi))

Solution (Python):
n,k=map(int,input().split())
ns=set()
for x in range(k):
    d=int(input())
    hl=list(input().split())
    for y in range(d):
        ns.add(hl[y])
have=len(ns)
trick=n-have
print(trick)

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

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

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

Solution (Python):
NK = input().split()
d = []
boys = []
for k in range(int(NK[0])):
    boys.append(k+1)

for i in range(int(NK[1])):
    d.append(input())
    l = input().split()
    for item in l:
        if int(item) in boys:
            boys.remove(int(item))

print(len(boys))

Solution (Python):
N,K=map(int,input().split())
T=[0]*N
for i in range(K):
	D=int(input())
	A=list(map(int, input().split()))
	for j in range(D):
		x=A[j]
		y=x-1
		
		if T[y]==0:
			T[y]=1
print(N-sum(T))

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

for i in a:
    for j in i:
        okashi.add(j)

print(len(u-okashi))

Solution (Python):
x, y = list(map(int, input().split(' ')))
set1 = {a + 1 for a in range(x)}
for i in range(y):
    num = int(input())
    row = set(map(int, input().split(' ')))
    for v in row:
        set1.discard(v)

print(len(set1))

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


    print(a.count(0))

if __name__ == "__main__":
    main()

Solution (Python):
n, k = map(int, input().split())
a = ""
b = []
for i in range(0,k):
    a = input()
    b += input().split()
c = set(b)
print(n - len(c))

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

Solution (Python):
N, K = map(int, input().split())
di = K * 2
l = []
for i in range (di):
    l.append(input().split())
l1 = []
x = 1
while x < di:
    for j in l[x]:
        l1.append(j)
    x += 2
l1 = set(l1)
print(N - len(l1))

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

nusuke = [0] * N
res = 0

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

for value in nusuke:
  if(value == 0):
    res += 1

print(res)

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

l = []
for i in range(K):
    s = input()
    l += list(map(int, input().split()))

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

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

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

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

Solution (Python):
N, K = (int(x) for x in input().split())
h = [[input().split() for i in range(2)] for _ in range(K)]
a = [0] * (N+1)
a[0] = 1
for i in range(0, K):
    for j in range(0, int(h[i][0][0])):
        a[int(h[i][1][j])] = 1
print(a.count(0))

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

print(lis.count(0))

Solution (Python):
def cal():
    snukes, snacks = input().split(" ")
    list1 = []
    for i in range(int(snacks)):
        num = int(input())
        str1 = input()
        list1.extend(str1.split(" "))

    count = 0

    for i in range(1, int(snukes) + 1):
        if str(i) not in list1:
            count += 1
    print(count)


cal()

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

B = []
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in range(d):
        if (A[a]-1) not in B:
            B.append(A[a]-1)

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

print(ans)

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

d = []
l = []
i = 0

while i < 2*K:
  i += 1
  if i % 2 == 0:
    l.extend([int(x) for x in input().split()])
  else:
    d.append(int(input()))

L = list(set(l))
print(N - len(L))

Solution (Python):
n,k = input().split()
nlist = []
for i in range(int(k)):
    vain = int(input())
    if vain == 1:
        list = [input()]
    else :
        list= input().split()
    nlist.extend(list)
nlist = set(nlist)
c = len(nlist)
print(int(n)-int(c))

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

B = []
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in range(d):
        if (A[a]-1) not in B:
            B.append(A[a]-1)

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

print(ans)

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 range(len(a)):
        l[a[j]-1] += 1

print(l.count(0))

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

count = 0
for n in range(N):
  if str(n+1) not in A:
    count += 1
print(count)

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

sunukeJudgeList = [0] * sunukeCount
for i in range(k):
    ninzu = int(input())
    sunukeNumberList = input().split()
    for p in range(len(sunukeNumberList)):
        sunukeJudgeList[(int(sunukeNumberList[p]) - 1)] = 1

list = []
for i in range(len(sunukeJudgeList)):
    if sunukeJudgeList[i] == 0:
        list.append(1)

print(len(list))

Solution (Python):
N,K = map(int,input().split())
prank = []
output = []
for i in range(K*2) :
    prank.append(input().split())
m = 1
while m < K*2 :
    for n in prank[m]:
        output.append(n)
    m += 2
print(N-len(set(output)))

Solution (Python):


def main():
    N, K = map(int, input().split())
    d = []
    A = []
    for i in range(K):
        d.append(int(input()))
        A.append(input().split())
    all_A = sum(A, [])
    all_A = [int(i) for i in all_A]
    M = [i for i in range(1, N + 1)]
    print(len(set(M) - set(all_A)))


main()

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

Solution (Python):
n,k = map(int, input().split())
di=[0]*k
Ap=[0]*n
for i in range(0,k):
    di[i] = int(input())
    A = list(map(int, input().split()))
    ai=0
    A.append(-100)
    for j in range(1,n+1):
        if A[ai]==j:
            ai=ai+1
            Ap[j-1]=1
num=0
for l in range(0,n):
    if Ap[l]==0:
        num=num+1
print(num)

Solution (Python):
N,K =map(int,input().split())
Answer = N
List = []
for _ in range(K):
    d = input()
    List += list(map(int,input().split()))
for i in range(N+1):
    if i in List:
        Answer -= 1
print(Answer)

Solution (Python):
import sys

def main():
  N, M = map(int, input().split())
  sunukes = set(range(1, N+1))
  
  is_skip = True
  for i in range(M*2):
    d = list(map(int, input().split()))
    if is_skip:
      is_skip = False
      continue

    sunukes = sunukes - set(d)
	
    is_skip = True

  print(len(list(sunukes)))
  
  
if __name__ == '__main__':
  main()

Solution (Python):
n, k = map(int, input().split())
c = 2 * k
ls = [input().split() for _ in range(c)]
i = 1
l = []
while i < c:
    for j in ls[i]:
        l.append(j)
    i += 2
print(n-len(set(l)))

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

z = [0] * n

for x in range(n):
    z[x] = x + 1

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

print(len(z))

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

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

  S = []
  for i in range(N):
    S.append(0)

  for i in range(len(A)):
    for j in A[i]:
      S[j-1] += 1
  
  ans = 0
  for i in S:
    if i == 0:
      ans += 1
  
  print(ans)
    

if __name__ == "__main__":
  main()

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

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

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

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

for i in range(k):
    for j in range(d[i]):
        if ac[a[i][j]-1] == 0:
           ac[a[i][j]-1] = 1

total = sum(ac)
ans = n - total

print(ans)

Solution (Python):
import itertools

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

list_1 = []

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

print(N-len(set(list(itertools.chain.from_iterable(list_1)))))

Solution (Python):
N_nin, K_ko = map(int, input().split())

index = [1 for i in range(N_nin)]

for i in range(K_ko):
    d = int(input())
    
    if (d != 1):
        A = list(map(int, input().split()))
        for a in A:
            temp = a - 1
            index[temp] = 0
    else:
        A = int(input()) - 1
        
        index[A] = 0
        

ans = sum(index)
print(ans)

Solution (Python):
N,K = map(int,input().split()) 
li=[]
d=[]
counter=[0]*N
for i in range(K):
    d.append(input())
    li.append(list(map(int,input().split())))
    for j in li[i]:
        counter[j-1]+=1
print(len([i for i, x in enumerate(counter) if x == 0]))

Solution (Python):






import sys,bisect,math
sys.setrecursionlimit(15000)

N,K = map(int,sys.stdin.readline().split())
s = set(range(1,N+1))
for _ in range(K):
    d = int(sys.stdin.readline())
    a = set(map(int,sys.stdin.readline().split()))
    s = s-a
print(len(s))

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

Solution (Python):
import collections
N, K = map(int, input().split())
lists=[]
for i in range(K):
    d1=int(input())
    A1=list(map(str,input().split()))
    lists.append(A1)
a=[e for row in lists for e in row]
c = collections.Counter(a)
num=len(c)
print(N-num)

Solution (Python):
def flatten_2d(data):
    for block in data:
        for elem in block:
            yield elem

a,k = map(int,input().split())
listA=[]
cnt=0
for i in range(k):
    n = int(input())
    string_list=list(map(int,input().split()))
    listA.append(string_list)
dst=list(flatten_2d(listA))
for cou in range(1,a+1):

    if cou not in dst:
        cnt+=1

print(cnt)

Solution (Python):
n,k = map(int,input().split())
a = []
for i in range(k):
  d = int(input())
  if d == 1:
    tmp = int(input())
    a.append(tmp)
  else:
    b = [int(i) for i in input().split()]
    for item in b:
    	a.append(item)
result = 0
for i in range(n):
  if i+1 not in a:
    result += 1

print(result)

Solution (Python):
import itertools

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

l = []
k = []
for i in range(1, N+1):
    l.append(str(i))

for i in range(K):
    d = int(input())
    array = input().strip().split()
    k.append(array)
                
k = list(itertools.chain.from_iterable(k))

k = [x for x in set(k) if k.count(x) >= 1]

for i in range(len(k)):
    for j in range(len(l)):
        if k[i] == l[j]:
            l[j] = 0

cnt = 0

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

print(len(l) - cnt)

Solution (Python):
def c(n, a, cnt):
    for i in range(n):
        num = a.count(i+1)
        if num != 0:
            cnt[i] += 1

    return cnt

def solve():
    
    n, k = map(int, input().split())
    cnt = [0]*n
    for _ in range(k):
        d = int(input())
        a = list(map(int, input().split()))
        c(n, a, cnt)

    return cnt.count(0)




print(solve())

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

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



for i in range(k):
  d = int(input())
  
  A = list(map(int, input().split()))
  
  for id, s in enumerate(sunuke):
    if s in A:
      sunuke[id] = 0
      
      

count = 0
for s in sunuke:
  if s != 0:
  	count += 1
print(count)

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

ans = []

for i in range(n):
    ans.append(i + 1)

b =[]

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

b = list(set(b))

for i in range(len(b)):
    ans.remove(b[i])

print(len(ans))

Solution (Python):
n, k= map(int, input().split())
num = list(range(1, n+1))
c = set()
num = set(num)
for i in range(k):
  a = input()
  b = set(list(map(int, input().split())))
  c = c.union(b)
num = list(num -c)
print(len(num))

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

Newlist = []
for i in range(K):
  Newlist.append(List[2*i+1])

Newlist2 = []
for i in range(K):
  for j in range(len(Newlist[i])):
    Newlist2.append(Newlist[i][j])


print(N-len(set(Newlist2)))

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

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

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

Solution (Python):
N, K = input().split()
P = [input().split() for i in range(2 * int(K))]
result = []
counter = 0
m = 0
for p in P:
    if m % 2 ==0:
        pass
    else:
        for i in p:
            result.append(int(i))
    m +=1

result =set(result)

for n in range(int(N)+1):
    if n ==0:
        pass
    elif n in result:
        pass
    else:
        counter +=1
print(str(counter))

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

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

ans = 0

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

print(ans)

Solution (Python):
N,K=map(int, input().split())
ans={i+1 for i in range(N)}
for i in range(K):
	d=int(input())
	A=set(list(map(int, input().split())))
	ans = ans-A

print(len(ans))

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

Solution (Python):
import itertools
n,k=map(int,input().split())
List=[]
for i in range(k):
    s=input()
    List.append(list(map(int,input().split())))
List=list(itertools.chain.from_iterable(List))
cnt=0
for i in range(1,n+1):
    if i not in List:
        cnt+=1
print(cnt)

Solution (Python):
import itertools
N,K=map(int,input().split())
dlist=[list(map(int,input().split())) for i in range(2*K)]
alist=[]
num=0
for i in range(1,len(dlist),2):
  alist.append(dlist[i])
alist=list(itertools.chain.from_iterable(alist))
alist=set(alist)
ans=N-len(alist)
print(ans)

Solution (Python):
inputNumbers = input().split()
snuckNumber = int(inputNumbers[0])
snakeKinds = int(inputNumbers[1])
snuckDict = {}
for i in range(snakeKinds):
    temp = int(input())
    tempSnuckList = input().split()
    for item in tempSnuckList:
        snuckDict[item] = 1;

count = snuckNumber - len(snuckDict)
print(count)

Solution (Python):
n,k=map(int,input().split())
res=set()
ans=0
for i in range(k):
    m=int(input())
    s=list(map(int,input().split()))
    for j in range(m):
        res.add(s[j]-1)
for i in range(n):
    if i not in res:
        ans=ans+1
print(ans)

Solution (Python):
import math

N, K = (int(x) for x in input().split())
itazura = [1] * N
total = 0
for i in range(K * 2):
    for x in input().split():
        if i % 2:
            itazura[int(x) - 1] = 0
print(sum(itazura))

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

sunuke = []
target = []

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


for i in range(1, N+1):
    if i not in sunuke:
        target.append(i)

print(len(target))

Solution (Python):
import itertools
n, k = map(int,input().split())
list1 = []
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    list1.append(a)
b = list(itertools.chain.from_iterable(list1))
b = set(b)

print(n - len(b))

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

Solution (Python):

def main():
    N, K = map(int, input().split())
    A = [0 for c in range(N)]

    for k in range(K):
        D = int(input())
        d_list = [int(_) for _ in input().split()]
        
        for d in range(D):
            i = d_list[d]
            A[i-1] +=  1

    out = A.count(0)
    print(out)
main()

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

box = [0]
for i in range(k):
    box = box + a[(i*2 + 1)]
box.remove(0)

c = len(list(set(box)))
print(n - c)

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

print(A.count(0))

Solution (Python):
n,k=map(int,input().split())
res=set()
ans=0
for i in range(k):
    m=int(input())
    s=list(map(int,input().split()))
    for j in range(m):
        res.add(s[j]-1)
for i in range(n):
    if i not in res:
        ans=ans+1
print(ans)

Solution (Python):
N, K = map(int, input().split())
DD = []
AA = []
for _ in range(K):
  d = int(input())
  DD.append(d)
  A = list(map(int, input().split()))
  a = len(A)
  for i in range(a):
    AA.append(A[i])
AAA = list(set(AA))
aaa = len(AAA)

print(N-aaa)

Solution (Python):

n, k = map(int,input().split())
list_people = list(range(1,n+1))
for i in range(k):
    d = int(input())
    list_get = list(input().split())
    for j in range(d):
        if int(list_get[j]) in list_people:
            list_people.remove(int(list_get[j]))
print(len(list_people))

Solution (Python):



def main():
    N, K = map(int, input().split())
    s = dict(zip(range(1, N + 1), [0] * N))
    for _ in range(K):
        _ = input()
        *A, = map(int, input().split())
        for a in A:
            s[a] += 1
    c = len(list(filter(lambda x: x == 0, s.values())))
    print(c)

if __name__ == "__main__":
    main()

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

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

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

print(cnt)

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

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

mans = [0 for _ in range(0, N)]
for ds in data:
    for d in ds:
        mans[d-1] = 1

print(len(list(filter(lambda x: x == 0, mans))))

Solution (Python):
num = input().split(" ")
people = int(num[0])
kind = int(num[1])
sunuke = []
for i in range(kind):
    have = int(input())
    a = input().split(" ")
    for j in range(have):
        sunuke.append(a[j])
print(people - len(set(sunuke)))

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

for i in range(K):
  key=input()
  v=input().split()
  v=list(map(int,v))
  
  for j in v:
    count[j-1]+=1

print(count.count(0))

Solution (Python):
def main():
  import sys
  input = sys.stdin.readline
  n, k = map(int, input().split())
  d =[]
  a =[]
  all = set(range(1,n+1))
  for i in range(k):
    d.append(int(input()))
    all -= set(map(int, input().split()))
  print(len(all))

if __name__ == '__main__':
    main()

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


for i in A:
  for j in range(int(d[A.index(i)])):
    for k in range(1, N + 1):
      if int(i[j]) == k:
        count[k-1] = 'OK'
 
print(N - count.count('OK'))

Solution (Python):
n,k=map(int,input().split())
a=[]
for i in range(1,(1+(k*2))):
    if i%2==1:
        b=input()
        continue
    else:
        a+=input().split()
print(n-len(set(a)))

Solution (Python):



import math
import itertools
from collections import defaultdict
from collections import Counter
import numpy as np

import heapq


n,k=list(map(int,input().split()))
ans=[True for _ in range(n)]
for _ in range(k):
    c=input()
    a=list(map(int,input().split()))
    for each in a:
        ans[each-1]=False

print(sum(ans))

Solution (Python):
N, K = map(int, input().split())
people = set(range(1, N+1))
for i in range(K):
    d = int(input())
    A = map(int, input().split())
    for a in A:
        people.discard(a)
print(len(people))

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

N = input_line[0]
K = input_line[1]
RESULT = []
count = 0

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


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

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

hoge = []

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

hoge = set(hoge)

print(N-len(hoge))

Solution (Python):
N,K=map(int,input().split())
l=list(range(1,N+1))
for i in range(K):
  d=input()
  a =input().split()
  A=list(a)
  AA=[int(n) for n in A]
  l=[i for i in l if i not in AA]
  
print(len(l))

Solution (Python):

N, K = [int(x) for x in input().split(" ")]
a = [0] * N
for i in range(K):
    _ = input()
    ls = [int(x)-1 for x in input().split(" ")]
    
    for j in ls:
        a[j] = 1
cnt = 0
for i in a:
    if i == 0:
        cnt += 1
print(cnt)

Solution (Python):
n, k = map(int, input().split())
li = []
for x in range(k*2):
    li.append(input().split())
li2 = []
i = 1
while i < k*2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))

Solution (Python):
N,K = (int(x) for x in input().split())
a = [input().split() for l in range(K * 2)]

list = [0] * N

for i in range(1,len(a),2):
    for n in range(len(a[i])):
        x = int(a[i][n])
        list[(x-1)] = 1
        


print(list.count(0))

Solution (Python):

import numpy as np

n, k = map(int, input().split())
a = np.zeros(n)

for i in range(k):
    d = input()
    temp = input()

    for j in range(int(d)):
        a[int(temp.split(' ')[j]) - 1] = 1

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

print(count)

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





check = [False  for i in range(n)]

for i in range(k):
	for sunuke in a[i]:
		check[sunuke-1] = True


print(len([sunuke for sunuke in range(n) if check[sunuke]==False]))

Solution (Python):
N=list(map(int,input().split()))
data=[0]*(N[1]*2)
for n in range(N[1]*2):
    data[n]=list(map(int,input().split()))
sunuke=[0]*(N[0]+1)
sunuke[0]=1
for i in range(N[1]):
    for j in range(len(data[2*i-1])):
        sunuke[data[2*i-1][j]]+=1

ans=0
for k in range(len(sunuke)):
    if sunuke[k]==0:
        ans+=1

print(ans)

Solution (Python):
N, K = map(int, input().split())
d = [[]]
A = [[]]
have = {}
for i in range(1, K+1):
  d.append(int(input()))
  A.append(list(map(int, input().split())))
  for j in A[i]:
    have[j] = 1

print(N - len(have))

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

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

print(a.count(0))

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

for i in range(K):
    AA=int(input())
    L=list(map(int,input().split()))
    for j in L:
        D.add(j)

print(N-len(D))

X=set()

Solution (Python):
N, K=map(int, input().split())
sunuke=[list(map(str, input().split())) for _ in range(2*K)]
merge=[]
ans=0
for i in range(K):
  merge+=sunuke[2*i+1]
for j in range(1, N+1):
  if str(j) not in merge:
    ans+=1
print(ans)

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


l=set(ans)

print(N-len(l))

Solution (Python):
N, K = [int(x) for x in input().split()]
s = set()
for i in range(K):
    d = int(input())
    if d == 1:
        s.add(int(input()))
    else:
        for a in input().split():
            s.add(int(a))
ans = sum([a not in s for a in range(1, N+1)])
print(ans)

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

s = set([i for i in range(1, N+1)])
rs = set()

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

for i in range(K):
    for a in A:
        for j in a:
            rs.add(j)

for i in rs:
    s.remove(i)

print(len(s))

Solution (Python):

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

d=[0]*k
a=set()
for i in range(k):
    d[i]=int(input())
    if d[i]>1:
        ai=set(map(int,input().split()))
        a=a|ai
    else:
        a.add(int(input()))
    
print(n-len(a))

Solution (Python):

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

num = set()

for i in range(k):
  d = int(input())
  tmp = [int(x) for x in input().split()]
  for j in range(d):
    num.add(tmp[j])
  

print(n- len(num))