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(n):
	dic[i+1]=0
for _ in range(k):
	f=input()
	a=list(map(int,input().split()))
	for j in a:
		dic[j]+=1
ans=0
# print(dic)
for i in dic:
	if(dic[i]==0):
		ans+=1
print(ans)

Submission status: Accepted

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

list_n=[]
for i in range(1,N+1):
    list_n.append(i)
    
t=[]
for i in range(K):
    d=int(input())
    s=list(map(int,input().split()))
    t+=s
    
s=list(set(t))
s.sort()

cnt=0
for i in list_n:
    if i not in s:
        cnt+=1
        
print(cnt)

Submission status: Accepted

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


for _ in range(K):
    tmp = int(input())
    kashi += tuple(map(int, input().split()))
print(N - len(set(kashi)))

Submission status: Accepted

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


for _ in range(K):
    tmp = int(input())
    for j in tuple(map(int, input().split())):
        kashi.append(j)
        
print(N - len(set(kashi)))

Submission status: Accepted

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

for _ in range(K):
    tmp = int(input())
    for j in list(map(int, input().split())):
        kashi.append(j)
        
print(N - len(set(kashi)))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(K):
  temp = int(input())
  person = input()
  person = person.split()
  for j in range(len(person)):
    data[int(person[j]) - 1] += 1

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

print(count)

Submission status: Accepted

Solution code:
import itertools
N,K=map(int,input().split())
l=[0]*N
n=0
for i in range(K):
  d=int(input())
  have=list(input().split())
  for j in have:
    l[int(j)-1]=1

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
sunuke = set(i for i in range(1, N+1))
given =set()
for i in range(K):
    di = map(int, input().split())
    gi = set(map(int, input().split()))
    given = given | gi

itazura = N - len(given)
print(itazura)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools

n, k = map(int, input().split())
a = []
for i in range(k):
    di = int(input())
    ai = list(map(int, input().split()))
    a.append(ai)

count = [0] * (n+1)
for i in range(k):
    for j in range(len(a[i])):
        count[a[i][j]] += 1

print(count.count(0)-1)

Submission status: Accepted

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

print(a.count(0))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
first_line = list(map(int, input().split()))
N = first_line[0]
K = first_line[1]
rest = list(range(1, N+1))
for i in range(K):
  d = int(input())
  given = list(map(int, input().split()))
  for j in range(1, N+1):
    if j in given and j in rest:
      rest.remove(j)

print(len(rest))

Submission status: Accepted

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

for i in child:
    for j in range(K):
        for k in range(d[j]):
            if i == int(A[j][k]):
                non_child.remove(i)
                break
        else:
            continue
        break

print(len(non_child))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
D=[]
A=[]
for i in range(K):
    d=int(input())
    D.append(d)
    Ai=[int(x) for x in input().split()]
    A.append(Ai)
NUMBERS=[int(x) for x in range(1,N+1)]
for i in range(K):
    for j in range(D[i]):
        if A[i][j] in NUMBERS:
            NUMBERS.remove(A[i][j])
        else:
            pass
print(len(NUMBERS))

Submission status: Accepted

Solution code:
#AtCorder Beginer Contest 166 B - Trick or Treat
N,K= map(int, input().split())
Sunuke={}
for i in range(K):
    dn = int(input())
    Having_List =list(map(int,input().split()))
    for Having in Having_List:
        if Having not in Sunuke:
            Sunuke[Having]=1 
    
print(N-len(Sunuke))

Submission status: Accepted

Solution code:
total,okasi=map(int,input().split())
sunuke=[]
for i in range(okasi):
  d=int(input())
  A=list(map(int,input().split()))
  for a in A:
    sunuke.append(a)
    
    
ans=total-len(set(sunuke))
 
print(ans)

Submission status: Accepted

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

sunuke = []

for i in range(K_ko):
    d = int(input())
    A = list(map(int, input().split()))
    
    for a in A:
        sunuke.append(a)


ans = N_nin - len(set(sunuke))

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 標準入力の取得
N, K = list(map(int, input().split()))
d = []
A = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))


