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())
d = []
c = []
e = []
for i in range(k):
    d.append(int(input()))
    a = input()
    c.append([a[j:j+1] for j in range(len(a))])
    e[i] = list(map(int, c[i]))

for j in range(k):
    for k in range(d[j]):
        a = set(e[j][k])

print(n-len(a))

Submission status: Runtime Error

Solution code:
def main():
    N, K= map(int, input().split())
    d=[]
    a=[]
    seen = []
    while True:
        d.append(int(input()))
        a.append(list(map(int,input().split())))
        if N==sum(d):
            break
    def get_unique_list(seq):
        return [x for x in seq if x not in seen and not seen.append(x)]
    print(N-len(get_unique_list(a)))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import collections
N,K=map(int,input().split())
a=[]
K=K+1
while K>0:
  K=K-1
  d=int(input())
  a.append(map(str,input().split()))
e=collections.Counter(a)
print(N-len(a))

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
a0 = a[0]
N = int(a0[0])
K = int(a0[1])
b =list(range(0,N-1))
for i in range(K):
    di = int(a[2i+1])
    bi = a[2i+2]
for l in range(N):
    for i in range(K):
        for k in range(di):
            if bi[k] == l:
            	b.remove(l)
                bi.remove(l)
print(len(b))

Submission status: Runtime Error

Solution code:
import collections

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

S = []
for i in range(K):
    di = int(input())
    Ai = [int(input()) for n in range(di)]
    for x in Ai :
        S.append(x)

X = collections.Counter(S)
B = N - len(X)
print(B)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
l=[x for x in range(1,N+1)]
S=set(l)
m=int(input())
B=set((map(int,input().strip().split())))
se=list(S-B)
for i in range(1,K):
	d=int(input())
	A=list(map(int,input().strip().split()))
	for i in range(len(A)):
		if A[i] in se:
			del se[A[i]]
print(len(se))

Submission status: Runtime Error

Solution code:
import numpy as np

N =int(input(''))
K=int(input(''))
A=[]
l=[]
for i in range(K):
    d = int(input(''))
    for j in range(d):
        l_ = int(input(''))
        l.append(l_)
    A.append(l)

a=np.zeros((N, K))
for i in range (len(A)):
    for j in range(len(A[i])):
        a[A[i][j]-1][i]=1
#print(a)

print(np.count_nonzero(np.all(a==0, axis=1)))

Submission status: Runtime Error

Solution code:
NK = input()
N = int(NK[0])
K = int(NK[2])

sunuke = {}

for i in range(K):#お菓子の種類回数だけinput
    d = input()#いらねえ感はすごい
    A = input()
    for j in A.split(' '):
        sunuke[int(j)] = 1
        
sunuke = list(sunuke)
count = 0
for i in range(N):
    if i+1 not in sunuke:
        count += 1
        
print(count)

Submission status: Runtime Error

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

have = []
result = 0

for i in range(N):
    have.append([0]*K)


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

    for a in A:
        if have[a-1][d-1] == 0:
            have[a-1][d-1] = 1
        
for j in have:
    if j == [0]*K:
        result += 1

print(result)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
a0 = a[0]
N = int(a0[0])
K = int(a0[1])
b =[]
for i in range(K):
    di = int(a[2i+1])
    bi = a[2i+2]
for l in range(N):
    for i in range(K):
        for k in range(di):
            if not bi[k] == l:
            	b.append(l)
print(len(b))

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
x = 0
s = list()
d = list()
for i in range(1, N+1):
   s.append(input())
   d.append(map(int, input().split()))
for j in range(1, N+1):
    if j in d:
        x+1
    else:
        x +0
print(x)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

have = []
result = 0

for i in range(N):
    have.append([0]*K)


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

    for a in A:
        have[a-1][d-1] = 1
        
for j in have:
    if j == [0]*K:
        result += 1

print(result)

Submission status: Runtime Error

Solution code:
N, K= map(int, input().split())
d=[]
a=[]
while True:
    d.append(int(input()))
    a.append(list(map(int,input().split())))
    if N==sum(d):
        print(N-len(get_unique_list(a)))
        break
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

Submission status: Runtime Error

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

d = int(inout())

while

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
a0 = a[0]
N = a0[0]
K = a0[1]
b = []
for i in range(K):
    di = a[2i+1]
    bi = a[2i+2]
for l in range(N):
    for i in range(K):
        for k in range(di):
            if not bi[k] == l:
            	b.append(l)
