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:
#文字列の長さ len(測る文字)
#文字列の検索（何番目） List.index(検索する文字)


#A, B = [int(input()) for i in range(2)]
#A, B = [input() for i in range(2)]
N,K =map(int, input().split())
#N = int(input())
#S = input()

sum=0

#List = ['A','B','C','D','E']
#List=list(range(1))
List_A_all = list(range(3*K+1))
List_A_all =[]


#行列入力
for i in range(K):

    List_d = int(input())

    List_A = input().split()
    List_A_int= [int(s) for s in List_A]
    List_A_all.extend(List_A_int)

#print(List_A_all)

if not 1 in List_A_all:
    sum+=1
if not 2 in List_A_all:
    sum+=1
if not 3 in List_A_all:
    sum+=1


#print(List_d)
print(sum)


#1行のリスト作成
#for i in range(1):
#    X,Y,Z= map(int, input().split())
#    List=[X,Y,Z]

#List.sort()
#print(List[1])

#for i in range(3):
 #   sum += List[i][0]*List[i][1]*0.1

#print(int(sum))

#print(List.index(S)+1)

#salary = 0

#sum=0

#print(N)
#while sum!=N:

#    print(1)
#    sum+=1



#i=0からスタートなのに注意
#for i in range(N+1):
#    salary+= i*10000/N
#
#salary = int(salary)
#print(str(Y)+' '+str(X))

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
S = [input() for i in range(K*2)]
#print(S)
count=0
d = []
sunu = []
sunu2 = []
f=0

for i in S:
    count += 1
    if count % 2 == 0:
        sunu.append(i)
    else:
        d.append(i)
        
#print(sunu)
#print(d)
    
for i in sunu:
    for n in i:
      sunu2.append(n)
#print(sunu2)

list_example3 = []
for a in sunu2:
    if a != ' ':
        list_example3.append(a)
#print(list_example3)
#print(set(list_example3))
print(N-len(set(list_example3)))

Submission status: Wrong Answer

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

d_num = int(input())

okasi_nasi = set()
for i in range(int(K)*2):
    if i % 2 == 1:
        okasi_nasi = okasi_nasi | set(input().split(" "))

print(int(N) - len(okasi_nasi))

Submission status: Wrong Answer

Solution code:
from collections import Counter
N, K = map(int, input().split())
list=[]
for _ in range(1,K):
    d = int(input())
    S = input().split()
    list.extend(S)
num = Counter(list)
print(N-len(num))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
Q = input().split(" ")
N = int(Q[0])
K = int(Q[1])
A = {}
ss = 0
for i in range (N):
  A[str(i +1)] = 0
for i in range(K):
  a = int(input())
  b = input()
  for j in range(a):
    A[b[j]] = 1

#print(A)

for v in A.values():
  #print(v)
  if v == 0:
    ss += 1
print(ss)

Submission status: Wrong Answer

Solution code:
NK = input().split()
N = int(NK[0])
K = int(NK[1])
Moratta = []
 
for i in range(0, K-1):
    D = int(input())
    A = input().split()
    for j in A:
      if j in Moratta:
        continue
      else:
        Moratta.append(j)

sunuke_count = len(Moratta)
result = N-sunuke_count
print(result)

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
arr1=[]
arr=[]
for i in range(1, N+1):
  arr1.append(i)

for i in range(K*2):
  A=list(map(int, input().split()))
  if i==0 or i%2 ==0:
    arr = arr+A
print(len(list(set(arr1) - set(arr))))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

array = []

s = 0
for i in range(k):
  d = int(input())
  array += list(map(int, input().strip().split()))

array = set(array)


for j in range(1,n):
  if j not in array:
    s += 1
print(s)

Submission status: Wrong Answer

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

for i in range(1,len(S)-2,2):
    for j in S[i]:
        new_list.append(j)

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

Submission status: Wrong Answer

Solution code:
x = input()
n = int(x.split()[0])
k = int(x.split()[1])
moji = ''
count = 0

for i in range(k * 2):
  s = input()
  if i % 2 != 0:
    moji = moji + ' ' + s

