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: Wrong Answer

Solution code:
import collections
li=[]
n,k=map(int,input().split())
for i in range(k):
    d=int(input())
    lik=list(map(int,input().split()))
    li+=lik
print(li)
li=collections.Counter(li)
ans=0
for j in range(1,n+1):
    if li[j]==0:
        ans+=1
print(ans)

Submission status: Wrong Answer

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

print(N-K)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
i = 0
a = list()
d = 0
while i<k:
    d += int(input())
    a += (map(int, input().split()))
    i += 1
i=0

while i<d:
    x = d-1
    while x > i:
        if a[x] < a[x-1]:
            c = a[x]
            a[x] = a[x-1]
            a[x-1] = c
        x -= 1
    i+=1

i=0
ans = a[0] - 1
while i<d-1:
    if a[i+1] - a[i]>1:
        ans +=1
    i+=1
if a[d-1] == n:
    ans += n - a[d-1]

print(ans)

Submission status: Wrong Answer

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

sunuke = []
target = []

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

sunuke = set(sunuke)

for i in range(1, K+1):
    if i not in sunuke:
        target.append(i)

print(len(target))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
d=list()
array=list()
for i in range(k):
	d.extend(input())
	array.extend(input())


print(n-len(set(array)))

Submission status: Wrong Answer

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

for i in range(N):
    a.append(i + 1)

for i in range(K):
    d = int(input())
    A = [int(x) for x in input().split()]
    try:
        for j in range(d):
            a.remove(A[j])
    except:
        pass
    d = ""
    A = []

print(len(a))

Submission status: Wrong Answer

Solution code:

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

d=[0]*k
a=set()
for i in range(k):
    d[i]=int(input())
    if d[i]>1:
        a.add(map(int,input().split()))
    else:
        a.add(int(input()))
    
print(n-len(a))

Submission status: Wrong Answer

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

a = []

s = 0
for i in range(k):
  d = int(input())
  array = list(map(int, input().strip().split()))
  a.append(array)
for j in range(1, n):
  if k not in a:
    s += 1
print(s)

Submission status: Wrong Answer

Solution code:
import itertools
N,K = map(int, input().split())
c = []
for i in range(K):
	a = int(input())
	b=list(map(int,input().split()))
	c.append(b)
f = list(itertools.chain.from_iterable(c))
d = []
for i in range(1,N+1):
	e =  i in f
	if e  == False:
		d.append(i)
length = len(d)
for i in range(length):
	print(d[i])

Submission status: Wrong Answer

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

z = 0
l = [0]
for i in range(k):
  d=int(input())
  s =list(map(int,input().split()))
  l.extend(s)
  
print(l)
for i in range(n+1):
  if l.count(i)==0:
    z = z + 1
print(z)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
a = 0
li = []
for x in range(k):
    li.append(input().split())
    if n - k == 0:
        a = n - 1
    else:
        a = n - k
print(a)

Submission status: Wrong Answer

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

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

#print(sunuke)

for i in range(k):
  d = int(input())
  #print(d)
  A = list(map(int, input().split()))
  #print(A)
  for id, s in enumerate(sunuke):
    if s in A:
      sunuke.pop(id)
      #print("popされたよ")
      #print(sunuke)
print(len(sunuke))

Submission status: Wrong Answer

Solution code:
N,K=map(int, input().split(" "))
d=[0]*K
A=[0]*K
dic={}
for i in range(K):
    d[i]=int(input())
    A[i]=input().split()
for j in range(K):
    if d[j]==1:
        if A[j][0] not in dic:
                dic[A[j][0]]=1
    if d[j]!=1:
        print(A[j])
        for k in range(d[j]):
            if A[j][k] not in dic:
                dic[A[j][k]]=1
print(dic)
print(N-len(dic))

Submission status: Wrong Answer

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

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

ref = A[0]

for i in range(1, K):
  ref = list(set(ref) & set(A[i])) + list(set(ref) ^ set(A[i]))

len = len(ref)

print(len)
print(N - len)

