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 = list(map(int, input().split(" ")))

all_ch = set(range(1, N+1))
have_snack = set()
for i in range(K):
    _ = input()
    kid_have_sn_arr = list(map(int, input().split(" ")))
    for id in kid_have_sn_arr:
        have_snack.add(id)

donthave = all_ch - have_snack
print(len(donthave))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

snuke = [0] *n

for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for idx in a:
        snuke[idx-1] += 1    

ans = 0
for snuke_ in snuke:
    if snuke_ == 0:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    N, K = map(int, input().split())
    sunuke_list = [0 for i in range(N)]
    for i in range(K):
        d = int(input())
        A_list = list(map(int, input().split()))
        for a in A_list:
            sunuke_list[a-1] += 1
    answer = 0
    for sunuke in sunuke_list:
        if sunuke == 0:
            answer += 1
    print(answer)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N,K=map(int,input().split())

mem=[0]*N

for _ in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for item in A:
        mem[item-1]+=1

print(mem.count(0))

Submission status: Accepted

Solution code:
n,k=[int(i) for i in input().split()]
d=[]
a=set()
for i in range(k):
    d.append(int(input()))
    [a.add(int(j)) for j in input().split()]
r=0
for i in range(1,n+1):
    if not i in a:
        r+=1
print(r)

Submission status: Accepted

Solution code:
f=lambda:map(int,input().split())
n,k=f()
l=[1]*n
for _ in range(k):
  input()
  for i in f():
    l[i-1]=0
print(sum(l))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
li = [False] * N
for i in range(K):
    d = int(input())
    arr = list(map(int, input().split()))
    for num in arr:
        li[num - 1] = True

print(li.count(False))

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
counter = [0 for _ in range(N)]
for _ in range(K):
    _ = int(input())
    p = map(int,input().split())
    for i in p:
        counter[i-1] += 1
total = 0
for i in counter:
    if i == 0:
        total += 1
print(total)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
MOD = 1000000007

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

a = [0]*(N)

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

    if d == 1:
        x= int(input())
        x-=1
        a[x]+=1
    else:
        x = map(int,input().split())
        for i in x:
            i-=1
            a[i] +=1