for i in range(n):
  num = str(i+1)
  if moji.count(num):
    count
  else:
    count = count + 1
    
print(count)

Submission status: Wrong Answer

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

for i in range(0,k):
  d = int(input())
  a = list(map(int, input().split()))
  for j in range(0,d):
    if a[j] != 0:
      all_sunuke[j] =all_sunuke[j]*0

print(sum(all_sunuke))

Submission status: Wrong Answer

Solution code:
nk = input().split()
NK =[int(x) for x in nk]
t = []
s = []

for i in range(1,NK[1]+1):
    s.append(i)
    d = int(input())
    A =  input().split()
    a = [int(x) for x in A]
    t += a
set_t = set(t)
set_s = set(s)
r = set_s - set_t
print(len(r))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
A = [ ]
D = [ ]
for i in range(K):
  D.append(int(input()))
  A.append(list(input().split()))
B = [ ]
c = 0
for i in range (K):
  B += A[i]
F = [int(B[i]) for i in range(K)]
for j in range (1,N+1):
  if F.count(j) == 0:
    c += 1
print(c)

Submission status: Wrong Answer

Solution code:
N_setup_data = input().split()
N_sunuke_number = int(N_setup_data[0])
K_snack_number = int(N_setup_data[1]) - 1
N_1_sunuke_number = N_sunuke_number - 1
K_snack_number = int(N_setup_data[1])
N_sunuke_pocket = [0] * N_sunuke_number
N_A_sunuke_pocket = [0] * N_sunuke_number
N_B_sunuke_pocket = [0] * N_sunuke_number

for j in range(K_snack_number):
	d = input()
	N_A_sunuke_pocket = input().split()
	for i in N_A_sunuke_pocket:
		N_B_sunuke_pocket[int(i) - 1] += 1
	i = 0
	while i < N_1_sunuke_number:
		N_sunuke_pocket[i] += int(N_B_sunuke_pocket[i])
		i += 1

def calc_area():
	Out_Area = 0
	for i in N_sunuke_pocket:
		if i == 0:
			Out_Area += 1
			return Out_Area

print(calc_area())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def count_ones_by_shift_2(num):
    num = (num & 0x55555555) + (num >> 1 & 0x55555555)
    num = (num & 0x33333333) + (num >> 2 & 0x33333333)
    num = (num & 0x0F0F0F0F) + (num >> 4 & 0x0F0F0F0F)
    num = (num & 0x00FF00FF) + (num >> 8 & 0x00FF00FF)
    num = (num & 0x0000FFFF) + (num >> 16 & 0x0000FFFF)
    return num


n, k = map(int, input().split())  # x = 1, y = 2

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


bitl = 2**n - 1
for kashi in a:
    for i in kashi:
        bitl &= ~(1 << (i - 1))

print(count_ones_by_shift_2(bitl))

Submission status: Wrong Answer

Solution code:
import numpy as np
N, K = map(int, input().split())
N_lis=np.zeros(N)
for i in range(K):
    d=int(input())
    sweet=np.array(list(map(int, input().split())))
    #print(sweet)
    sweet-=1
    for j in sweet:
        N_lis[j]+=1
print(N_lis)
no_sweet=N_lis==0
print(no_sweet)
print(no_sweet.sum())

Submission status: Wrong Answer

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

d = [0 for i in range(k)]
a = [0 for i in range(k)]

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

l=[]
for c in range(len(a)):
    l.extend(a[c])
ls=list(set(l))
print(ls)
print(n-len(ls))

Submission status: Wrong Answer

Solution code:
n,k= map(int,input().split())
count = 3
maxcount = k*2+3
damy = []
answer = []
while count < maxcount:
    if count % 2 == 1:
	    count += 1
	    damy.append(input())
    else:
	    count += 1
	    answer.append(input())

answera = set(answer)
print(n-len((answera)))

Submission status: Wrong Answer

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

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

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

for i in range(0, N):
    for j in range(0, K):
        if check[i] == A_row[j]:
            check[i] = 'None'