print(len(b))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
m=[]
for _ in range(2*k):
  d=int(input())
  a=list(map(int,input().split()))
  for i in a:
    if i not in m:
      m.append(i)
mx=max(m)
c=0
for i in range(1,n+1):
  if(i not in m):
    c+=1
print(c)

Submission status: Runtime Error

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

have = []
result = 0

for i in range(N):
    have.append([0]*K)


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

    for a in A:
        have[a-1][d-1] = 1

for j in have:
    if j == [0,0]:
        result += 1

print(result)

Submission status: Runtime Error

Solution code:
N, K= map(int, input().split())
d=[]
a=[]
A=[]
while True:
    d.append(int(input()))
    a.append(list(map(int,input().split())))
    if N==sum(d):
        break
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
print(N-len(get_unique_list(a)))

Submission status: Runtime Error

Solution code:
import sys
N, K = map(int, input().split())
d = int(input())
a = [0] * N
a = [list(map(int, input().split())) for _ in range(N)]

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

for i,word in enumerate(a):
	for j,check in enumerate(Sunuke):
		if check in word:
			Sunuke.pop(j)
			break
print(Sunuke[0])

Submission status: Runtime Error

Solution code:
nk = int(input().split())
n = int(nk[0])
k = int(nk[1])
arr =[]
count = 0
for _ in range(k):
    d = int(input())
    a = int(input().split())
    for i in range(d):
        arr.append(a[i])
res = []
for j in range(1,n+1):
    res.append(i)
for x in res:
  	if(x not in arr):
      	count += 1
print(count)

Submission status: Runtime Error

