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

dic = {}
for i in range(K):
    _ = int(input())
    A = list(map(int, input().split()))
    for a in A:
        if not a in dic:
            dic[a] = 1

ans = 0
for i in range(1, N+1):
    if not i in dic:
        ans += 1
print(ans)

Submission status: Accepted

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

print(flag.count(0))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
D = []
A = []
result = []
for i in range(K*2):
    if i % 2 == 0:
        d = int(input())
        D.append(d)
    else:
        a = list(map(int, input().split()))
        A.append(a)

for a in A:
    for b in a:
        result.append(b)

print(N-len(set(result)))

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
d = [list(map(int,input().split())) for _ in range(2*K)]
D = []
ans = 0
for i in range(K):
    k = d[2*i +1]
    for j in k:
        if j not in D:
            D.append(j)

ans = N-len(D)
print(ans)

Submission status: Accepted

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

d = []
A = []
for i in range(2*K):
    if i % 2 == 0:
        d.append(int(dA[i][0]))
    else:
        A.append(dA[i])

A2 = []
for i in range(K):
    for j in range(len(A[i])):
        A2.append(A[i][j])
sets = set(A2)
print(N-len(sets))

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
s = [0] * n
for _ in range(k):
    input()
    for a in map(int, input().split()):
        s[a - 1] += 1
