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: Runtime Error

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

Submission status: Runtime Error

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

nlist = [i for i in range(N)]

for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, k = input()
d = input()
print(n - d)

Submission status: Runtime Error

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

d = [0] * n
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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
hashmap=dict()
for i in range(k):
  d=input()
  for i in range(d):
    key=int(input())
    hashmap[key]=d
count=0
for i in range(1,n+1):
  if hashmap.get(key)==None:
    count+=1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l1=input().split(" ")
n=int(l1[0])
k=int(l1[1])
list=[range(n)]
kashi=[]
for i in range(k):
  tmp=input()
  num=input().split(" ")
  kashi.append(num)
kashi=set(kashi)
print(n-len(kashi))

Submission status: Runtime Error

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

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

ans = 0
for i in range(n) :
    check = 1
    for j in range(k) :
        if s[j][i] == 1 :
            check = 0
            break
    if check == 1 :
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
hashmap=dict()
for i in range(k):
  d=input()
  for i in range(d):
    key=int(input())
    hashmap[key]=d

count=0
for i in range(1,n+1):
  if hashmap.get(key)==None:
    count+=1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

# 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))  # type: str
    K = (next(tokens))  # type: str
    g = set()
    for _ in range(N):
        d = int(next(tokens))
        g = g  or set([int(next(tokens)) for i in range(d)])

    print(N - len(g))    

    return


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
N, K = map(int, input().split())

A = np.zeros(N, dtype=int)

for _ in range(K):
    input()
    for i in input().split():
        A[int(i) - 1] += 1

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

Submission status: Runtime Error

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, k+1):
    if s[i] == 0:
        ans += 1
print(ans)

Submission status: Runtime Error

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

d = int(input())
ans = [0 for i in range(N)]

for i in range(d):
  List=list(map(int,input().split()))
  for j in List:
    ans[j-1] += 1
    
print(ans.count(0))

Submission status: Runtime Error

Solution code:
x = input().split()

n = int(x[0])
k = int(x[1])
ds = []
bool_array = [0]*n

for num in range(k):
  di = int(input())
  ajs_input = input().split(' ')
  for j in range(di):
     bool_array[int(ajs_input[j])-1] = 1
      
print(n - np.array(bool_array).sum())

Submission status: Runtime Error

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

d = []
a = []
res = [0] * n

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

for aa in a:
    for aaa in aa:
        res[aaa - 1] += 1

count = 0

for i in range(k):
    if res[i] == 0:
        count += 1

print(count)

Submission status: Runtime Error

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions

t = stdin.readline().rstrip().split()
n = int(t[0])
k = int(t[1])
res = []
for el in range(k):
    tt = int(stdin.readline().rstrip())
    for el2 in range(tt):
        person = int(stdin.readline().rstrip())
        res.append(person)
count = 0
for el in range(1, n + 1):
    if not (el in res):
        count += 1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N, K = MI()
    d = []
    A = [None for i in range(N)]
    AD = [set() for i in range(N)]

    for i in range(K):
        d = I()
        A[i] = LI()

    for i in range(K):
        for k in A[i]:
            AD[k-1].add(i+1)

    ans = 0
    for i in range(len(AD)):
        if len(AD[i]) == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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
    
sum = 0
for i in range(N):
    if (Snack[i] == 0):
        sum += 1

print(sum)

Submission status: Runtime Error

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

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

oks = [False] * n
for xs in arr:
    for x in xs:
        oks[x - 1] = True

ans = 0
for x in oks:
    if x == False:
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

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

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

cnt = 0
for m in range(len(mans)):
    if mans[m] == 0:
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
N,K= map(int,input().split())
d1=int(input())
Ad1 = list(map(int,input().split()))
d2=int(input())
Ad2 = list(map(int,input().split()))
okashi=[0]*N
for i in Ad1:
    okashi[i-1]+=1
for i in Ad2:
    okashi[i-1]+=1
count=0
for i in okashi:
    if i==0:
        count+=1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(n-len(d))

Submission status: Runtime Error

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[d]] += 1
    
sum = 0
for i in range(N):
    if (Snack[i] == 0):
        sum += 1

print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

L = [0 for i in range(N+1)]

for i in range(K):
  d = int(input())
  for j in range(d):
    s = int(input())
    L[s] += 1

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
haveSnack = [False]*n
for _ in range(k):
  d = int(input(d))
  for __ in range(d):
    s = [int(i) for i in input().split()]
    for sk in s:
      if not haveSnack[sk-1]:
        haveSnack[sk-1] = True
res=0
for i in range(n):
  if not haveSnack[i]:
    res+=1
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
    n, k = map(int, input().split())
    d = [None for _ in range(k)]
    a = [None for _ in range(k)]
    for i in range(k):
        d[i] = int(input())
        a[i] = list(map(int, input().split()))

    tricked = [True for _ in range(n)]
    for i in range(k):
        for j in range(d[i]):
            tricked[a[i][j]-1] = False

    ans = 0
    for i in range(k):
        if tricked[i]:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import networkx as nx
import matplotlib.pyplot as plt
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, k = LI()
B = [0] * n
for _ in range(k):
    d = I()
    A = LI()
    for a in A:
        B[a - 1] = 1

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

print(ans)