Solution code:
import collections
N,K=map(int,input().split())
a=[]
while K>0:
  K=K-1
  d=int(input())
  a.append(map(str,input().split())
e =collections.Counter(a)
print(N-len(e))

Submission status: Runtime Error

Solution code:
import numpy as np

N, K = map(int, input().split())
A = []
for i in range(K):
    d = int(input())
    temp = list(map(int, input().split()))
    A = A + temp
hito = np.ones(N)
for i in range(len(A)):
    hito[A[i]] = 0
print(int(np.sum(hito)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b = (map(int,input().split()))
x = [0]*a*b
ans = 0
s = 1
for i in range(1,b):
    c = int(input())
    for h in range(1,c):
        x[s] = map(int,input().split())
        s += 1
    
for j in range(1,a):
    if j not in x:
        ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(a-1):
 p=input().split()
 r=input().split()

Submission status: Runtime Error

Solution code:
import sys
N, K = map(int, input().split())
d = int(input())
a = [0] * N
a = [list(map(int, input().split())) for _ in range(N)]

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

for i,word in enumerate(a):
	for j,check in enumerate(Sunuke):
		if check in word:
			Sunuke.pop(j)
for j,word2 in enumerate(Sunuke):
	print(word2)

Submission status: Runtime Error

Solution code:
nk = int(input().split())
n = int(nk[0])
k = int(nk[1])
arr =[]
count = 0
for _ in range(k):
    d = int(input())
    a = int(input().split())
    for i in range(d):
        arr.append(a[i])
  
res = []
for j in range(1,n+1):
    res.append(i)

for x in res:
  	if(x not in arr):
      	count += 1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(a-1):
 p=input().split()
 r=input().split()
 for b in r:
  for bb in b:
    s.append(int(bb))
r=list(range(1,a+1))
s=list(set(s))
result = list(filter(lambda x: x not in s, r))
print(len(result))

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
A=[]
for i in range(K):
    d = int(input())
    for i in range(d):
        a = int(input())
        A.append(a)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
list1, list2, k = [], [], k*2
for x in range(k):
    list1.append(input().split())
while i < k:
    for j in list1[i]:
        list2.append(j)
    i += 2
print(n - len(set(list2)))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c=int(input())
ans=0
for i in range(a+b-c):
  if sum(d)<=c:
    ans+=1
print(ans)

Submission status: Runtime Error

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

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

hito = np.ones(N)
for i in range(len(A)):
    hito[A[i]] = 0
print(int(np.sum(hito)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
list1, list2, k = [], [], k*2
for x in range(k):
    list1.append(input().split())
while i < k:
    for j in list1[i]:
        list2.append(j)
    i += 2
print(n - len(set(list2)))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
S = [input().split() for _ in range(N+K-1)]
new_list = []
for i in range(5):
    S.append([])
S.append([])
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: Runtime Error

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
K1_di_total = input() #お菓子をもっている人の人数
K1_di_num_in = input() #お菓子をもっている人の番号
M1 = K1_di_num_in.split()

K2_di_total = input() #お菓子をもっている人の人数
K2_di_num_in = input() #お菓子をもっている人の番号
M2 = K2_di_num_in.split()

K3_di_total = input() #お菓子をもっている人の人数
K3_di_num_in = input() #お菓子をもっている人の番号
M3 = K3_di_num_in.split()

output = len(list(set(M1 + M2 + M3)))
print(output)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
Aall = set(range(1, N))
Ak = []
for i in range(N*2):
  #d = input()
  A = list(map(int, input().split()))
  if i % 2 == 1:
    Ak.extend((A))
print(len(Aall - set(Ak)))

Submission status: Runtime Error

Solution code:
import numpy as np

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

cnt = np.array(list([0]*n))

for i in range(k):
    d = int(input())
    a = np.array([list(map(int, input().split()))])
    if d != n:
        a = np.append(a,[0]*(n-d))
    cnt += a

print(np.count_nonzero(cnt==0))

Submission status: Runtime Error

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

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
a0 = a[0]
N = a0[0]
K = a0[1]
b = []
for i in range(K):
    di = a[2i+1]
    bi = a[2i+2]
for l in range(N):
    for i in range(K):
        for k in range(di):
            if bi[k] == l:
                b.append(l)
print(len(b))

Submission status: Runtime Error

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)
for j in range (k):
    l.append(grid[0+2*j+1])
lis = list(itertools.chain.from_iterable(l))
count = 0
for m in range(n):
    if m+1 in lis:
        count = count +1
print(n - count)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  set<int> s;
  for (int i=0; i<K; i++) {
    cin >> d.at(i); // d_iの値
    vector<int> A(d.at(i));
    for (int j=0; j<d.at(i); j++) {
      cin >> A.at(j);
      s.insert(A.at(j));
    }
  }
  cout << N - s.size() << endl;
}

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(2*a-2):
 p=input().split()
 if p:
  s.append(p)
 else:
  p=[""] 
  s.append(p)
print(s)

Submission status: Runtime Error

Solution code:
NK = input()
N = int(NK[0])
K = int(NK[2])

sunuke = []
for i in range(N):#人数分のリストを生成
    sunuke.append(0)
    
for i in range(K):#お菓子の種類回数だけinput
    d = input()#いらねえ感はすごい
    A = input()
    for j in A.split(' '):
        sunuke[int(j)-1] = 1
        
count = 0
for i in sunuke:
    if i == 0:
        count += 1
        
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
for i in range(K):
    d = int(input())
    for i in range(d):
        a = int(input())
        A.append(a) 
ans = len(list(set(A)))
print(N-ans)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
S = [input().split() for _ in range(N+K-1)]
new_list = []; count = 1
while count < 2*K:
    for i in new_list[count]:
        new_list.append(i)
    count += 2
new_list = set(new_list)
print(N - len(new_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(2*a-2):
 p=input().split()
 if p:
  s.append(p)
 else:
  s.append([""])
print(s)

Submission status: Runtime Error

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

pp = []
for i in range(2*k):
    pp.append(list(input().split()))

p = pp[1::2]
s = 0
l = []

for i in range(k):
    q = p[i]
    
    l.extend(q)

ll = set(l)

print(n - len(ll))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
di = K * 2
l = []

for i in range (di):
    l.append(int(input()))

l1 = []
x = 1
while x < di:
    for j in l[x]:
        l1.append(j)
    x += 2
l1 = set(l1)
print(N - len(l1))

Submission status: Runtime Error

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

d_num = int(input())

okasi_nasi = set()
for i in range(d_num):
    okasi_nasi = okasi_nasi | set(input().split(" "))

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

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
sunuke=[]
for i in range(K):
    d=int(input())
    okashi=input().split()
    for i in range(d):
        sunuke.append(okashi[i])

have_okashi=collections.Counter(sunuke)
print(N-len(have_okashi))

Submission status: Runtime Error

Solution code:
a,b=map(int(input().split()))
c=int(input())
ans=0
for i in range(a+b-c):
  if sum(c)<=c:
    ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
d = []
e = []
for i in range(k):
    d.append(int(input()))
    for w in range(d[i]):
        e.append(input())
f = list(set(e))
g = len(f)
print(n-g)

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
s=[]
for _ in range(2*a-2):
 s.append(input().split())
print(s)

Submission status: Runtime Error

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

ANSlist = []

for i in range(1,K):
    inportant = int(input())
    trash = input()
    ANSlist.append(inportant)

ANS = N - max(ANSlist)

print(ANS)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
d = []
e = []
for i in range(k):
    d.append(int(input()))
    for w in range(d[i]):
        e.append(input())
print(e)
f = list(set(e))

g = len(f)
print(g)
print(n-g)

Submission status: Runtime Error

Solution code:
N = int(input())
ans = set([input() for _ in range(N)])
print(len(ans))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split(" "))
count = set([])
for i in range(n):
    x = input().split(" ")
    if i%2==1:
        for one in x:
            count.add(int(one))
#print(n, len(count))
print(int(n) - len(count))

Submission status: Runtime Error

Solution code:
import numpy as np

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

cnt = np.array(list([0]*n))

for i in range(k):
    d = int(input())
    a = np.array([list(map(int, input().split()))])
    a = np.append(a,[0]*(n-d))
    cnt += a

print(np.count_nonzero(cnt==0))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ANSlist = []

for i in range(1,K):
    inportant = int(input())
    trash = input()
    ANSlist.append(inportant)

ANS = N - max(ANSlist)

print(ANS)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
S = [input().split() for _ in range(N+K-1)]
new_list = []
for i in range(1,len(S)-1,2):
    for j in S[i]:
        new_list.append(j)
new_list = set(new_list)
print(N - len(new_list))

Submission status: Runtime Error

Solution code:
#include<stdio.h>

int main(void){
  int n,k,d,i,j,b,sum;
  int a[100];
  sum = 0;
  scanf("%d %d", &n, &k);
  for(i=0;i<n;i++){
    a[i] = 0;
  }
  for(i=0;i<k;i++){
    scanf("%d", &d);
    for(j=0;j<d;j++){
      scanf("%d",&b);
      a[b-1] = 1;
    }
  }
  for(i=0;i<n;i++){
    if(a[i] == 1)
      sum += 1;
  }
  printf("%d", n -sum);
  return 0;
}

Submission status: Runtime Error

Solution code:
aa,b = map(int, input().split())
afs=[]
k=[]
for _ in range(2*aa-2):
    pnk=input().split()
    if pnk:
     afs.append(input().split())
    else:
     afs.append([])
for a in afs[1::2]:
  for b in a:
    k.append(int(b))
r=list(range(1,aa+1))
s=list(set(k))
result = list(filter(lambda x: x not in s, r))
print(len(result))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c=int(input())
d=list(map(int,input().split()))
e=[input() for _ in range(b)]
f=list(map(int,input().split()))

print(a-c)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,K=map(int, input().split())
#print(N,K)
D=[[0 for i in range(N)] for j in range(K)]
#print(D)

for i in range(K):
    d=int(input())
    #print("d=",d)
    S=list(map(int, input().split()))
    #print("S=",S)
    for j in range(d):
        #print(S[j])
        D[(d-1)][S[j]-1] = 1
#print(D)
a = [0, 0, 0]
for i in range(K):
    a=list(map(sum, zip(a, D[:][i])))
    #print(a)
#print(a)
ans = 0
for i in a:
    if i == 0:
        ans = ans + 1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
input_map = {}
for i in range(k):
    d = int(input())
    list = list(input().split())
    input_map.setdefault(d, list)

cnt = 0
for key, value in input_map.items():
    if len(value) >= key:
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
li = []
for x in range(k2):
    li.append(input().split())
li2 = []
i = 1
while i < k2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))

Submission status: Runtime Error

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

for i in range (K * 2):
    l.append(int(input())
l1 = []
x = 1
while x < K * 2:
    for j in l[x]:
        l1.append(j)
    x += 2
l1 = set(l)
print(N - len(l1))

Submission status: Runtime Error

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

ans=[]
for i in range(1,len(d),2):
    ans.append(*d[i])

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  t=input()
  if d==1:
    list=[int(t)]
  else:
    list=list(map(int,t.split()))
  lists.append(list)
ans=[0]*n
for list in lists:
  for i in range(1,len(list)+1):
    ans[i-1]+=1
count=0
for h in ans:
  if h==0:
    count+=1
print(count)

Submission status: Runtime Error

Solution code:
NK = input()
N = int(NK[0])
K = int(NK[2])

sunuke = []
for i in range(N):#人数分のリストを生成
    sunuke.append(0)
    
for i in range(K):#お菓子の種類回数だけinput
    d = input()#いらねえ感はすごい
    A = input()
    for j in A.split(' '):
        sunuke[int(j)-1] = 1
        
count = 0
for i in sunuke:
    if i == 0:
        count += 1
        
print(count)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
lis = []
for i in range(k*2):
    lis.append(input().split())
lis2 = []
j = 1
while j < k2:
    for k in lis[j]:
        lis2.append(k)
    j += 2
lis2 = set(lis2)
print(n - len(lis2))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
u = n
d = [0 for i in range(k)]
a = [0 for i in range(n)]
for i in range(k):
    d[i] = int(input())
    a[i] = list(map(int,input().split()))
pe = [ i+1 for i in range(n)]
for i in range(k):
    for j in range(len(a[i])):
        for v in range(1,n+1):
            if a[i][j] == v:
            	if pe.count(v) > 0:
                	pe.remove(v)               
print(len(pe))

Submission status: Runtime Error

Solution code:
aa,b = map(int, input().split())
afs=[]
k=[]
for _ in range(2*aa-2):
    pnk=input().split()
    afs.append(pnk)
for a in afs[1::2]:
  for b in a:
    k.append(int(b))
r=list(range(1,aa+1))
s=list(set(k))
result = list(filter(lambda x: x not in s, r))
print(len(result))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
S = [input().split() for _ in range(N+K-1)]
new_list = []
for i in range(0,K*2,2):
    for j in S[i]:
        new_list.append(j)
new_list = set(new_list)
print(N - len(new_list))

Submission status: Runtime Error

Solution code:
n,k = list(map(int,input().split()))
a=[]
d=[]
c=0
for i in range(n-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: Runtime Error

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

d_num = int(input())

okasi_nasi = set()
for i in range(d_num):
    okasi_nasi = okasi_nasi | input().split(" ")

print(len(okasi_nasi))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
A = [0] * k
B = []
d = [0] * n
r = 0

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

for l in range(1,k+1):
    if l not in B:
        r += 1

print(r)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

con = 0
ans = list(int() for _ in range(100))
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: Runtime Error

Solution code:
a ,b= map(int,input().split())
aaa = [list(map(int,input().split())) for i in range(b*2)]

s = {i for i in range(1,a+1)}

for i in range(1,a+1,2):
    for k in aaa[i]:
        s.discard(k)

print(len(s))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
input_map = {}
for i in range(k):
    d = int(input())
    list = list(input().split())
    input_map.setdefault(i, list)

cnt = 0
having_list = input_map(k)
for j in having_list:
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
lis = []
for i in range(k*2):
    lis.append(input().split())
lis2 = []
j = 1
while j < k*2:
    for k in lis[j]:
        li2.append(k)
    j += 2
lis2 = set(lis2)
print(n - len(lis2))

Submission status: Runtime Error

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

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

for i in range(K-1):
  setA = set(A[i]) | set(A[i+1])



print(len(setA^setN))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
print("ok")
D = int(input)

ANSlist = [1]*(N -1)

for i in range(1,K):
    S = map(int, input().split())
    for j in range(S):
        ANSlist[S[j]] = 0

ANS = 0

for i in range(N-1):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
aa,b = map(int, input().split())
afs=[]
k=[]
for _ in range(2*aa-2):
    pnk=input().split()
    if pnk:
     afs.append(pnk)
    else:
     afs.append([])
for a in afs[1::2]:
  for b in a:
    k.append(int(b))
r=list(range(1,aa+1))
s=list(set(k))
result = list(filter(lambda x: x not in s, r))
print(len(result))

Submission status: Runtime Error

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(map(int, input().split()))
  sweet-=1
  for j in sweet:
    N_lis[j]+=1
 
no_sweet=N_lis[N_lis==0]
print(no_sweet.sum())

Submission status: Runtime Error

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

Submission status: Runtime Error

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)
  
print(N - len(people))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
S = [input().split() for _ in range(N+K-1)]
new_list = []
for i in range(1,len(S),2):
    for j in S[i]:
        new_list.append(j)
new_list = set(new_list)
print(N - len(new_list))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
a=[]
while K>0:
  d=int(input())
  b=list(map(int,input().split())
  a.extend(b)
  K=K-1
e=collection.Counter(a)
print(N-len(e))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
"""
ある街にN人のすぬけ君(すぬけ君1、すぬけ君2、 ...、 すぬけ君N)が住んでいます。

"""
n, k = map(int, input().split())
input_map = {}
for i in range(k):
    d = int(input())
    input = input()
    list = [int(ai) for ai in input ]
    input_map.setdefault(i, list)

cnt = 0
having_list = input_map(k)
for j in having_list:
    cnt += 1

print(cnt)