def main() -> None:
    """Entry point
    """
    # 求解処理
    # お菓子を持っているすぬけ君の人数を全体から引く
    persons = set()
    for A_i in A:
        for A_ij in A_i:
            persons.add(A_ij)

    result = N - len(persons)

    # 結果出力
    print(result)


if __name__ == "__main__":
    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())))

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

for i in range(k):
    n_all = n_all - set(a[i])
print(len(n_all))

Submission status: Accepted

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

con = 0
ans = list(int() for _ in range(10001))
pre = 0


for _ in range(K):

    D = int(input())
    arr = list(map(int,input().split()))

    for j in range(D):

        ans[pre+j]=arr[j]

    pre += D

        
fin = (N+1) - len(set(ans))

print(fin)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n, k = readmi()
d = [0] * n
for i in range(k):
    t = readi()
    p = readl()
    for j in p:
        d[j - 1] = 1

print(n - sum(d))

Submission status: Accepted

Solution code:
N, K = (int(num) for num in input().split(" "))
cnt = 0
dic = {i+1: 0 for i in range(N)}
while cnt < K:
    d = input()
    a = input().split(" ")
    for n in a:
        dic[int(n)] += 1
    cnt += 1

treated = 0
for key in dic:
    if dic[key] == 0:
        treated += 1
print(treated)

Submission status: Accepted

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

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


print(n - len(ans))

Submission status: Accepted

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

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

ans = sum([c == 0 for c in check])
print(ans)

Submission status: Accepted

Solution code:
from copy import copy
from functools import reduce
    
class Sunuke:
    def __init__(self):
        self.has_snack = False
    
n_sunuke, n_v_snacks = [int(s) for s in input().split()]
    
all_sunuke = [copy(Sunuke()) for i in range(n_sunuke)]
    
for snack_id in range(n_v_snacks):
    n_snacks = int(input())
    for sunuke_id in (int(s) for s in input().split()):
        all_sunuke[sunuke_id - 1].has_snack = True
    
print(reduce(lambda n,s: n + (0 if s.has_snack else 1), all_sunuke, 0))

Submission status: Accepted

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

N1 = N +1
for o in range(1,N+1):
    D.append(o)
    
#print(D)


for i in range(K):
    A =int(input())
    C.append(A)
    B =list(map(int,input().split()))
    for z in B:
        for j in D:
            if j ==z:
                D.remove(j)

#print(D)
                
                
                
#print(E)
print(len(D))

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
N, K = map(int, input().split())
uid_list = []
for _ in range(K):
   input()
   for uid in [int(i) for i in input().split()]:
       uid_list.append(uid)
print(N - len(set(uid_list)))

Submission status: Accepted

Solution code:
from collections import defaultdict

N, K = list(map(int, input().split()))
d = {}
for i in range(1, N+1):
    d[i] = []
for k in range(1, K+1):
    input()
    for i in map(int, input().split()):
        d[i].append(k)
count = 0
for i in range(1, N+1):
    if len(d[i]) == 0:
        count += 1
print(count)

Submission status: Accepted

Solution code:
a = 1;
treat = 0;
n, k = map(int, input().split());
 
data = list(input().split() for l in range(2*k))
 
 
while a <= n:
    b = 0;
    d = 0;
    
    while b < k:
        search = int(data[2*b][0]);
        c = 0;
        
        while c < search:
            x = int(data[2*b+1][c]);
            if x == a :
                d = d + 1;
            c = c + 1
            
        b = b + 1;
        
    if d == 0:
        treat = treat + 1;
        
    a = a + 1;
 
print(treat);

Submission status: Accepted

Solution code:
from __future__ import annotations

import unittest
from dataclasses import dataclass, field
from typing import List


@dataclass
class Sweet:
    id: int


@dataclass
class User:
    id: int
    sweets: List[Sweet] = field(default_factory=list)

    def register_sweet(self, sweet: Sweet) -> None:
        if sweet not in self.sweets:
            self.sweets.append(sweet)

    def has_no_sweets(self) -> bool:
        return len(self.sweets) == 0


