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



Sample input:
3 2
2
1 3
1
3


Sample output:
1

Submission status: Accepted

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

List=set()
for i in range(K):
    d=int(input())
    if(d==1):
        List.add(input())
    else:
        tmp=input().split()
        for j in range(d):
            List.add(tmp[j])

print(N-len(List))

Submission status: Accepted

Solution code:
import sys
N, K = map(int, sys.stdin.readline().rstrip().split())
number = list(range(1, N+1))
lists = []
for i in range(K):
  d = sys.stdin.readline().rstrip()
  li = [int(x) for x in sys.stdin.readline().rstrip().split()]
  for k in li:
    if k in number:
      number.remove(k)
  lists.append(li)
#print(lists)
print(len(number))

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
sunuke = list(range(1,n+1))
for i in range(k):
  o = int(input())
  s = list(map(int, input().split()))
  sunuke = list(set(sunuke) - set(s))
print(len(sunuke))

Submission status: Accepted

Solution code:
import numpy as np
n, k = (int(x) for x in input().split())
d = np.zeros(k)
a = np.zeros(n)
for i in range(k):
    d[i] = int(input())
    a_s = (int(x) for x in input().split())
    for i_a, a_ss in enumerate(a_s):
        a[a_ss-1] += 1

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
l=[list(map(int,input().split())) for i in range(2*k)]
lk=l[1::2]
lk=sum(lk,[])
ls=list(set(lk))
ln=[i for i in range(1,n+1)]
a=0
for i in ln:
  if i not in ls:
    a+=1
print(a)

Submission status: Accepted

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

print(ans.count(0))

Submission status: Accepted

Solution code:
n,k = (int(i) for i in input().split())

belongs = [0] * n

for i in range(k):
	if 0 in belongs:
		d = int(input())
		a = [int(j) for j in input().split()]
		for j in range(d):
			belongs[a[j]-1] = 1

print(belongs.count(0))

Submission status: Accepted

Solution code:
NK = list(map(int, input().split()))

AD = [list(map(int, input().split())) for i in range(2*NK[1])]

s = set()

for i in range(NK[1]):
    for j in AD[2*i+1]:
        s.add(j)

print(NK[0]-len(s))

Submission status: Accepted

Solution code:
import sys
import math

n, k = [int(x) for x in sys.stdin.readline().rstrip().split()]

ipt = sys.stdin.readlines()
li = [0 for x in range(n)]

for i in range(1, len(ipt), 2):
	for j in ipt[i].split():
		x = int(j)
		li[x - 1] += 1

print(li.count(0))

Submission status: Accepted

Solution code:
#abc 166
#b
n,k = map(int, input().split())
ln = list(range(1,n+1))
di = 0
linei = []
for i in range(k):
    di = int(input())
    linei = list(map(int, input().split()))
    for j in linei:
        if j in ln:
            ln.remove(j)
print(len(ln))

Submission status: Accepted

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

given = []

for i in range(k):
    d = int(input())
    for x in input().split():
        given.append(int(x))

num = 0
for i in range(1, n+1):
    if i not in given:
        num += 1
print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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

d = [0]*K
A = [0]*N
Ak = [0]*K

for i in range(0,K):
    d[i]= input()
    d[i]= int(d[i])
    Ak[i] = input().split()
    Ak[i] = [int(s) for s in Ak[i]]
    for j in range(0,d[i]):
        A[Ak[i][j]-1] += 1
        
print(A.count(0))

Submission status: Accepted