Submission status: Wrong Answer

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

for n in range(101):
    Nlist.append(0)


for i in range(K):
    d[i] = int(input())
    A.append(list(map(int,input().split())))
    
for j in range(K):
    for k in range(d[j]):
        Nlist[A[j][k]] += 1

for l in range(N):
    if Nlist[l] == 0:
        B = B + 1

print(B-1)

Submission status: Wrong Answer

Solution code:
n,k = list(map(int,input().strip().split()))
temp = []
ans = int(0)
for i in range(k):
    d = int(input())
    li = list(map(int,input().split()))
    for j in range(d):
        temp += str(li[j])
for m in range(k):
    b  = str(m + 1)
    a = temp.count(b)
    if a == 0:
        ans += 1
print(ans)

Submission status: Wrong Answer

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

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation

'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''





########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

def main():


    j=0
    k=0
    #n=int(input())
    #r=int(input())

    N,K=map(int, input().split(" "))
    d_lis=[]
    t_lis=[]
    k_lis=[[] for i in range(K)]
    #print(k_lis)
    c_lis=[]
    "1行1つの整数を入力を取得し、整数と取得する"
    for i in range(K):
        d_lis.append(int(input()))
        t_lis.append(map(int, input().split(" ")))

        #k_lis[i].append(map(int, input().split(" ")))
    #brray=[list(map(int, input().split(" ")))for i in range(N)]
    #print(type(brray[0][0]))
    #print(brray)
    #number_list=list(map(int, input().split(" ")))#数字の時
    #print(number_list)
    "12 21 332 とか入力する時に使う"
    "1行に複数の整数の入力を取得し、整数として扱う"
    for i in range(N):
        c_lis.append(i+1)
    ss=0
    #ss=collections.Counter(k_lis)
    ss=len(set(t_lis))
    print(N-ss)
    #s=input()
    #a=[int(i) for i in s]#int取るとstrでも行ける
    #print(a)
    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

for i in range(k):
    d = int(input())
    dl += str(input().split())

cnt = 0
for i in range(n):
    if (dl.count(str(i+1)) == 0):
        cnt += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
d=list()
array=list()
print(k)
for i in range(k):
	d.extend(input())
	array.extend(input())


print(n-len(set(array)))

Submission status: Wrong Answer

Solution code:
N, K = input().split()
d = []
x2 = []
count = 0
for i in range(0, int(N)):
  x2.append(0)
for i in range(0, int(K)):
  d = int(input())
  x = input().split()
  for j in x:
    if x2[int(j)-1] == 0:
      x2[int(j)-1] = 1
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
def resolve():
	n, k = map(int, input().split())
	d1 = int(input())
	print(n - d1)
resolve()

Submission status: Wrong Answer

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

a = []

s = 0
for i in range(k):
  d = int(input())
  array = list(map(int, input().strip().split()))
  a.append(array)
for j in range(1, k):
  if k not in a:
    s += 1
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
hito = []
for i in range(k):
  d = int(input())
  x = list(map(int, input().split()))
  for j in range(d):
    hito.append(x[j])
a = list(set(hito))
a.sort()
ans = 0
for i in range(len(hito)):
  if hito[i] != i+1:
    ans += 1
print(ans)

Submission status: Wrong Answer

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

l = []
i = 0

while i <= 2*K:
  i += 1
  if i % 2 == 0:
    l.extend([int(x) for x in input().split()])

L = list(set(l))
print(K - len(L))

Submission status: Wrong Answer

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

d = []
A = []
for i in range(K):
    d_pre = int(input())
    A_pre = [int(x) for x in input().split()]
    d.append(d_pre)
    A.extend(A_pre)

A_unique = list(set(A))

ans = 0

for i in range(1, K+1):
    if i in A_unique:
        pass
    else:
        ans += 1

print(ans)

Submission status: Wrong Answer

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

z = 0
l = [0]
for i in range(k):
  d=int(input())
  s =list(map(int,input().split()))
  l.extend(s)