print(a.count(0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
for i in sunuke:
    if i == 0:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
X=input().split(" ")
N=int(X[0])
K=int(X[1])
Nset=set(range(1,N+1))
for _ in range(K):
  d=input()
  dset=set(map(int,input().split(" ")))
  Nset-=dset
print(len(Nset))

Submission status: Accepted

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

sunuke = [ 0 ] * int(n)

for i in range( int( k ) ):
    d = int( input() )
    a = input().split()
    for a_i in a:
        sunuke[ int( a_i ) - 1 ] = 1

cnt = 0
for sunuke_i in sunuke:
    if sunuke_i == 0:
        cnt = cnt + 1

print( cnt )

Submission status: Accepted

Solution code:
n,k = map(int, input().split())
person = [1]*n
for i in range(k):
    _ = input()
    temp = input().split()
    for j in range(len(temp)):
        person[int(temp[j])-1] = 0

print(sum(person))

Submission status: Accepted

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

print(len(ans))

Submission status: Accepted

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

print(N - len(set(sunu)))

Submission status: Accepted

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

print(sunuke.count(1))

Submission status: Accepted

Solution code:
n, k = [int(i) for i in input().split()]
dicter = dict()
for i in range(1, n + 1):
    dicter[i] = []

for i in range(k):
    di = int(input())
    lister = [int(j) for j in input().split()]
    for j in lister:
        dicter[j].append(di)

sumer = 0
for i in range(1, n + 1):
    if dicter[i] == []:
        sumer += 1

print(sumer)

Submission status: Accepted

Solution code:
n,k = list(map(int,input().split()))
dic = {}
for rep in range(k):
	d = int(input())
	a = list(map(int,input().split()))
	for i in a:
		if i not in dic:
			dic[i] = 1
print(n-len(dic))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

l = [0 for _ in range(n)]

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

Submission status: Accepted

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

for i in range(k):
    input()
    a = list(map(int, input().split()))
    for j in a:
        s[j-1] = 0
print(sum(s))

Submission status: Accepted

Solution code:
n, k = map(int, input().strip().split())
sunuke=[False]*n
for i in range(k):
    d=int(input().strip())
    L = list(map(int, input().strip().split()))
    for j in L:
        sunuke[j-1]=True
ans=0
for i in sunuke:
    if not i:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np 

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

result = [0]*N

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

Submission status: Accepted

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

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 j in range(d):
        ans[a[j]-1] += 1
counter = 0
for i in ans:
    if i == 0:
        counter += 1
print(counter)

Submission status: Accepted

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

cnt = [0]*n

for i in range(k):
    d = int(input())
    for j in tuple(map(int, input().split())):
        cnt[j-1] += 1

print(cnt.count(0))

Submission status: Accepted

Solution code:
def main():
    n, k = map(int, input().split())
    sunu = [1] * n
    for _ in range(k):
        d = int(input())
        dl = list(map(int, input().split()))
        for edl in dl:
            sunu[edl - 1] = 0
    print(sum(sunu))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

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

ans = 0

for p in pL:
    if p == 0:
        ans += 1

print(ans)

Submission status: Accepted

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

n_list = [1]*n

for i in range(k):
    d = int(input())
    for a in input().split():
        n_list[int(a)-1] = 0
print(sum(n_list))

Submission status: Accepted

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

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

B = set()
for i in range(k):
    for a in A[i]:
        B.add(a)

print(n-len(B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n, k = map(int, input().split())
    # d = [None] * k
    a = [None] * k
    ret = [1] * n
    for i in range(k):
        _ = input()
        for _a in map(int, input().split()):
            ret[_a-1] = 0
    print(sum(ret))



if __name__=="__main__":
    main()

Submission status: Accepted

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

a = []
for i in range(N):
    a.append(0)
    
for i in range(K):
    b = int(input())
    c = list(map(int,input().split()))
    for j in range(len(c)):
        a[c[j]-1] = 1

cnt = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(k):
    d = int(input())
    a = list(input().split())
    for j in a:
        l[int(j) - 1] += 1

ans = l.count(0)

print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,raw_input().split())
a=[0]*(n+1)
for i in range(k):
    d=input()
    b=map(int,raw_input().split())

    for j in range(d):
        a[b[j]]=1

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

Submission status: Accepted

Solution code:
def main():
    n,k=map(int,input().split())
    s=set()
    for _ in range(k):
        _=input()
        s|=set(map(int,input().split()))
    print(n-len(s))
main()

Submission status: Accepted

Solution code:
import numpy as np

N, K = map(int, input().split())
X = np.zeros(N, np.bool)
for _ in range(K):
    d = int(input())
    Z = [int(i) for i in input().split()]
    for z in Z:
        X[z - 1] = True
print(N - np.count_nonzero(X))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
tt = []
for i in range(k) :
    t = int(input())
    a = list(map(int, input().split()))
    for j in a :
        tt.append(j)
tt = set(tt)
print(n - len(tt))

Submission status: Accepted

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

for i in range(k):
    num = input()
    num_list = list(map(int,input().split()))
    for j in num_list:
        n_list[j-1] = 1
cnt = 0
for i in n_list:
    if i == 0:
        cnt += 1
        
print(cnt)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

from pprint import pprint
from collections import deque, defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline
INF = float("inf")

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

d = []
flags = [0 for i in range(n + 1)]

for i in range(k):
    d.append(int(input()))
    line = list(map(int, input().split()))
    for l in line:
        flags[l] += 1

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

print(count)

Submission status: Accepted

Solution code:
N ,K = map(int,input().split())
NL = [0]*N
for i in range(K):
    K = input()
    AL = list(map(int,input().split()))
    for j in AL:
        NL[j-1] += 1
ans = 0
for i in NL:
    if i == 0:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(k):
    input()
    tmp += [int(x) for x in input().split()]

print(len(set(range(1, n+1)) - set(tmp)))

Submission status: Accepted

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

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

re_ans = ans.count(0)
print(re_ans)

Submission status: Accepted

Solution code:
def main():
    # S = int(input())
    # S = input()
    N, K = list(map(int, input().split(' ')))
    
    dn = []
    An = []
    for _ in range(K):
        dn.append(int(input()))
        An.extend(list(map(int, input().split(' '))))
        
    an = set(An)
    
    print(N - len(an))
    
        
    
        
    
    
    
    



main()

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())))
    
aa=[0]*n

for j in a:
    for k in j:
        aa[k-1]+=1
        
ans=0