print(sum(1 for c in s if c == 0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy

n,k = map(int,input().split(" "))
d = []
a = []
tmp = numpy.zeros(n)
for i in range(k):
    d.append(int(input()))
    a.append([int(e) for e in input().split(" ")])

for i,dd in enumerate(d):
    for j in range(dd):
        tmp[a[i][j]-1] += 1

print(sum(tmp==0))

Submission status: Accepted

Solution code:
def main():
  n, k = map(int,input().split())
  params = [1]*n
  
  for _ in range(k):
    input()
    tmp = map(int, input().split())
    for i in tmp:
      params[i-1] = 0
  
  return sum(params)

print(main())

Submission status: Accepted

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

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

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

lst = []
for v in A:
	for j in range(len(v)):
		lst.append(v[j])

lst = set(lst)

print(n - len(lst))

Submission status: Accepted

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

Submission status: Accepted

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

d = list()

A_list = list()

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

count = [0]*n

for a in A_list:
    for b in a:
        count[b-1] += 1

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

Submission status: Accepted

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

print(n - len(set(lst)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#b
n,k =map(int, input().split())
sp = [input().split() for _ in range(k*2)]
get = []
for i in range(1,len(sp),2):
    for j in range(len(sp[i])):
        get.append(sp[i][j])
result = list(set(get))
print(n-len(result))

Submission status: Accepted

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


def solve(N, K, A):
    s = set()
    for a in A:
        for x in a:
            s.add(x)
    print(N - len(s))
    return

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))
    K = int(next(tokens))
    A = [[] for _ in range(K)]
    for i in range(K):
        d = int(next(tokens))
        for j in range(d):
            A[i].append(int(next(tokens)))
    solve(N, K, A)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,k=map(int, input().split())
l1=[]
for i in range(k):
    x=int(input())
    l=list(map(int, input().split()))
    for i in l:
        l1.append(i)
s=set(l1)
print(n-len(s))

Submission status: Accepted

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

print(snuke.count(False))

Submission status: Accepted

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

for k in range(1, K+1):
    d = input()
    l = list(map(int, input().split()))
    ans.extend(l)
ans = list(set(ans))
print(N-len(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = [int(x) for x in input().split()]
d = [0]*N
B = []
for n in range(K):
    i = int(input())
    A = [int(x) for x in input().split()]
    for j in range(i):
        B.append(A[j])
print(N-len(set(B)))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
D = []
A = []
for k in range(K):
    D.append(int(input()))
    A.extend(list(map(int, input().split())))

print(len(set(range(1, N+1)) - set(A)))

Submission status: Accepted

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

print(n-len(A))

Submission status: Accepted

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

Submission status: Accepted

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

okashi_count = list()

for p in range(N):
    okashi_count.append(0)

non_holder = 0

for n in range(K):
    _ = input()
    S = list(map(int, input().split()))
    for s in S:
        okashi_count[int(s) - 1] += 1

for l in okashi_count:
    if l == 0:
        non_holder += 1

print(non_holder)

Submission status: Accepted

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

sunuke = [0]*n

for i in range(k):
    x = int(input())
    l = map(int,input().split())
    for s in l:
        sunuke[s-1] += 1

print(sunuke.count(0))

Submission status: Accepted

Solution code:
from collections import Counter as counter

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########

n,k = mi()
res = 0
a = []
for i in range(k):
    d = input()
    a.extend(mi())
c = counter(a)
for i in range(1,n+1):
    if c[i] == 0: res+=1
print(res)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
d_lis = []
person_lis = []
ans_lis = []
ans = []

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

#print(person_lis)
for people in person_lis:
    for person in people:
        if person in ans_lis:
            pass
        else:
            ans_lis.append(person)
#print(ans_lis)
for i in range(1, n+1):
    if i in ans_lis:
        pass
    else:
        ans.append(i)
print(len(ans))

Submission status: Accepted

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

for i in range(K) :
    cnt.extend(A[i])

print(N - len(set(cnt)))

Submission status: Accepted

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

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
print(sum(v==0 for v in sunuke))

Submission status: Accepted

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

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

for d in ds:
    tmp = set(d[1])
    s = s-tmp


ans = len(s)
print(ans)

Submission status: Accepted

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

for i in range(k):
	d = int(input())
	s = list(map(int, input().split()))
	for j in range(d):
#		print("  ",j,s[j])
		dpa[s[j]] = 1

#print(len(dpa))
print(n-len(dpa))

Submission status: Accepted

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

for row in range(k):
    for column in d_lst[row]:
        cookie[column-1] += 1

print(cookie.count(0))

Submission status: Accepted

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

s = [False] * n

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

ans = 0
for t in s:
    if t == False:
        ans += 1

print(ans)

Submission status: Accepted

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

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

for i in range(k):
    d = int(input())
    line = [int(s) - 1 for s in input().split()]
    
    for a in range(d):
        snack[line[a]] += 1

print(snack.count(0))

Submission status: Accepted

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

Submission status: Accepted

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

ss = set()

for i in range(1, k*2+1):
  #print(i)
  if i%2==1:
    input()#print('d', i//2+1, ': ', input())
  else:
    for s_i in map(int, input().split()):
      #print('s_i: ', s_i)
      ss.add(s_i)
#print(ss)
print(len([s for s in range(1, n+1) if s not in ss]))

Submission status: Accepted

Solution code:
def solution():
    n, k = map(int, input().split())
    s = [0]*n
    for i in range(k):
        d = int(input())
        a = [int(ss) for ss in input().split()]
        for aa in a:
            s[aa - 1] += 1

    print(s.count(0))

solution()

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
dl=[]
ul=[]
for i in range(k):
    dl.append(int(input()))
    f=list(map(int,input().split()))
    ul.extend(f)
res=0
for i in range(1,n+1):
    if not i in set(ul):
        res+=1
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
ans = n
dic = {}

for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        if a[j] not in dic.keys():
            dic[a[j]] = True
            ans -= 1
print(ans)

Submission status: Accepted

Solution code:
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

####

def solve(N, K, A):
    snackless = set(range(1, N+1))
    for row in A:
        for x in row:
            snackless.discard(x)
    return len(snackless)

N,K = rrm()
A = []
for _ in xrange(K):
    rri()
    A.append(rrm())
print solve(N, K, A)

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
d_list = list()
s = set()
for i in range(k):
    d_list.append(int(input()))
    s |= set(list(map(int, input().split())))

print(n - len(s))

Submission status: Accepted

Solution code:
def main(N, K, d, A):
    a = list(set(sum(A, [])))
    print(N - len(a))

if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    d = []
    A = []
    for i in range(K):
        d.append(int(input()))
        A.append(list(map(int, input().split())))
    main(N, K, d, A)

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in lists:
    for j in i:
        listb[j-1] -= 1
    
cnt = 0

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

Submission status: Accepted

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

sunuke = [0 for _ in range(N)]
D = []
A = [[] for _ in range(K)]
for k in range(K):
    D.append(int(input()))
    A[k] = list(map(int, input().split()))
    for a in A[k]:
        sunuke[a-1] += 1

print(sunuke.count(0))

Submission status: Accepted

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

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

print(n - len(ans))

Submission status: Accepted

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


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

for i in range(K):
    syu  = A[i]
    for j in syu:
        kan[j-1] = -1


print(kan.count(0))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

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

s = set()

for i in range(0, K):
    d = int(input())
    As = map(int, input().split())
    for a in As:
        s.add(a)

# print(s)
# print(len(s))
print(N - len(s))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(K):
    input()
    l = map(int, input().split())
    s = s.union(set(l))

print(len(set(range(1, N + 1)).difference(s)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    N, K = map(int, input().split())
    SW = [0]*N
    for i in range(K):
        d = int(input())
        A = list(map(int, input().split()))
        for j in range(d):
            SW[A[j]-1] += 1
    CNT = 0
    
    for i in SW:
        if i == 0:
            CNT += 1
    print(CNT)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
sunuke=[]
for i in range(K):
  di=int(input())
  A=list(map(int,input().split()))
  for j  in range(di):
    if A[j] not in sunuke:
      sunuke+=[A[j]]
ans=N-len(sunuke)

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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

    d = [True]*N
    for K in range(K):
        dl = input()
        A = list(map(int, input().split()))
        for a in A:
            d[a-1] = False
    print(sum(d))




if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

    for j in range(l):
        if a[j] not in dic:
            dic.append(a[j])
        else:
            pass
    a.clear()

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

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.append(list(map(int, input().split())))
nonhave_list = []

for j in range(n):
    for l in range(k):
        exist = False
        if j+1 in a_list[l]:
            exist = True
            break
    if not exist:
        nonhave_list.append(j)

print(len(nonhave_list))

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())
  List=list(map(int,input().split()))
  for j in List:
    ans[j-1] += 1
    
cnt = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(A.count(0))

Submission status: Accepted

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

ans = [0]*(n+1)
# print(ans)

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

# print(d)
# print(A)

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

b = [1 for x in ans[1:] if x == 0]

print(sum(b))

Submission status: Accepted

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

Submission status: Accepted

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

Snack = [0] * N

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

    for j in range(d):
        Snack[A[j]-1] += 1
    
sum = 0
for i in range(N):
    if (Snack[i] == 0):
        sum += 1

print(sum)

Submission status: Accepted

Solution code:
import collections

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

res = []

for _ in range(k):
  s = int(input())
  ss = list(input().split())
  for i in ss:
      res.append(i)

c = collections.Counter(res)
print(n - len(c))

Submission status: Accepted

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

for i in range(k):
    l = len(a[i])
    for j in range(l):
        s[a[i][j]] += 1

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

Submission status: Accepted

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

sunukeList = [0] * N
for holder in A:
    for sunuke in holder:
        sunukeList[sunuke-1] += 1

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

Submission status: Accepted

Solution code:
from sys import stdin

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

okashimap = {}

for i in range(1,k+1):
    d = int(stdin.readline().rstrip())
    an = list(map(int, input().split()))
    for j in range(d):
        okashimap[an[j]] = True 

trick = [x for x in range(1,n+1) if x not in okashimap.keys()]
print(len(trick))

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
#a=input()
li=[0]*a
for i in range(b):
    a=input()

    li1=list(map(int,input().split()))
    for n in li1:
        li[n-1]+=1
print(li.count(0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
X=[]
for i in range(k):
  d = int(input())
  X += list(map(int, input().split()))
Y=set(range(1, n+1))
Z=Y-set(X)
print(len(Z))

Submission status: Accepted

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

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

print(B.count(0))

Submission status: Accepted

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

from collections import Counter

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

s=set()

for i in range(K):
    d_i = int(input())
    snuke = set(list(map(int,input().split())))

    s=s|snuke

s_diff = snuke_s - s

print(len(s_diff))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
itazura = list(range(1,n+1))
for i in range(k):
    di = input()
    Ai = list(map(int,input().split()))
    for one in Ai:
        if one in itazura:
            itazura.remove(one)
print(len(itazura))

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()))
    a += A
print(n-len(set(a)))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-05-03 21:03:15 +0900
# LastModified: 2020-05-03 21:09:37 +0900
#


import os
import sys


def main():
    n,k=map(int,input().split())
    child=[0]*n
    for i in range(k):
        d = int(input())
        a = list(map(int,input().split()))
        for a_ in a:
            child[a_-1]=1
    print(child.count(0))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
d = 0
A = []
l = [1]*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] = 0
    
print(sum(l))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
D=[]
SUN=[i for i in range(1,N+1)]
for i in range(K):
    D.append(int(input()))
    A=list(map(int,input().split()))
    for j in A:
        if j in SUN:
            SUN.remove(j)

print(len(SUN))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

d = 0
A = set()

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

print(N-len(A))

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.append(list(map(int, input().split())))
n_list = []
for i in range(n):
	n_list.append(i+1)
for a_s in a_list:
	if len(n_list) == 0:
		break
	for a in a_s:
		if a in n_list:
			n_list.remove(a)
print(len(n_list))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce

MOD = 10**9 + 7
INF = float('inf')

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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


print(ans)

Submission status: Accepted

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

for i in range(K*2):
    if i % 2 == 0:
        d.append(int(input()))
    else:
        A.append(list(map(int, input().split())))

m = []
for n in range(1, N+1):
    m.append(n)

for a in A:
    for aa in a:
        if aa in m:
            m.remove(aa)

print(len(m))

Submission status: Accepted

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

Submission status: Accepted

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

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

m = set(range(1,n+1))
rest = m - sets
print(len(rest))

Submission status: Accepted

Solution code:
def main():
    n,k = map(int, input().split())
    array = []
    for i in range(k):
        _ = input()
        array.extend(map(int,input().split()))
    array = set(array)
    ans = 0
    for i in range(1,n+1):
        if i in array:
            continue
        else:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
l=[]
for i in range(k):
    d=int(input())
    a=list(map(int,input().split()))
    for j in a:
        if  j not in l:
            l.append(j)
print(n-len(l))

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 j in A:
        l[j-1]=0
print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ls = [0 for i in range(N+1)]
for i,a in enumerate(A):
  for j in range(d[i]):
    ls[a[j]]=1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
dict = {}
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    # print(d)
    for i in a:
        # print(i)
        if i in dict:
            dict[i] = dict[i] + 1
        else:
            dict[i] = 1
# print(dict)
# print(len(dict.keys()))
print(n - len(dict.keys()))

Submission status: Accepted

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

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

print(s.count(0))

Submission status: Accepted

Solution code:
from collections import Counter
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


ac = Counter(ans)

print(ac[0])