for i in range(n):
  if l.count(i)==0:
    z = z + 1
print(z)

Submission status: Wrong Answer

Solution code:
a,b = map(int, input().split())
List = [list(map(int, input().split())) for i in range(2*b)]
list_all=[]
Output = 0
for i in range(b):
  list_all = list_all+List[2*i]
set_a = set(list_all)
Output = a- len(set_a)
print(Output)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
D = []
count = 0
sunuke_list = [0] * N
print(sunuke_list)
for j in range(K * 2):
    D = list(map(int, input().split()))
    if j % 2 == 1:
        for i in range(len(D)):
            sunuke_list[i - 1] = 1
        print(sunuke_list)

print(N - sum(sunuke_list))

Submission status: Wrong Answer

Solution code:
import itertools
N, K = map(int, input().split())
i=0
dlist=[]
mlist=[]
while(i<K) :
  d = int(input())
  val = map(int, input().split())
  dlist.append(d)
  mlist.append(val)
  i+=1
res=0
list=list(itertools.chain.from_iterable(mlist))
if(N==1):
  if(list.count(1)==0):
    res+=1
else:
  j=1
  while(j<N):
    if(list.count(j)==0):
      res+=1
    j+=1
print(res)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
d = int(input())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))
        #listA<-[1,2,2,3,1]
        #ここに逐次処理を書けばいいと思う。
    except:
        break;
print(n-d)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
c = 0
listA = []
for k in range(1,K+1):
    d = int(input())
    listA += list(map(int,input().split()))
    
for n in range(1,N+1):
    if n in listA:
        c += 1
print(c)

Submission status: Wrong Answer

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

for i in range(N):
    a.append(i + 1)

for i in range(K):
    d = int(input())
    A = [int(x) for x in input().split()]
    try:
        for j in range(d):
            a.remove(A[j])
    except:
        pass

print(len(a))

Submission status: Wrong Answer

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

print(N - di)

Submission status: Wrong Answer

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

print(N-d)

Submission status: Wrong Answer

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

s0 = set([i for i in range(1,N)])
s1 = set()

for i in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
	
    for j in range(d[i]):
        s1.add(A[i][j])

s_diff = s0 - s1
print(len(s_diff))

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
A = []
for i in range(K) :
    d = int(input())
    A.append(input().split(" "))
    
snukeList = []
for i in range(len(A)) :
    for j in range(len(A[i])) :
        snukeList.append(int(A[i][j]))
count = 0
uniqueSnuke = list(set(snukeList))
for i in range(1, N) :
    if i in uniqueSnuke :
        continue
    count += 1
print(count)

Submission status: Wrong Answer

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

for j in range(1, K+1):
  if j in A:
    pass
  else:
    B.append(j)
print(len(B))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for i in range(K):
    d=int(input())
    a=list(map(int,input().split()))
    b=set(sunuke_list)-set(a)
    sunuke_list=list(b)
    print(sunuke_list)
    