for x in aa:
    if x==0:
        ans+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    nk = list(map(int, input().split()))
    s = [0]*nk[0]
    for i in range(nk[1]):
        d = int(input())
        a = list(map(int, input().split()))
        for j in a:
            s[j-1] += 1
    print(s.count(0))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

def main():
     n, k = map(int, input().split())
     sunuke = [0 for i in range(n)]

     for i in range(k):
          num = int(input())
          have = list(map(int, input().split()))
          for k in have:
               sunuke[k-1] += 1
     
     ans = 0
     for i in range(len(sunuke)):
          if sunuke[i] == 0:
               ans += 1
     
     print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

set_list = set(list)
ans = n - len(set_list)
print(ans)

Submission status: Accepted

Solution code:
import math
N, K = map(int, input().split())
# A =[]
# D = []
H = [0 for i in range(N)]
for i in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
        H[j-1] += 1
    # D.append(d)
    # A.append(a)

Ns = 0
for i in H:
    if i ==0:
        Ns+=1

# print(A,D)
# print(H)
print(Ns)

Submission status: Accepted

Solution code:
def main():
  N, K = map(int, input().split())
  sunuke_l = [0] * N
  for _ in range(K):
    x = int(input())
    y = list(map(int, input().split()))
    for i in y:
      sunuke_l[i-1] += 1
  print(sunuke_l.count(0))
main()

Submission status: Accepted

Solution code:
n, k = list(map(int, input().split()))
okasi = [False] * n
for i in range(k):
    d_len = int(input())
    d = list(map(int, input().split()))
    for j in range(d_len):
        okasi[d[j]-1] = True

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

Submission status: Accepted

Solution code:
from collections import Counter
N,K=[int(i)for i in input().split()]
c=Counter([])
for i in range(K):
  input()
  c+=Counter([int(i)for i in input().split()])
  
#print(len(c.keys()))
print(N-len(c.keys()))

Submission status: Accepted

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

ans = [0 for _ in range(N)]

for _ in range(K):
    d = int(input())
    A = [int(n) for n in input().split()]

    for a in A:
        ans[a-1] += 1


print(ans.count(0))

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
a = [h for h in range(1,n+1)]
s = set()
for i in range(k):
    d = int(input())
    x = list(map(int,input().split()))
    s |= set(x)