for i in range(0, len(check)):
    if check[i] != 'None':
        count += 1
print(str(count))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
l =[]
for i in range(K):
    input()
    l.extend(list(map(str,input().split())))
print(l)
count = 0
for i in range(1,N+1):
             if str(i) not in l:
                     count+=1
             else:
                 pass
print(count)

Submission status: Wrong Answer

Solution code:
nk = input().split()
NK =[int(x) for x in nk]
t = []
s = []
for l in range(1 ,NK[0]+1):
  s.append(l)
for i in range(1,NK[1]+1):
    d = int(input())
    A =  input().split()
    a = [int(x) for x in A]
    t += a
print(t)
set_t = set(t)
set_s = set(s)
r = set_s - set_t
print(len(r))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())	
x=[list(map(int, input().split())) for i in range(2*k)]
ans=[range(1,n+1)]
num=[]
print(x)
many=x[0:2*k:2]
cookie=x[1:2*k:2]
print(many)
print(cookie)
for y in range(len(cookie)):
    for z in range(len(cookie[y])):
        num.append(cookie[y][z])
Q=set(num)
W=list(Q)
print(n-len(W))

Submission status: Wrong Answer

Solution code:
#文字列の長さ len(測る文字)
#文字列の検索（何番目） List.index(検索する文字)


#A, B = [int(input()) for i in range(2)]
#A, B = [input() for i in range(2)]
N,K =map(int, input().split())
#N = int(input())
#S = input()

sum=0

#List = ['A','B','C','D','E']
#List=list(range(1))
List_A_all = list(range(3*K))
List_A_all =[]


#行列入力
for i in range(K):

    List_d = int(input())

    List_A = input().split()
    List_A_int= [int(s) for s in List_A]
    List_A_all.extend(List_A_int)

#print(List_A_all)

if not 1 in List_A_all:
    sum+=1
if not 2 in List_A_all:
    sum+=1
if not 3 in List_A_all:
    sum+=1


#print(List_d)
print(sum)


#1行のリスト作成
#for i in range(1):
#    X,Y,Z= map(int, input().split())
#    List=[X,Y,Z]

#List.sort()
#print(List[1])

#for i in range(3):
 #   sum += List[i][0]*List[i][1]*0.1

#print(int(sum))

#print(List.index(S)+1)

#salary = 0

#sum=0

#print(N)
#while sum!=N:

#    print(1)
#    sum+=1

Submission status: Wrong Answer

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

for i in range(1,N+1):
    x = a.count(i)
    if x >= 2:
        for n in range(1,x):
            a.remove(i)

print(N - len(a))

Submission status: Wrong Answer

Solution code:
try:
  n,k=map(int,input().split())
  count=0
  l,p=[],[]
  for i in range(k):
      d=int(input())
      a=list(map(int,input().split()))
      for i in range(1,n+1):
          if i not in a:
              l.append(i)
  for i in l:
      if l.count(i)>1:
          if i not in p:
              p.append(i)
  print(len(p))
except:
  pass

Submission status: Wrong Answer

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

grid = []
for i in range(2*k):
    array = list(map(int, input().strip().split()))
    grid.append(array)
print(grid)
l = []
for j in range (k):
    l.append(grid[0+2*j+1])
print(l)
lis = list(itertools.chain.from_iterable(l))
print(lis)
count = 0
for m in range(n):
    if m+1 in lis:
        count = count +1
print(n - count)

Submission status: Wrong Answer

Solution code:
nk = input().split()
NK =[int(x) for x in nk]
t = []
s = []

for i in range(1,NK[1]+1):
    s.append(i)
    d = int(input())
    A =  input().split()
    a = [int(x) for x in A]
    t += a
print(t)
set_t = set(t)
set_s = set(s)
r = set_s - set_t
print(len(r))

Submission status: Wrong Answer

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

for i in range(K*2):
  A=list(map(int, input().split()))
  if i==0 or i%2 ==0:
    for j in A:
      if j in arr1:
        arr1.remove(j)
print(len(arr1))

Submission status: Wrong Answer

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