print(len(sunuke_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = [0]*(N+1)

for i in range(K):
    d = int(input())
    A = list(map(int, input().split())) 
    for j in range(d):
        ans[A[j]] = 1

res = sum(ans)
print(res)

Submission status: Wrong Answer

Solution code:
nk = list(map(int, input().split()))
dic={}
for i in range(1,nk[0]):
    dic[str(i)]=0
for i in range(nk[1]):
    d=int(input())
    a = list(map(int, input().split()))
    for j in range(len(a)):
        dic[str(a[j])]=1

keys= [k for k, v in dic.items() if v == 0]
print(len(keys))

Submission status: Wrong Answer

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

l=[0]*n

print(l)

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

print(l.count(0))

Submission status: Wrong Answer

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

print(data)
print(n-len(set(data)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
for w in range(k):
  d=int(input())
  a=list(map(int,input().split()))
l=[]
for x in range(1,n+1):
  l.append(x)
for y in range(k):
  for z in range(d):
    if a[z] in l:
      l.remove(a[z])
      y+=1
print(len(l))

Submission status: Wrong Answer

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

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

t = 0
for i in range(1,n+1):
    if i in a_list:
        t += 1
print(t)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k = (int(i) for i in input().split())
d = 0
a = []
c = set( [i for i in range(1,k+1)])
for i in range(k):
	d = int(input())
	a.extend(int(i) for i in (input().split()))

b = set(a)
d = c-b
print(len(d))

""""
n,m = (int(i) for i in input().split())
h = [int(i) for i in input().split()]
ab =[]
for i in range(m):
	ab.append(list(map(int,input().split())))
	"""

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
A = []
for i in range(K) :
    d = int(input())
    A.append(input().split(" "))
    
snukeList = []
for i in range(len(A)) :
    for j in range(len(A[i])) :
        snukeList.append(int(A[i][j]))
count = 0
for i in range(1, N) :
    if i in snukeList :
        continue
    count += 1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools

N, K = map(int, input().split())
i=0
dlist=[]
mlist=[]

while(i<K) :
  d = int(input())
  val = map(int, input().split())
  dlist.append(d)
  mlist.append(val)
  i+=1

j=1
res=0

list=list(itertools.chain.from_iterable(mlist))

if(N==0):
  j=0
else:
  j=1

while(j<N):
  if(list.count(j)==0):
    res+=1
  j+=1

print(res)

Submission status: Wrong Answer

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

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


for j in range(1,N):
  if AA.count(j) == 0:
    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n, k= map(int, input().split())
num = range(1,n)
c = set()
num = set(num)
for i in range(k):
  a = input()
  b = set(list(map(int, input().split())))
  c = b | c
num = list(num -c)
L=[str(a) for a in num]
L=" ".join(L)
print(L)

Submission status: Wrong Answer

Solution code:
nk = list(map(int, input().split()))
dic={}
for i in range(1,nk[0]):
    dic[str(i)]=0
for i in range(nk[1]):
    d=int(input())
    a = list(map(int, input().split()))
    for j in range(len(a)):
        dic[str(a[j])]=d

keys= [k for k, v in dic.items() if v == 0]
print(len(keys))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a=[]
for i in range(len(A)):
  for j in range(len(A[i])):
    if not(j in a):
      a.append(j)

print(n-len(a))

Submission status: Wrong Answer

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

treated = (list(range(1, N+1)))

for i in range(int((K+1)/2)):
  tt = list(set(list(range(1, N+1))) - set(l[2*i+1]))
  treated = list(set(treated) & set(tt))

print(len(treated))

Submission status: Wrong Answer

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

names = list(range(1,n+1))
for i in range(0,k):
  syoji = sunukes[i]
  okashi = sunukes[i+1]
  for n in okashi:
    if n in names:
      names.remove(n)

print(len(names))

Submission status: Wrong Answer

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

treated = (list(range(1, N+1)))

for i in range(int((K+1)/2)):
  tt = list(set(list(range(1, N+1))) - set(l[2*i+1]))
  print(tt)
  treated = list(set(treated) & set(tt))

print(len(treated))

Submission status: Wrong Answer

Solution code:
#intの場合

L, R = map(int,input().split())
dell = set(range(1, L))
answer = set(range(1, L))

for x in range(R):
  intA = int(input())
  dell = list(map(int, input().split()))
  
  answer = answer.difference(dell)

print (len(answer))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
c=[]
e=[]
for _ in range(K):
    d = map(int,input().split())
    c.append(d)
    a = map(int,input().split())
for i in c:
    if i not in e:
        e.append(i)
f = N-len(e)
print (f)

Submission status: Wrong Answer

Solution code:
n,k = list(map(int,input().strip().split()))
temp = []
ans = int(0)
for i in range(k):
    d = int(input())
    li = list(map(int,input().split()))
    for j in range(d):
        temp += str(li[j])
for m in range(n):
    b  = str(m + 1)
    a = temp.count(b)
    if a == 0:
        ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = list(map(int, input().split()))
a_set = set()
for k in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    a_set |= set(A)
 
people = a_set
 
print(len(people))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
sunuke_dict = {}
for i in range(K):
    d = int(input())
    sunuke_dict[d] = list(map(int,input().split()))
ans = [1]*(N+1)
ans[0]  =0
for v in sunuke_dict.values():
    for v_ in v:
        if ans[v_] == 1:
            ans[v_] =0
print(sum(ans))

Submission status: Wrong Answer

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

a = []

for i in range(k):
    d = int(input())
    s = list(map(int, input().split()))
    for j in range(d):
        if s[j] in a:
            break
        else:
            a.append(s[j])

ans = n - len(a)

print(max(ans, 0))

Submission status: Wrong Answer

Solution code:
import itertools
n, k = map(int, input().split())
d = []
a = []
n_1=[i for i in range(1,n+1)]
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
a_1 = list(itertools.chain.from_iterable(a))
c=list(set(n_1)-set(a_1))
for d in c:
  print(d)

Submission status: Wrong Answer

Solution code:
import collections
N,K=map(int,input().split())
sunuke=[]
d=[]
for i in range(K):
    d.append(input())
    sunuke.append(input())
have_okashi=collections.Counter(sunuke)
print(N-len(have_okashi))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
list=input().split(" ")
N=int(list[0])
K=int(list[1])

sunuke_list=[1]

for i in range(N):
    sunuke_list.append(0)

for i in range(K):
    num=int(input())
    have_list=input().split(" ")
    for j in range(num):
        tmp=int(have_list[j])
        sunuke_list[tmp]=1

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
d_list = []
A_list = []
for i in range(K):
    d_list.append(int(input()))
    A_ = list(map(int, input().split()))
    A_list.extend(A_)

K_all = set(A_list)
N_all = set(range(1, N))


no_N = N_all - K_all


print(len(no_N))

Submission status: Wrong Answer

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

snuke = list(set(snuke))
print(n - len(snuke))

Submission status: Wrong Answer

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

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

# calc
okashi = [0 for _ in range(n)]
for i in range(k):
    for j in range(d[i]):
        okashi[j] += 1

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

Submission status: Wrong Answer

Solution code:
import itertools

N, K = map(int, input().split())
i=0
dlist=[]
mlist=[]

while(i<K) :
  d = int(input())
  val = map(int, input().split())
  dlist.append(d)
  mlist.append(val)
  i+=1

j=1
res=0

list=list(itertools.chain.from_iterable(mlist))

while(j<N):
  if(list.count(j)==0):
    res+=1
  j+=1

print(res)

Submission status: Wrong Answer

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

for i in range(k * 2):
  if i % 2 != 0:
    a = list(map(int, input().split()))
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

sunuke = ["{}".format(i) for i in range(1,n+1)]

for i in range(k):
    d = int(input())
    a = input().split()
    for i in a:
        if i in sunuke:
            sunuke.remove(i)
    print(sunuke)

ans = len(sunuke)

print("{}".format(ans))

Submission status: Wrong Answer

Solution code:
n, k= map(int, input().split())
num = range(1,n)
c = set()
num = set(num)
for i in range(k):
  a = input()
  b = set(list(map(int, input().split())))
  c = b | c
print(c)
num = num -c
print(list(num))

Submission status: Wrong Answer

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


temp_array = []

for _ in range(k):
  temp = input()
  [temp_array.append(i) for i in list(map(int, input().split()))]

all_member = len(list(set(temp_array)))
print(k - all_member)

Submission status: Wrong Answer

Solution code:
import numpy
N, K = map(int, input().split())
d = 0
l = list(numpy.zeros(N))

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    
    for j in range(len(A)):
        l[j] = 1

print(l.count(0))

Submission status: Wrong Answer

Solution code:
NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]

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

print(N - max(d))

Submission status: Wrong Answer

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

ls = list(range(1, N))
for i in range(K):
    for l in map(int, input().split()):
      #print(l)
      if l in ls:
      	ls.remove(l)

print(len(ls))