print(len(a)-len(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n, k = map(int, args[0].split())

    T = [0]*n
    for A in args[2::2]:
        for a in map(int, A.split()):
            T[a-1] += 1

    return str(T.count(0))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

l = []
for i in range(K):
    l += A[i]
print(N - len(set(l)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
snuke = [1 for k in range(N)]
for k in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(d):
        snuke[A[j]-1] = 0
print(sum(snuke))

Submission status: Accepted

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

for i in range(len(a)):
    for j in range(len(a[i])):
        if a[i][j] in a_remain:
            a_remain.remove(a[i][j])

print(len(a_remain))

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 j in range(len(a)):
        ans[a[j]-1]+=1
res=0
for i in range(n):
    if(ans[i]==0):
        res+=1
print(res)

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()))
  for j in range(d):
    ans[A[j]-1] = 1

print(ans.count(0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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
b=0
for k in range(N):
 if L[k]==0:
  b+=1
print(b)

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, K = LI()
d = [0 for i in range(K)]
A = [[] for i in range(K)]
for k in range(K):
    d[k] = int(input())
    A[k] = LI()

sunuke = [0 for i in range(N)]
for k in range(K):
    for s in A[k]:
        sunuke[s - 1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

treat = [False] * N

for _ in range(K):
    d = int(input())
    for i in map(int, input().split()):
        treat[i - 1] = True

print(sum([v == False for v in treat]))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
p=[]
for i in range(k):
  nn=int(input())
  a=list(map(int,input().split()))
  for j in range(nn):
    p.append(a[j])
    
p=set(p)
print(n-len(p))

Submission status: Accepted

Solution code:
import math
N,K = map(int,input().split())
has = [0]*(N+1)
for _ in range(K):
    input()
    items = list(map(int,input().split()))
    for item in items:
        has[item] = 1

print(N - sum(has))

Submission status: Accepted

Solution code:
from collections import defaultdict
N,K=map(int,input().split())
Hash=defaultdict(lambda:0)
for i in range(K):
    x=int(input())
    L=list(map(int,input().split()))
    for i in L:
        Hash[i]=1
count=0
for i in range(1,N+1):
    if Hash[i]==0:
        count+=1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
a = [0]*k
has_k = [False]*n
count = 0

for i in range(k):
    tmp_d = int(input())
    tmp_a = list(map(int, input().split()))
    for ai in tmp_a:
        has_k[ai-1] = True

for ki in has_k:
    if ki == False:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s = set()

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

print(n - len(s))

Submission status: Accepted

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

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

print(n - len(a))

Submission status: Accepted

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

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

for i in range(k):
    d = input()
    a = list(map(int, input().split()))
    for j in a:
        if j in sunuke:
            sunuke.remove(j)
print(len(sunuke))

Submission status: Accepted

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

for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for j in range(len(A)):
    anslist.append(A[j])
    
print(N - len(list(set(anslist))))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
sunuke=set()
snack=[]
for i in range(k):
  d=int(input())
  kashi=list(map(int,input().split()))
  snack.append(kashi)
for i in range(k):
  for j in snack[i]:
    sunuke.add(j)
print(n-len(sunuke))

Submission status: Accepted

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

candidates = set(range(1,N+1))
#print(candidates)
for k in range(K):
  input()
  D = set(int(x) for x in input().split(' '))
  candidates -= D
  #print('D',D)
  #print(candidates)

print(len(candidates))

Submission status: Accepted

Solution code:
N, K = map(int,input().split())
dd = [True]*N
for i in range(K):
  di = int(input())
  AA = list(map(int,input().split()))
  #print(di, AA)
  for j in range(di):
    dd[AA[j]-1] = False
print(sum(dd))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
n,k=map(int,input().split())
d=[0 for _ in range(k)]
v=[0 for i in range(n)]
for i in range(k):
	d[i] = int(input())
	a = list(map(int,input().split()))
	for j in range(d[i]):
		v[a[j]-1] += 1
unta = collections.Counter(v)
print(unta[0])

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor

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

    s = set(range(1, N+1))
    for k in range(K):
        d = int(input())
        As = list(map(int, input().split()))
        for a in As:
            if a in s:
                s.remove(a)

    print(len(s))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    k = kwargs["k"]
    D = kwargs["D"]
    A = kwargs["A"]
    C = [0 for i in range(n)]

    for i in range(k):
        for j in range(D[i]):
            C[A[i][j] - 1] += 1

    res = 0

    for i in range(n):
        if C[i] == 0:
            res += 1

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["n"], kwargs["k"] = [int(i) for i in cin]

    kwargs["D"] = []
    kwargs["A"] = []

    for i in range(kwargs["k"]):
        cin = input().split()
        #kwargs["n"] = cin[0]
        #kwargs["n"], kwargs["k"] = cin
        d = [int(i) for i in cin][0]
        #kwargs["n"], kwargs["k"] = [int(i) for i in cin]
        kwargs["D"].append(d)

        cin = input().split()
        #a = cin[0]
        #a = cin
        #a = [int(i) for i in cin][0]
        a = [int(i) for i in cin]
        kwargs["A"].append(a)

    cout = main(kwargs)
    print(cout)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=(int(i) for i in input().split())
l=[1 for i in range(1,n+1)]
for i in range(k):
  d=input()
  l1=[int(j) for j in input().split()]
  for j in l1:
      l[j-1]=0
c=0
for i in l:
  if(i>0):
    c+=1
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def q2():
    n, k = [int(i) for i in input().split(" ")]
    snk = set()
    for i in range(k):
        _ = int(input())
        l = [int(i) for i in input().split(" ")]
        for j in l:
            snk.add(j)
    print(n - len(snk))

q2()

Submission status: Accepted

Solution code:
N, K = input().split(" ")
N, K = int(N), int(K)
d = []
A = []
for k in range(K):
    d.append(int(input()))
    A += [int(a) for a in input().split(" ")]

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

Submission status: Accepted

Solution code:
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()))

total_list = []

for i in range(k):
    total_list += a[i]

uni = set(total_list)
ans = n - len(uni)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC166_B.py
n,k=map(int,input().split())
sunuke=[0]*n
for i in range(k):
  d=int(input())
  # d-=1
  a=list(map(int,input().split()))
  for aa in a:
    sunuke[aa-1]+=1
# print(sunuke)
ans=0
for ss in sunuke:
  if ss==0:
    ans+=1
print(ans)