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:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
tmp=n3(k*2)
d=tmp[::2]
A=tmp[1::2]

a=[]
for line in A:
    a.extend(line)
print(n-len(set(a)))

Submission status: Accepted

Solution code:
import sys
n, k = map(int, sys.stdin.readline().split())
s = set()
for _ in range(k):
  d = int(sys.stdin.readline())
  li = list(map(int, sys.stdin.readline().split()))
  for i in li:
    s.add(i)
print(n-len(s))

Submission status: Accepted

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

a_new=set(sum(a, []))

b=[]
for i in range(n):
    b.append(i+1)
b_new=set(b)

print(len(b_new-a_new))

Submission status: Accepted

Solution code:
def main():

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

    Z = set()

    for _ in range(K):
        _ = int(input())
        Ad = map(int, input().split())

        Z |= set(Ad)

    print(N - len(Z))


main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
#from fractions import gcd
from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    n, k = map(int, input().split())
    d = [None] * k
    A = [None] * k
    for i in range(k):
        d[i] = int(input())
        A[i] = map(int, input().split())

    N = [True] * n
    for i in range(k):
        for a in A[i]:
            N[a-1] = False
    print(sum(N))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

cnt=0
for flag in check:
    if not flag:
        cnt+=1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

snuke = [0 for i in range(N)]

for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for j in A:
    snuke[j-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())
okashi_set = set([])
for i in range(K):
    d_i = int(input())
    A_d = list(map(int, input().split()))
    for A_d_j in A_d:
        okashi_set.add(A_d_j)
print(N-len(okashi_set))

Submission status: Accepted

Solution code:
import sys

if __name__ == '__main__':
    n, k = list(map(lambda x: int(x), sys.stdin.readline().split(' ')))
    lst = [0 for i in range(n)]
    for i in range(k):
        d = int(sys.stdin.readline())
        p = list(map(lambda x: int(x), sys.stdin.readline().split(' ')))
        for i in p:
            lst[i-1] += 1
    print(sum([1 if x == 0 else 0 for x in lst]))

Submission status: Accepted

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

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

a = set(a)
ans = 0

for i in range(1, n+1):
    if i not in a:
        ans += 1

print(ans)

Submission status: Accepted

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

ans = [1] * n

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

    for i in a:
        ans[i-1] = 0

print(sum(ans))

Submission status: Accepted

Solution code:
N, K = map( int, input().split() )
            
A = list()
for kk in range(K):
    dk = int( input() )
    Ak = [ int(x) for x in input().split() ]
    for ak in Ak:
        A.append(ak)

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

Submission status: Accepted

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

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

D = [0] * N
for k in A:
    for i in k:
        D[i-1] += 1
res = 0
for i in D:
    if i == 0:
        res += 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N,K=map(int, sys.stdin.readline().split())
L=[ 1 for _ in range(N+1)]
L[0]=0
for _ in range(K):
    d=int(sys.stdin.readline().strip())
    A=map(int, sys.stdin.readline().split())
    for a in A:
        L[a]=0
print sum(L)

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
sweet = [0]*N
for i in range(K):
    num = int(input())
    people = [int(i) for i in input().split()]
    for p in people:
        sweet[p-1] += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

ans = 0
for sunuke in table:
    if sunuke == 0:
        ans += 1

print(ans)

Submission status: Accepted

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

s = set()
for i in range(K):
    d = int(input())
    a_list = list(map(int, input().split()))
    for a in a_list:
        s.add(a)


print(N - len(s))

Submission status: Accepted

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

for i in range(K):
    d = int(input())
    li = map(int, input().split())
    for l in li:
        A[l - 1] += 1

print(A.count(0))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(n-len(li))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n, k = map(int, input().split())
    d = [0] * k
    a = [0] * k
    ans = [i for i in range(1, n +1)]
    A = set()
    for i in range(k):
        d[i] = int(input())
        A |= set(map(int, input().split()))
    for i in A:
        ans.remove(i)
    print(len(ans))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
sysread = sys.stdin.readline

def run():
    N,K = map(int, sysread().split())
    d = []
    A = []
    for i in range(K):
        d.append(int(sysread()))
        A.append(list(map(int, sysread().split())))
    persons = [False] * (N + 1)
    for a in A:
        for k in a:
            persons[k] = True
    print(persons[1:].count(False))

if __name__ == "__main__":
    run()

Submission status: Accepted