print(sunukes)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
a = []
for i in range(1,k+1):
    d = int(input())
    if d == 1:
        a.append(int(input()))
    elif d >= 2 and d <= 100:
        a.append(map(int, input().split()))
    else:
        exit()

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

Submission status: Wrong Answer

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

for n in N:
    print(n)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
d = []
for _ in range(M):
    d.append(int(input()))
    A = list(map(int, input().split()))
ans = N-max(d)
print(ans)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    if d[i]!=1:
        A.append(map(int,input().split()))
    else:
        A.append(int(input()))
answer = sum(d)-len(set(A))
print(answer)

Submission status: Wrong Answer

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

grid = []
for i in range(2*k):
    array = list(map(int, input().strip().split()))
    grid.append(array)
print(grid)
l = []
for j in range (k):
    l.append(grid[0+2*j+1])
print(l)
lis = itertools.chain.from_iterable(l)
print(list(itertools.chain.from_iterable(l)))
count = 0
for m in range(n):
    if m+1 in lis:
        count = count +1
print(n - count - 1)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
res=[]
for i in range(K):
    d=input()
    ki=list(input())
    res=list(set(res)|set(ki))
res=[x for x in res if x!=' ']
print(N-len(res))

Submission status: Wrong Answer

Solution code:
import math as m

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

b = []
for i in range(n):
    b.append(0)

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

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

Submission status: Wrong Answer

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

list_sunuke = list(range(1,N+1))
list_A = []

for k in range(K):
    d = int(input())
    A_list = list(map(int,input().split()))
    list_A.append(tuple(A_list))
    
set_A = set(list_A)

print(len(list_sunuke) - len(set_A))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
c = 2 * k
ls = [input().split() for _ in range(c)]
i = 1
while i < c:
    l = [j for j in ls[i]]
    i += 2
print(n-len(set(l)))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    if d[i]!=1:
        A.append(map(int,input().split()))
    else:
        A.append(int(input()))
answer = N-len(set(A))
print(answer)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
count=0
who=[]
while(K!=0):
    k=int(input())
    someone=list(map(int,input().split()))
    if(len(someone)!=0):
        for i in someone:
            who.append(i)
            someone.remove(i)
    K-=1
print(N-len(set(who)))

Submission status: Wrong Answer

Solution code:
n,k = list(map(int,input().strip().split()))
temp = []
ans = int(n)
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, M = map(int, input().split())
d = []
for _ in range(M):
    d.append(int(input()))
    A = list(map(int, input().split()))
res = set(d)
ans = N-len(res)
print(ans)

Submission status: Wrong Answer

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

l = [list(map(int,input().split())) for i in range(k*2)]

ans = 0
for i in range(1,k+1):
    if l[2*i-1].count(i) == 0 :
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
a_list = [input().split() for i in range(1, 2*k+1)]
a = [e for row in a_list[1::2] for e in row]
n_list = list(range(1, n+1))
a_join = "".join(map(str, a))
ans = 0

for i in n_list:
    if str(i) in a_join:
        continue
    else:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
di=[0]*k
Ap=[0]*n
for i in range(0,k):
    di[i] = int(input())
    A = list(map(int, input().split()))
    ai=0
    for j in range(1,di[i]+1):
        if A[ai]==j:
            ai=ai+1
            Ap[j-1]=1
num=0
for l in range(0,n):
    if Ap[l]==0:
        num=num+1
print(num)

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

okashi = [0] * N

for i in A[0]:
    okashi[i-1] += 1

count = 0
for i in okashi:
    if i == 0:
        count += 1

print(count)

Submission status: Wrong Answer

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

kari = []
for i in range(2*K):
  if i % 2 == 0:
    pass
  else:
    kari.append([int(i) for i in input().split()])
flatten = lambda x: [z for y in x for z in (flatten(y) if hasattr(y, '__iter__') and not isinstance(y, str) else (y,))]
kari = set(flatten(kari))

sa = N_set - kari
print(len(sa))

Submission status: Wrong Answer

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