@dataclass(frozen=True)
class Users:
    values: List[User] = field(default_factory=list)

    def add(self, user: User) -> Users:
        return Users(self.values + [user])

    def __len__(self) -> int:
        return len(self.values)

    def __getitem__(self, index: int) -> User:
        return self.values[index]

    @classmethod
    def create(cls, num_people: int) -> Users:
        return Users([User(id=i) for i in range(1, num_people + 1)])

    def count_users_has_no_sweets(self) -> int:
        return len([user for user in self.values if user.has_no_sweets()])

    def find_by(self, user_id: int) -> User:
        idx = user_id - 1

        return self.values[idx]


def answer(num_people: int, sweet_id_list: List[int], sweets_distribute_list: List[List[int]]):
    users = Users.create(num_people)

    for sweet_id, distribute_list in zip(sweet_id_list, sweets_distribute_list):
        sweet = Sweet(id=sweet_id)

        for user_id in distribute_list:
            user = users.find_by(user_id)
            user.register_sweet(sweet)

    return users.count_users_has_no_sweets()

  
  
num_people, num_sweets = map(int, input().split())

sweet_id_list = []
sweets_distribute_list = []
for i in range(num_sweets):
	d = int(input())
	sweet_id_list.append(d)
	has_list = list(map(int, input().split()))
	sweets_distribute_list.append(has_list)

print(answer(num_people, sweet_id_list, sweets_distribute_list))

Submission status: Accepted

Solution code:
from dataclasses import dataclass, field
from typing import List


@dataclass
class Sweet:
    number: int


@dataclass
class User:
    number: int
    sweets: List[Sweet] = field(default_factory=list)

    def hoge(self):
        return [u.number for u in self.sweets]


def answer(num_people: int, num_sweets: int, d_list: List[int], okasi_list: List[List[int]]):
    user_list = [User(number=i) for i in range(1, num_people + 1)]

    for d, who_has_list in zip(d_list, okasi_list):
        for idx in who_has_list:
            user = user_list[idx - 1]
            user.sweets.append(Sweet(number=d))

    x = [len(u.sweets) for u in user_list]

    return x.count(0)

  
  
num_people, num_sweets = map(int, input().split())

d_list = []
okasi_list = []
for i in range(num_sweets):
	d = int(input())
	d_list.append(d)
	has_list = list(map(int, input().split()))
	okasi_list.append(has_list)
# print(num_people, num_sweets)
# print(d_list)
# print(okasi_list)

print(answer(num_people, num_sweets, d_list, okasi_list))

Submission status: Accepted

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

has_cookie = []
for i in range(k):
  cookie_num = int(input())
  has_cookie.extend(list(map(lambda x: int(x), input().split(' '))))

has_cookie = list(set(has_cookie))

print(n - len(has_cookie))

Submission status: Accepted

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

d_list = []
A_set = set()

for _ in range(K):
  d = int(input())
  d_list.append(d)
  
  A = map(int, input().split())
  A_set = A_set | set(A)
  
print(N - len(A_set))

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(K):
  input()
  for x in input().split():
    people_list[int(x)-1] += 1
    
num = 0

for x in people_list:
  if(x == 0):
    num += 1
    
print(num)

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys

ip = lambda : sys.stdin.readline()
ipl = lambda : sys.stdin.readline().split()

n, k = map(int, ipl())
snukes = [0 for i in range(n+1)]
for i in range(k):
	d = int(ip())
	snuke = list(map(int, ipl()))
	for s in snuke:
		snukes[s] = 1
c = 0
for i in snukes[1:]:
	if not i:
		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 range(d):
			if not A[j] in L:
				L.append(A[j])
x = len(L)
print(N - x)

Submission status: Accepted

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

se = set()

for i in range(k):
    a = input()
    li = list(map(int, input().split()))
    for j in range(len(li)):
        se.add(li[j])
print(n-len(se))

Submission status: Accepted

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

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

for k in range(K):
    hito_len = int(input())
    have_hito = list(map(int, input().split()))
    for hh in have_hito:
        have_snack[hh - 1] = 1