Solution code:
from collections import Counter
def main():
    N, K = [int(x) for x in input().split()]
    counter = Counter()
    for _ in range(K):
        _ = input()
        counter += Counter([int(x) for x in input().split()])

    ans = 0
    for x in range(1, N+1):
        if counter[x] == 0:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict
n, k = map(int, input().split())
a = [[] for _ in range(k)]
cnt = defaultdict(int)

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

for i in range(k):
    for x in a[i]:
        cnt[x] += 1

print(n - len(cnt))

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
A = list(range(1,N+1))
S = set()
for _ in range(K):
    d = int(input())
    I = list(map(int, input().split()))
    for i in range(d):
        S.add(I[i])

print(len(A)-len(S))

Submission status: Accepted

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

def solve(N, K, D, A):
    c = [False for i in range(N+1)]
    for i in range(K):
        for a in A[i]:
            c[a] = True
    ans = sum([1 for x in c[1:] if not x])
    return ans
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))

Submission status: Accepted

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

for i in range(k):
  d = input()
  A =  list(map(int, input().split()))
  for a in A:
    ans[a-1] += 1
    
li = list()
for i, num in enumerate(ans):
  if num == 0:
    li.append(i)
    
print(len(li))

Submission status: Accepted

Solution code:
inp=input
li=list
iinp=lambda : int(inp())
ent=lambda : map(int,inp().split())
lient=lambda : [int(i) for i in inp().split()]
li0= lambda x: [0 for i in range(x)]
livalor=lambda valor,x: [valor for i in range(x)]
stent=lambda : [i for i in inp()]
filldp=lambda valor,x,y: [[valor for i in range(y)] for i in range(x)]

cantsnukes,cantdulces=ent()
personas=[0 for i in range(cantsnukes)]
for i in range(cantdulces):
    cant=iinp()
    numeros=lient()
    for i in numeros:
        personas[i-1]+=1
res=0
for i in personas:
    if i==0: res=res+1
print(res)

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

s = set(sum(A,[]))
print(n - len(s))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n_nin,okasi=map(int,input().split())
okasi_have=[0]*n_nin
for i in range(1,okasi+1):
    di=int(input())
    ai_list=list(map(int,input().split()))
    for j in ai_list:
        okasi_have[j-1]+=1
    
print(okasi_have.count(0))

Submission status: Accepted

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

ALL = set()
for _ in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for a in A:
        ALL.add(a)
cnt = 0

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

Submission status: Accepted

Solution code:
n, k = map(int, input().split())
se = set()
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for aa in a:
        se.add(aa)

print(n-len(se))

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 ai in a:
        ans[ai-1] = 1

print(n-sum(ans))

Submission status: Accepted

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

Submission status: Accepted

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

import sys

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    n, k = read_list(int)
    snukes = [0] * n
    for _ in range(k):
        read(int)
        for a in read_list(int):
            snukes[a - 1] += 1
    
    print(len([0 for s in range(n) if snukes[s] == 0]))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(n-len(set(tmp)))

Submission status: Accepted

Solution code:
import numpy as np

n, k = map(int, input().split())
p = np.ones(n)
for i in range(k):
    d = int(input())
    a = np.array(input().split(), dtype=np.int64) -1
    p[a] = 0
ans = np.count_nonzero(p)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

sunuke = [1]*n
for i in range(k):
    for j in range(len(a_l[i])):
        num = a_l[i][j]
        sunuke[num-1] = 0

ans = 0
for val in sunuke:
    ans += val
print(ans)

Submission status: Accepted

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

ans = [False] * N

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

    for i in a:
        ans[i-1] = True

print(ans.count(False))

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

hito = [i+1 for i in range(n)]
for i in a:
    for j in i:
        if j in hito:
            hito.remove(j)

print(len(hito))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = [1]*N

for _ in range(K):
	d = INT()
	a = LIST()
	for i in range(len(a)):
		A[a[i]-1] = 0


print(sum(A))

Submission status: Accepted

Solution code:
def resolve():
    n, k = map(int, input().split())
    sunuke = set()
    for i in range(k):
        input()
        for men in list(map(int, input().split())):
            sunuke.add(men)

    print(n - len(sunuke))
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import log2,floor,ceil,sqrt
# import bisect
# from collections import deque

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

n,k  = Ri()
s = set([i+1 for i in range(0,n)])
for i in range(k):
    val = int(ri())
    temp  = Ri()
    for j in temp:
        if j in s:
            s.remove(j)