cnt = []
for i in range(K):
    A = []
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(d):
        if not A[j] in cnt:
            cnt.append(A[j])

ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
c = 2 * k
ls = [input().split() for _ in range(c)]
i = 1
while i < c:
    l = [j for j in ls[i]]
    i += 2
print(n-len(sorted(l)))

Submission status: Wrong Answer

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

list_sunuke = list(range(1,N+1))
list_A = []

for k in range(K):
    d = int(input())
    A_list = list(map(int,input().split()))
    list_A.append(tuple(A_list))
    
set_A = set(tuple(list_A))

print(len(list_sunuke) - len(set_A))

Submission status: Wrong Answer

Solution code:

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


l = [0 for i in range(n+1)]

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


print(l[1:].count(1))

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])
    else:
      pass
print(len(l))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s = set([i for i in range(1, N+1)])
print(s)
rs = set()

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

for i in range(K):
    for a in A:
        for j in a:
            rs.add(j)

for i in rs:
    s.remove(i)

print(len(s))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
c = 2 * k
ls = [input().split() for _ in range(c)]
i = 1
while i < c:
    l = [j for j in ls[i]]
    i += 1
print(n-len(sorted(l)))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
count=0
who=[]
while(K!=0):
    k=int(input())
    someone=list(map(int,input().split()))
    if(len(someone)!=0):
        for i in someone:
            who.append(i)
            someone.remove(i)
    K-=1
print(len(set(who)))

Submission status: Wrong Answer

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

for i in range(k):
    d = int(input())
    okashi_list = list(map(int,input().split()))
    print(okashi_list)
    for j in range(d):
        having = okashi_list[j] - 1
        if not hash_list[having]:
            hash_list[having] = True

count = 0
for i in range(n):
    if not hash_list[i]:
        count += 1
        

print(hash_list)
print(count)

Submission status: Wrong Answer

Solution code:
N, K = list(map(int,input().split()))
d = [None for _ in range(K)]
C = []
count = [0 for _ in range(N)]
ans = 0
for i in range(K):
  d[i] = int(input())
  A = list(map(int,input().split()))
  for j in range(N):
    if j not in A:
      C.append(j)
C = [c for c in C if c != 0]
for i in range(1,N+1):
  for j in range(len(C)):
    if C[j] == i:
      count[i-1] += 1
for i in range(N):
  if count[i] == K:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
#print('N : ' + str(N))
#print('K : ' + str(K))
li = [0 for i in range(N)]

for i in range(0,K): 
  d = int(input())
 # print('')
 # print('d : ' + str(d))
  A = list(map(int, input().split()))
  print('<A>')
  for j in A:
  #  print(j)
    li[j-1] = 1
sum = 0
#print(li)

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

Submission status: Wrong Answer

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

con = 0
ans = list(int() for _ in range(10000))
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: Wrong Answer

Solution code:
n,k = map(int,input().split())
List = [list(map(int, input().split())) for i in range(2*k)]
List_a = []
for x in range(1,2*k,2):
    for i in List[x]:
        List_a.append(i)

List_a =set(List_a)
print(List_a)
print(n-len(List_a))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
A = [1]*N
import collections
for i in range(K):
  d = int(input())
  check = input().split()
  for j in range(d):
    if A[int(check[j])-1] == 1:
      A[int(check[j])-1] = 0
c = collections.Counter(A)
print(c[0])

Submission status: Wrong Answer

Solution code:
N, K=map(int, input().split())
sunuke=[list(map(str, input().split())) for _ in range(2*K)]
merge=[]
ans=0
for i in range(K):
  merge+=sunuke[2*i+1]
for j in range(1, 101):
  if str(j) not in merge:
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
c = 2 * k
ls = [input().split() for _ in range(c)]
l = []
while c > 1:
    l = [j for j in ls[c-1]]
    c -= 1
print(n-len(sorted(l)))

Submission status: Wrong Answer

Solution code:
def count_ones_by_shift_2(num):
    num = (num & 0x55555555) + (num >> 1 & 0x55555555)
    num = (num & 0x33333333) + (num >> 2 & 0x33333333)
    num = (num & 0x0F0F0F0F) + (num >> 4 & 0x0F0F0F0F)
    num = (num & 0x00FF00FF) + (num >> 8 & 0x00FF00FF)
    num = (num & 0x0000FFFF) + (num >> 16 & 0x0000FFFF)
    return num