Solution code:
import numpy as np
N, K = map(int, input().split())
lis = list(np.arange(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 lis:
            lis.remove(A[j])
        else:
            continue
print(len(lis))

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,k = inpm()
    ans = [1 for _ in range(n)]
    for _ in range(k):
        d = inp()
        a = inpl()
        for i in range(d):
            ans[a[i]-1] = 0
    print(sum(ans))    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
a = [0]*n
b = [[]]*k
d = 0
cnt = 0
for i in range(k):
    d = input()
    b[i] = list(map(int,input().split()))
    l = len(b[i])
    for j in range(l):
        a[b[i][j]-1] = 1
for k in range(n):
    if a[k] == 0:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N_K =input('').split(' ')
lst = []
N = int(N_K[0])
K= int(N_K[1])
for n in range(0,N+1):
    lst.append(0)
for i in range(0, K ):
    D = int(input(''))
    A = map(int, input('').split(' '))
    for d in A:
        lst[d] = 1

ans = 0
for j in lst:
    if j == 0:
        ans = ans+1
print(ans-1)

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
n = []
for i in range(1 , N +1):
  n.append(i)


for i in range(K):
  di = int(input())
  arr= list(map(int,input().split()))
  for j in arr:
    if(j in n):
      n.remove(j)

print(len(n))

Submission status: Accepted

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

d = [0] * K
A = []
cnt = [0] * N
ans = 0


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

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

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

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
n = a[0]
k = a[1]

kind = set()

for i in range(k):
    d = input()
    list_a = list(map(int,input().split()))
    s_a = set(list_a)
    kind = kind | s_a

print(n-len(kind))

Submission status: Accepted

Solution code:
import sys

N,K = map(int, sys.stdin.readline().split())

k = list(range(N))

for _ in range(K):
    d = map(int, sys.stdin.readline().split())
    A = map(int, sys.stdin.readline().split())
    for a in A:
        k[a-1] = ''

print(len([i for i in k if i != '']))

Submission status: Accepted

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


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

Set=set([])

for i in range(K):
    Set=Set|set(S[2*i+1])

print(N-len(Set))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=map(int,input('').split(' '))
a=[]
d=[]
for i in range(k):
    s=int(input(''))
    d.append(s)

    s=input('')
    s=s.split(' ')
    for j in range(len(s)):
        s[j]=int(s[j])
    a.append(s)

b=[]
for i in range(n):
    b.append(0)

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

m=0
for i in range(n):
    if b[i]==0:
        m=m+1

print(m)

Submission status: Accepted

Solution code:
N, K = map(int, input().split( ))
list = []
for mem in range(N):
    list.append(0)


for shop in range(K):
    members = int(input())
    holder = input().split( )
    i=0
    for i in holder:
        list[int(i)-1] = 1
print(list.count(0))

Submission status: Accepted

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

a = []

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

ans = n - len(a)

print(ans)

Submission status: Accepted

Solution code:
b1=input().split()
N=int(b1[0])
K=int(b1[1])

L=[0 for n in range(N)]
for k in range(K):
  n1=int(input())
  n2=input().split()
  for x in range(n1):
    L[int(n2[x])-1]+=1

A=0
for z in L:
  if z==0:
    A+=1

print(A)

Submission status: Accepted

Solution code:
[N, K] = list(map(int, input().split()))
dList = []
AList = []
snuckSnack = {}
for i in range(K):
    dList.append(int(input()))
    AList.append(list(map(int, input().split())))
for i in range(1,N+1):
    snuckSnack[i] = set()
for i in range(K):
    for j in AList[i]:
        snuckSnack[j].add(dList[i])
vicCount = 0
for i in range(1,N+1):
    if snuckSnack[i] == set():
        vicCount += 1
print(vicCount)

Submission status: Accepted

Solution code:
n, k = map(int,input().split())
data = []
for _ in range(k):
    d = int(input())
    data.extend(list(map(int,input().split())))

print(n-len(set(data)))

Submission status: Accepted

Solution code:
import itertools
n, k = map(int, input().split())
d = []
a = []
n_1=[i for i in range(1,n+1)]
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
a_1 = list(itertools.chain.from_iterable(a))
c=list(set(n_1)-set(a_1))
print(len(c))

Submission status: Accepted

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

print(n - len(set(t)))

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))
person = [True for _ in range(n)]
for _ in range(k):
    d = int(input())
    sweet = list(map(int, input().split()))
    for p in sweet:
        person[p-1] = False

print(len(list(filter(lambda x:x, person))))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
s = {i for i in range(1,n+1)}
for i in range(k):
    d = int(input())
    a = set(map(int, input().split()))
    s = s - a

print(len(s))

Submission status: Accepted

Solution code:
import collections
N, K = map(int, input().split())
M = [list(map(int, input().split())) for i in range(K * 2)]
snuke_snack = []
for i in range(K):
    snuke_snack.extend(M[2 * i + 1])
count = collections.Counter(snuke_snack)
print(N - len(count))

Submission status: Accepted

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

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

for _ in range(K):
    okashi = input()
    k = map(int, input().split(" "))
    for x in  k:
        p.discard(x)
print(len(p))