print(have_snack.count(0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = sum([c == 0 for c in count])
print(ans)

Submission status: Accepted

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

    having_candy = [False for _ in range(N)]

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

        for s in ds:
            having_candy[s-1] = True

    print(N - sum(having_candy))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(k):
    for j in range(d[i]):
        for m in range(n):
            if a[i][j] == m+1:
                get_flag[m] = 1
#print(get_flag)
count = 0
for i in range(len(get_flag)):
    if get_flag[i] == 0:
        count += 1
print(count)

Submission status: Accepted

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

d = []
A_set = set()

for i in range(K):
  d_i = int(input())
  A = list(map(int, input().split()))
  for j in A:
    A_set.add(j)

print(N - len(A_set))

Submission status: Accepted

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

print(len(p_list))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
LI=list(range(1,n+1))
kari=n+1
for i in range(1,k+1):
  d=int(input())
  li=list(map(int,input().split()))
  for x in range(1,n+1):
    if li.count(x)!=0:
      if LI.count(x)!=0:
        LI.remove(x)
print(len(LI))

Submission status: Accepted

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

for i in range(k):
    di = int(input())
    tmp =  map(int, input().split())
    for t in tmp:
        sunuke[t-1] = 0
print(sum(sunuke))

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 t in j:
        aa[t - 1] += 1

ans = 0

for z in aa:
    if z == 0:
        ans += 1
    else:
        ans += 0

print(ans)

Submission status: Accepted

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

sunuke_dict = {}
for i in range(K):
    input()
    okashi_sunukes = map(int, input().split())
    for okashi_sunuke in okashi_sunukes:
        sunuke_dict[okashi_sunuke] = ''

print(N - len(sunuke_dict))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
d=[[] for i in range(k)]
dlist=[]
memb=[i+1 for i in range(n)]
for i in range(k):
    d[i]=int(input())
    dklist=list(map(int,input().split()))
    dlist.append(dklist)
    for j in dklist:
        if j in memb:
            memb.remove(j)
print(len(list(memb)))

Submission status: Accepted

Solution code:
N,K = map(int,input().split(' '))
checkList = [1]*N

for i in range(K):
    d = input()
    aList = map(int,input().split(' '))
    for j in aList:
        checkList[j-1] = 0

print(sum(checkList))

Submission status: Accepted

Solution code:
N,K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()
  a = map(int, input().split(" "))
  for j in a:
    flag[j - 1] = 0
print(sum(flag))

Submission status: Accepted

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

rr = [0] * n

for i in range(k):
  d = map(int, input().strip().split())
  aa = map(int, input().strip().split())
  for a in aa:
    rr[a-1] += 1

print(sum(1 for r in rr if r == 0))

Submission status: Accepted

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

from typing import Iterable


def main() -> None:
    N, K = rmi()
    D, A = [], []
    for k in range(K):
        d = ri()
        D.append(d)
        A.append(rmi())
    target = [False] * N
    for k in range(K):
        for a in A[k]:
            target[a - 1] = True
    w(target.count(False))


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> int:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(data: Iterable) -> None:
    print(' '.join(data))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in range(K):
    G = int(input())
    S.extend(input().split())

print(N - len(set(S)))

Submission status: Accepted

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

for i in range(K):
    G += int(input())
    S.append(input().split())

A = []

for i in S:
    A.extend(i)

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

Submission status: Accepted

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

sunuke_set = set(sunuke_list)

print(len([x for x in range(1,N+1) if not(x in sunuke_set)]))

Submission status: Accepted

Solution code:
num_sunuke, num_okashi = map(int, input().split())

have_okashi_sunuke_dict = {}
for i in range(num_okashi):
    input()
    num_have_okashi_sunukes = map(int, input().split())
    for num_have_okashi_sunuke in num_have_okashi_sunukes:
        have_okashi_sunuke_dict[num_have_okashi_sunuke] = ''

print(num_sunuke - len(have_okashi_sunuke_dict))

Submission status: Accepted

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

sunuke = []
ans = 0
for n in range(s[0]):
  sunuke.append(0)
for n in range(s[1]):
  d = input()
  a = list(map(int, input().split()))
  for n2 in a:
    sunuke[n2-1] += 1
for n in sunuke:
  if n == 0:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N, K = list(map(int,input().split()))
snuke = set([i+1 for i in range(N)])
for k in range(K):
    _ = input()
    L = list(map(int,input().split()))
    snuke = snuke - set(L)
print(len(snuke))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

d_list = []
A_list = []
for _ in range(K):
    d_list.append(int(input()))
    tmp = list(map(int, input().split()))
    for a in tmp:
        A_list.append(a)

A_set = set(A_list)
print(N - len(A_set))

Submission status: Accepted

Solution code:
N,K=map(int,input().split())
A=[]
for i in range(K):
    di=int(input())
    Ai=list(map(int,input().split()))
    A.extend(Ai)
L=list(range(1,N+1))
count=0
for i in L:
    if A.count(i)==0:
        count=count+1
    else:
        continue
print(count)

Submission status: Accepted

Solution code:
# B
# Trick or Treat

N, K = map(int, input().split())
A = []
S = list(range(1,N+1))
for i in range(K):
    tmp_d = int(input())
    tmp_A = list(map(int, input().split()))
    A.extend(tmp_A)

unique_A = set(A)
for i in unique_A:
    S.remove(i)

print(len(S))

Submission status: Accepted

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

ls = [0] * n
for i in range(k):
    okasi = int(input())
    p = list(map(int, input().split()))
    for j in p:
        ls[j-1] += 1

sum = 0
for i in range(n):
    if ls[i] == 0:
        sum += 1

print(sum)

Submission status: Accepted

Solution code:
N, K = list(map(int, input().split()))
record = [0 for i in range(N)]
grid = []
for i in range(2*K):
    array = list(map(int, input().split()))
    grid.append(array)

for i in range(K):
    for j in range(grid[i * 2][0]):
        record[grid[i * 2 + 1][j]-1] = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = [int(x) for x in input().split()]
a = []
has = set()
for _ in range(k):
    d = int(input())
    a.append({int(x) for x in input().split()})
    assert d == len(a[-1])
    has |= a[-1]
print(n - len(has))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n, k = map(int, input().split())
    s = []
    ans_temp = [i for i in range(1, n+1)]
    for _ in range(k):
        d = int(input())
        As = map(int, input().split())
        s.extend(As)
    ans = len(set(ans_temp)) - len(set(s))
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()
  for j in map(int,input().split(" ")):
    flag[j-1] = 0
print(sum(flag))

Submission status: Accepted

Solution code:
from collections import defaultdict
N,K = map(int,input().split())

d_snack =defaultdict(int)

for i in range(0,K):
    d = int(input())
    A = list(map(int,input().split()))
    #print(A)
    for j in range(0,len(A)):
        #print("j",A[j])
        d_snack[A[j]] = d_snack[str(A[j])] +1
    #print("dddd",d_snack[3])
count=0
for i in range(0,N):
    #print(d_snack[i+1])
    if d_snack[i+1]==0:
        count +=1
print(count)

Submission status: Accepted

Solution code:
def i():
    return int(input())
def i2():
    return map(int,input().split())
def s():
    return str(input())
def l():
    return list(input())
def intl():
    return list(int(k) for k in input().split())

n,k=i2()
D=[]
A=[]
for j in range(k):
	d=i()
	a=intl()
	D.append(d)
	A.append(a)
s=[]
for i in range(k):
	for j in range(0,D[i]):
		s.append(A[i][j])
s=set(s)
print(n-len(s))

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

print(n-len(set(a)))

Submission status: Accepted

Solution code:
N, K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()  # ignore
  for j in map(int, input().split(" ")):
    flag[j - 1] = 0
print(sum(flag))

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase


def solution():
    pass


def main():
    n, k = r_array()
    res = [0] * n
    for _ in range(k):
        d = r_int()
        darr = r_array()
        for x in darr:
            res[x - 1] += 1

    write(sum(u == 0 for u in res))


# fast-io region

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def input():
    return sys.stdin.readline().rstrip("\r\n")


def write(*args, end='\n'):
    for x in args[:-1]:
        sys.stdout.write(str(x) + ' ')
    sys.stdout.write(str(args[-1]))
    sys.stdout.write(end)


def r_array():
    return [int(x) for x in input().split()]


def r_int():
    return int(input())


if __name__ == "__main__":
    main()

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 a:
        sunuke[j-1]+=1
print(sunuke.count(0))