n, k = map(int, input().split())  # x = 1, y = 2

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


bitl = 2**n - 1
for kashi in a:
    for a in kashi:
        bitl &= ~(1 << (a - 1))

print(count_ones_by_shift_2(bitl))

Submission status: Wrong Answer

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

print(N - len(have))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
D = []
count = 0
sunuke_list = [1] * N
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] = 0

print(sum(sunuke_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#--Trick or Treat
import itertools

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

A = []
judge = list(range(1,N+1))
for i in range(K):
  d = int(input())
  A.append([int(i) for i in input().split()])

allocate = list(itertools.chain.from_iterable(A))
#print(judge)
#for i in range(1,K):

l1_l2_sym_diff = []
l1_l2_sym_diff = set(allocate) ^ set(judge)
print(l1_l2_sym_diff)

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()])
  else:
    pass

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

Submission status: Wrong Answer

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

ans=[]
for i in range(1,n):
  if i not in(a):
    ans.append(i)
print(len(ans))

Submission status: Wrong Answer

Solution code:
def cal():
    snukes, snacks = input().split(" ")
    list1 = []
    for i in range(int(snacks)):
        num = int(input())
        str1 = input()
        list1.extend(str1.split(" "))
    count = 0
    
    for i in range(1, int(snukes)):
        if str(i) not in list1:
            count += 1
    print(count)


cal()

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 = 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(str(j))==0):
      res+=1
    j+=1
print(res)

Submission status: Wrong Answer

Solution code:
N,K = map(int,(input().split()))
n_list=[]
ans_list=[]
for i in range(N):
  ans_list.append(i+1)

for i in range(K):
  d = int(input())
  a_list = list(map(int, input().split()))
  n_list.extend(a_list)
  n_list = list(set(n_list))
print(*list(set(ans_list)-set(n_list)))

Submission status: Wrong Answer

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

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 = n
for i in range(len(hito)):
  if i+1 in a:
    ans -= 1
print(ans)

Submission status: Wrong Answer

Solution code:

n,k=map(int,input().split())
a=[]
cnt=0
for i in range(k):
    d=int(input())
    x=[int(e) for e in input().split()]
    for j in x:

        a.append(j)

for j in range(len(a)-1):
    if a[j]!=a[j+1]:
        cnt+=1
print(n-cnt-1)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
ns = []
As = []
got = []
ans =0
for i in range(k):
    p = int(input())
    As.append(list(map(int, input().split())))
got = As[0]
for i in range(1,n+1):
    for l in As:
        if(i not in l and i not in got):
            ns.append(i)
            got.append(i)
print(len(ns))

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()])
  else:
    pass

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

Submission status: Wrong Answer

Solution code:
def count_ones_by_shift_2(num):
    num = (num & 0x55555555) + (num >> 1 & 0x55555555)
    num = (num & 0x33333333) + (num >> 2 & 0x33333333)
    num = (num & 0x0F0F0F0F) + (num >> 4 & 0x0F0F0F0F)
    num = (num & 0x00FF00FF) + (num >> 8 & 0x00FF00FF)
    num = (num & 0x0000FFFF) + (num >> 16 & 0x0000FFFF)
    return num


n, k = map(int, input().split())  # x = 1, y = 2

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


bitl = 2**3 - 1
for kashi in a:
    for a in kashi:
        bitl &= ~(1 << (a - 1))

print(count_ones_by_shift_2(bitl))

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, N):
    if i in A_unique:
        pass
    else:
        ans += 1

print(ans)

Submission status: Wrong Answer

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

B = []
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in range(d):
        if A[a] not in B:
            B.append(A[a]-1)

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

print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
mem = set()
for _ in range(K):
  _ = input()
  mem = mem | set(map(int, input().split()))

mem_count = len(mem)
print(K, mem_count, mem)
print(N-mem_count)