Submission status: Accepted

Solution code:
n,k=[int(_) for _ in input().split()]
d=[]
a=[]
h=[0 for _ in range(n)]
for i in range(k):
    d.append(int(input()))
    a.append([int(_) for _ in input().split()])
for i in range(k):
    for j in range(d[i]):
        h[a[i][j]-1]+=1
print(h.count(0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
ALL=[]
for i in range(k):
    d=int(input())
    A = list(map(int,input().split()))
    for ii in range(d):
        ALL.append(A[ii])
ans=list(set(list(range(1,n+1))) - set(ALL))
print(len(ans))

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
b=list()
c=list()
d=([0]*a[0])
for i in range(a[1]):
    b = int(input())
    c = list(map(int,input().split()))
    for k in range(len(c)):
        d[c[k]-1]=1
print(len(d)-d.count(1))

Submission status: Accepted

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

sumans = [0] * 110

i = 1
while i <= k:
  d = int(input())
  j = 0
  aes = list(map(int, input().split()))
  while j < d:
    sumans[aes[j]] = 1
    j += 1
  i += 1

ans = n - sum(sumans)
print(ans)

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
A = [0]*N
for _ in range(K):
  d = input()
  List = list(map(int,input().split()))
  for item in List:
    A[item-1] += 1 
counter = 0
for item in A:
  if item == 0:
    counter += 1
print(counter)

Submission status: Accepted

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

s = [int(i) for i in range(1, n+1)]

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

    for a in as_:
        try:
            s.remove(a)
        except ValueError:
            pass
print(len(s))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

n, k = map(int, input().split())
d = np.zeros((k))
a = np.zeros(())
list_all = []
set_all = {}
for i in range(k):
    d = input()
    list_all.extend(input().split())
    set_all = set(list_all)

ans = n - len(set_all)

print(ans)

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
snks =[1]*n

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

print(sum(snks))

Submission status: Accepted

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

res = list(range(1,n+1))
s = set({})
for i in range(k):
    okashi = int(input())
    okashi_hito = set(map(int, input().split()))
    s = s.union(okashi_hito)
print(n - len(s))

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
A = [[0 for j in range(K)]for i in range(K)]
B = [0 for j in range(N)]
S = 0
for i in range(K):
    d = int(input())
    A[i] = list(map(int,input().split()))
for i in range(K):
    for j in range(len(A[i])):
        for k in range(N):
            if A[i][j] == k+1:
                B[k] = 1
for i in range(N):
    if B[i] != 1:
        S += 1
print (S)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
N_set = {i+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):
    N_set.discard(A[j])
print(len(N_set))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
sunuke=[0]*N
count=0
for _ in range(K):
  d=int(input())
  has=list(map(int,input().split()))
  for i in range(N):
    for j in range(d):
      if i+1==has[j]:
        sunuke[i]=1
for i in range(N):
  if sunuke[i]==0:
    count+=1
print(count)

Submission status: Accepted

Solution code:
import numpy as np

N,K = [int(i) for i in input().split(" ")]
ans = np.zeros(N)
for i in range(K):
    d = int(input())
    ar = [int(i) for i in input().split(" ")]
    for l in range(d):
        ans[ar[l]-1] += 1

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

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
t = []
for i in range(k):
    d = int(input())
    li = list(map(int,input().split()))
    for k in range(len(li)):
        t.append(li[k])

c=0
for i in range(1,n+1):
    if(i not in t):
        c += 1
print(c)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N, K = map(int, readline().split())
    d = []
    A = []
    for _ in range(K):
        d.append(int(readline()))
        A.append(readline().decode().split())
    ans = 0
    for n in range(1,N+1):
        cnt = 0
        for i in range(len(A)):
            cnt += A[i].count(str(n))
        if cnt == 0:
            ans += 1
    print(ans)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

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

Submission status: Accepted

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

num = 0

lst = []

for i in range(K):
    d = int(input())
    a = input().split()
    lst.extend(a)



for i in range(1,N+1):
    if not str(i) in lst:
        num += 1

print(num)

Submission status: Accepted

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

names = list(range(1,n+1))
for i in range(0,k):
  j = i*2
  syoji = sunukes[j]
  okashi = sunukes[j+1]
  for n in okashi:
    if n in names:
      names.remove(n)

print(len(names))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

res = [1]*(n+1)
res[0] = 0

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

print(sum(res))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
d_list = []
A_list = []
for i in range(K):
    d_list.append(int(input()))
    A_ = list(map(int, input().split()))
    A_list.extend(A_)

K_all = set(A_list)
N_all = set(range(1, N+1))

no_N = N_all - K_all

print(len(no_N))

Submission status: Accepted

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

d = []
a = []

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


okashi = [0] * n


for i in a:
    for j in i:
        okashi[j-1] = 1

ans = n - sum(okashi)

print(ans)

Submission status: Accepted

Solution code:
N,K=(int(x) for x in input().split())

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

#print(N,K,d,grid)

for i in range(K):
  X = grid[i]
  for i in range(N):
    if (i+1) in X:
      Hu[i] = Hu[i] + 1
      #print(i)

print(Hu.count(0))

Submission status: Accepted

Solution code:
import itertools

N,K=map(int,input().split())
dA=list(input().split() for _ in range(2*K))
ans=[0]*K

for i in range(2*K):
    if i%2!=0:
        ans[i//2]=dA[i]
print(N-len(set(list(itertools.chain.from_iterable(ans)))))

Submission status: Accepted

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

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

print(A.count(0))

Submission status: Accepted

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

ans = [0] * n

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

    #print(d,a)
    for x in a:
        ans[x-1] = 1



print(ans.count(0))

Submission status: Accepted

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

Submission status: Accepted

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

A = [i for i in range(1,n+1)]

ans = []

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

import collections

c = collections.Counter(ans)

print(n - len(c.keys()))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B - Trick or Treat
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.append(a)
# print(D,A)

for i in range(1,K):
    A[0].extend(A[i])
# print(A[0])

print(N-len(set(A[0])))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = map(int,input().split())
List = []
List2 = []
list3 = []
for i in range(k):
    d = int(input())
    List.append(list(map(int,input().split())))
for i in range(len(List)):
    List2.extend(List[i])
for i in range(1,n+1):
    list3.append(i)
print(len(list(set(list3)-set(List2))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy
N, K = map(int, input().split())
d = 0
l = list(numpy.zeros(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))

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
ans = 0
n, k = MAP()
dd = defaultdict(int)
for i in range(k):
    d = INT()
    temp = LIST()
    for el in temp:
        dd[el] = 100
for i in range(n):
    if(dd[i+1]==0):
        ans+=1
print(ans)

Submission status: Accepted

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

x = [0] * n
for a in A:
    for i in a:
        x[i-1] += 1

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

Submission status: Accepted

Solution code:
N,K = list(map(int,input().split()))
N_S = [i+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):
        if a[j] in N_S:
            N_S.remove(a[j])
print(len(N_S))

Submission status: Accepted

Solution code:
import itertools

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

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

Submission status: Accepted

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

c=[0]*n

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

print(c.count(0))

Submission status: Accepted

Solution code:
list=input().split(" ")
N=int(list[0])
K=int(list[1])

sunuke_list=[1]

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

for i in range(K):
    num=int(input())
    have_list=input().split(" ")
    for j in range(num):
        tmp=int(have_list[j])
        sunuke_list[tmp]=1

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

Submission status: Accepted

Solution code:
N,K = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(2*K)]
menber = [i for i in range(1,N+1)]
l = []
set0 = set(l)
for i in range(K):
    set1 = set(data[2*i+1])
    set0 = set0.union(set1)
print(N-len(set0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
ans=[]
a=0
for i in range(K):
    a=input()
    ans.append(input().split())
def flatten_2d(data):
    for block in data:
        for elem in block:
            yield elem
d = list(flatten_2d(ans))

anse=set(d)
print(N-len(anse))

Submission status: Accepted

Solution code:
import itertools
n, k = map(int,input().split())
d = []
a = []


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

a = list(itertools.chain.from_iterable(a))
a = list(set(a))

print(n - len(a))

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
N, K = [int(i) for i in input().split()]
A = []
for i in range(K):
    input()
    A += [int(i) for i in input().split()]
print(N - len(set(A)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
withSnacks = []
for x in range(K):
	nUmsnakes = int(input())
	snakes = list(map(int, input().split()))
	withSnacks.extend(snakes)
withSnacks = list(set(withSnacks))
count = 0
for x in range(1, N + 1):
	if not x in withSnacks:
		count += 1
 
print(count)

Submission status: Accepted

Solution code:
import numpy as np


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

l = []
s = set()

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

print(n-len(set(l)))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
li1 = [0]*n
li2 = []
for i in range(n):
    li1[i] += i+1
for i in range(k):
    S = input()
    li2 += input().split()
li3 = [int(s) for s in li2]
diff = set(li1) ^ set(li3)
print(len(diff))

Submission status: Accepted

Solution code:
n , k  = map(int , input().split())
o = []
ans = 0
for i in range(1,n+1):
    o.append(0)
for i in range(k):
    d = int(input())
    s = list(map(int , input().split()))
    for i in range(d):
        o[s[i]-1] = d
for i in range(len(o)):
    if o[i] == 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N,K=map(int,input().split())#N人K種類
ls=[False for _ in range(N)]
for i in range(K):
  d=int(input())
  A=list(map(int,input().split()))
  for j in range(d):
    ls[A[j]-1]=True
S=0
for i in range(N):
  if ls[i]==False:
    S+=1
print(S)

Submission status: Accepted

Solution code:
n, trick = map(int, input().split())
nusuke = [0]*n
for _ in range(trick):
  d = int(input())
  a = map(int, input().split())
  for t in a:
    nusuke[t-1] += 1

print(nusuke.count(0))

Submission status: Accepted

Solution code:
from pprint import pprint

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

d = []
a = []

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

#pprint(n)
#pprint(k)
#pprint(d)
#pprint(a)

checkedlist = [0] * n
counter = 0

for i in range(k):
    for j in range(d[i]):
        if checkedlist[a[i][j] - 1] == 0:
            checkedlist[a[i][j] - 1] = 1
            counter += 1
        else:
            pass

print(n - counter)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
have_treats = set()

for i in range(k):
    input()
    for j in map(int, input().split()):
        have_treats.add(j)
    
print(n - len(have_treats))

Submission status: Accepted

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

print(ans.count(0))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
missing = 0
snuke = []
snacks = []
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in a:
        snacks.append(i)

snuke = list(set(snuke))
snacks = list(set(snacks))
print(n - len(snacks))

Submission status: Accepted

Solution code:
params0 = list(map(lambda x: int(x), input().split(' ')))
paramN, paramK = params0

data = [True for i in range(paramN)]

for i in range(paramK):
    input()
    sunukes = list(map(lambda x: int(x), input().split(' ')))
    for sunuke in sunukes:
        data[sunuke - 1] = False

print(len(list(filter(lambda x: x, data))))

Submission status: Accepted

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

d = []
A = []
ans = []

check = list(range(N))

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

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
l=[0]*n
ans=n
for i in range(k):
    o=int(input())
    for ih in list(map(int,input().split())):
        if l[ih-1]==0:ans-=1;l[ih-1]=1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
n, k = list(map(lambda x: int(x), input().split(' ')))
su = list(range(1, n+1))
for i in range(int(k)):
  input()
  tmp = list(map(lambda x: int(x), input().split(' ')))
  for j in tmp:
    if j in su:
      su.remove(j)
  

print(len(su))

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
sunuke_dict = {}
for i in range(K):
    d = int(input())
    sunuke_dict[i] = list(map(int,input().split()))
ans = [1]*(N+1)
ans[0]  =0
for v in sunuke_dict.values():
    for v_ in v:
        if ans[v_] == 1:
            ans[v_] =0
print(sum(ans))

Submission status: Accepted

Solution code:
import itertools
N,K = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(K*2)]
B = list()
for i in range(1,K*2+1,2):
    B.append(A[i])
C = set(list(itertools.chain.from_iterable(B)))

print(N-len(C))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
d_list=[]
S_list=[]
j_list=[]
for i in range(K):
    d = int(input())
    d_list.append(d)
    S = list(map(int, input().split()))
    S_list.append(S)

    
for j in S_list:
    j_list=j_list+j

j_set=set(j_list)
print(N-len(j_set))

Submission status: Accepted

Solution code:
N, K = map(int, input().split()) 
sunuke = list(range(1,N+1))
#print(sunuke)
for i in range(K): 
    kasi = int(input()) 
    motteru = map(int, input().split()) 
    for _ in motteru: 
        if _ in sunuke:
            sunuke.remove(_) 
print(len(sunuke))