print(len(s))

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()))
su = [1] * n
for i in range(k):
    for j in range(d[i]):
        if su[a[i][j]-1] == 1:
            su[a[i][j]-1] = 0
print(sum (su))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = [int(i) for i in input().split()]
n = x[0]
k = x[1]
ans =[]
for i in range(k):
    a = int(input())
    b = [int(i) for i in input().split()]
    ans = ans + b
print(n-len(set(ans)))

Submission status: Accepted

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

for x in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for y in A:
        sunuke[y - 1] += 1
print(sunuke.count(0))

Submission status: Accepted

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

B = []

for _ in range(K):
    d = int(input())
    B += list(map(int, input().split()))

B = list(set(B))

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, k = input_to_int_map()

    a_list = []
    for i in range(k):
        ninsu = int(input())
        a_list.append(set(map(int, input().split())))

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

    ret = all_sunukes
    for a in a_list:
        ret -= a

    return len(ret)


if __name__ == "__main__":
    print(main())

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 i in range(d):
        ans[A[i]-1]+=1
print(ans.count(0))

Submission status: Accepted

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

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

Submission status: Accepted

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

for _ in range(k):
    d = int(input())
    a = set(map(int, input().split()))
    s |= a
print(n - len(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
ns = [0] * N
for k in range(K):
    input()
    a_arr = list(map(int, input().split()))
    for a in a_arr:
        ns[a-1] += 1

print(sum([1 for n in ns if n == 0]))

Submission status: Accepted

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

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

Submission status: Accepted

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

no_okashi = [1 for ok in okashi if ok == 0]

print(len(no_okashi))

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N, K = LI()
    d = []
    A = []
    for i in range(K):
        d.append(I())
        A.append(LI_())

    snuke = [False]*N
    ans = 0
    for i in A:
        for j in i:
            snuke[j] = True

    print(len([i for i in snuke if not i]))
        
if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

s = [0]*n

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

num = s.count(0)
print(num)

Submission status: Accepted

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

Victims = [True] * N

for _ in range(K):
    Snack = int(input())
    Snukes = list(map(int, input().split()))
    for snuke in Snukes:
        Victims[snuke - 1] = False

print(Victims.count(True))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B
N,K = map(int,input().split())
d=[]
A = [0]*N
for x in range(K):
    _ = int(input())
    t = list(map(int, input().split()))
    for y in t:
        A[y-1]=1
ans = N-sum(A)
print(ans)

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N, K = input_number_list()
    ls = [0] * N

    for i in range(K):
        d = input_number()
        L = input_number_list()
        for l in L:
            ls[l - 1] = 1
    print(ls.count(0))


if __name__ == '__main__':
    main()

Submission status: Accepted

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


# 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():
    # Failed to predict input format
    pass

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

    cnt = 0
    for snuke in snukes:
        if snuke==0:
            cnt += 1

    print(cnt)
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


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

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

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

    for a in A:
        for i in a:
            sunuke.discard(i)

    print(len(sunuke))





if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,k = map(int,input().split())
l = list(0 for i in range(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:
#import itertools
#K = int(input())
N,K = map(int,input().split())
n=[a for a in range(1,N+1)]
c=[]
for i in range(K):
    d = int(input())
    A = list(map(int,input().split()))
    for j in A:
            if j in n and j not in c:
                c.append(j)

#N = str(input())
print(len(n)-len(c))

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
data = []
for i in range(K):
    dami = int(input())
    data.extend(list(map(int,input().split())))
dataset = set(data)
print(N-len(dataset))

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    n, k = map(int, input().split())
    buckets = [0 for x in range(n+1)]
    for i in range(k):
        d = input()
        a = [int(x) for x in input().split()]
        for item in a:
            buckets[item] += 1
    print(buckets.count(0) - 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = map(int,input().split())
all_snuke = [0] * N
have_snuke = []
for i in range(K) :
    d = int(input())
    li = [i for i in input().split()]
    for snuke in li :
        if (snuke not in have_snuke) :
            have_snuke.append(snuke)
    
print(len(all_snuke) - len(have_snuke))

Submission status: Accepted

Solution code:
import numpy as np
import sys
import math
read = sys.stdin.readline

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

ans = [1] * n

for a in A:
    for j in a:
        ans[j-1] = 0

print(sum(ans))