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:
import numpy as np
N,K = map( int ,input().split())
A = np.array([[0] * N for i in range(K)])
sum_A = np.array([0]*N)
x = 0
for i in range(K):
    d = int(input())
    num_list = [int(i) for i in input().split()]
    for j in range(len(num_list)):
        A[d-1][num_list[j]-1] = 1
for k in range(K):
    sum_A += A[k] 
for l in range(K):
    if sum_A[l] == 0:
        x += 1
print(x)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
d = {}
while True:
    x = input()
    if x:
        d[x] = list(map(int, input().split()))
    else:
        break
print(N - len(d))

Submission status: Runtime Error

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

for i in range(N):
    person.append(i)

for i in d:
    for j in range(i):
        for k in A[j]:
            if k in person:
                person.remove(k)

print(len(person)-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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(A_list)
    
set_A = set(list_A)

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

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
D=[]
A=set()
for i in range(K):
	D.append(input())
	A.add(int(input()))
S=len(A)
print(N-S)

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())
lists=[]
for _ in range(k):
  d=input()
  if d==1:
    list=[int(input())]
  else:
    list=list(map(int,input().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:
N,K = input().split()
d = input()

print(N-d)

Submission status: Runtime Error

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

count = []

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

for i in range(K):
    tmp = int(input())
    L = list(map(int, input().split()))
    for j in range(len(L)):
        count[L[j]-1] += 1

ans = 0
for i in range(K):
    if count[i] == 0: ans += 1

print(ans)

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

X={}
s=0
for i in range(K):
  a=input()
  b=list(map(int,input().split()))
  for j in b:
    if j in X:
      X[j]+=1
    else:
      X[j]=1
for i in range(N):
  if X[i+1]==0:
    s+=1
print(s)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
int main(){
  int N, K;
  scanf("%d %d", &N, &K);
  int d[K], A[K][100];
  for(int i=0; i<K; i++){
    for(int j=0; j<100; j++)
      A[i][j] = 0;
  }
  for(int i=0; i<K; i++){
    scanf("%d", &d[i]);
    for(int j=0;j<d[i];j++)
      scanf("%d", &A[i][j]);
  }
  int flag=0, count=0;
  for(int t=1;t<=N;t++){
    for(int i=0;i<K;i++){
      for(int j=0;j<100;j++){
        if(A[i][j]==t){
          flag=1;
          break;
        }
      }
      if(flag==1)
        break;
    }
    if(flag==0){
      count++;
    }else{
      flag=0;
    }
  }
  printf("%d\n", count);
}

Submission status: Runtime Error

Solution code:
(n, k) = [int(s) for s in input().split()]

data = [[0 for i in range(k)] for j in range(n)]

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

    for m in a:
        data[m - 1][d - 1] = 1

dd = []



ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)

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+1):
    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,K=(int(x) for x in input().split())
lists=[0]*N
while 1:
    tmp=int(input())
    if not tmp:
        break
    have_count=(int(x) for x in input().split())
    for i in have_count:
        lists[i-1]=1
print(lists.count(0))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split(" "))
trickSum = 0
result = list()
while True :
    d = input()
    if d == "":
        break
    result = result + (list(map(int, input().split(" "))))
print(N - len(set(result)))

Submission status: Runtime Error

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

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())
    for j in range(d):
        input_list = input().split()
        list = [ int(ai) for ai in input_input ]
    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())
d = {}
while True:
    x = input()
    if x:
        d[x] = list(map(int, input().split()))
    else:
        break
print(N - len(d))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
d = [int(input())]
a = [list(map(int, input().split()))]

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

for j in range(0, k):
  for m in range(0, d[j]):
    if a[m] != 0:
      all_sunuke[m] =all_sunuke[m]*0

print(sum(all_sunuke))

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
collection.counter(a)
print(N-len(a))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
d = []
A = []
safe = []
ubsafe = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

for _ in range(K-1):
    for p in range(d[K-1]-1):
        safe.append(A[_][p])
        
L = len(list(set(safe)))
print(N-L)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
aa,b = map(int, input().split())
afs=[]
k=[]
for _ in range(2*aa-2):
    afs.append(input().split())
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) = [int(s) for s in input().split()]

data = [[0 for i in range(k)] for j in range(n)]

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

    for m in a:
        data[m - 1][d - 1] = 1

dd = []

for d in data:
    dd.append(sum(d))

ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
d = []
A = []
safe = []
ubsafe = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

for _ in range(K-1):
    for p in range(d[K-1]):
        safe.append(A[_][p])
        
L = len(list(set(safe)))
print(N-L)

Submission status: Runtime Error

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

d = []
l = []
i = 0

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

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

Submission status: Runtime Error

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

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

for i in range(n):
    if all((x != i for x in a)):
        print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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))
if len(c)>1:
  c=' '.join(c)
  print(c)
else:
  print(c[0])

Submission status: Runtime Error

Solution code:
N , K= map(int, input().split())
d = int(input())
A = list(map(int,input().split()))
dk = [int(input()) for ia in range(K)]
Ak = list(map(int, input().split()))

print(N - d)

Submission status: Runtime Error

Solution code:
N,K=int(int(x) for x in input().split())
lists=[0]*N
while 1:
    tmp=int(input())
    if not tmp:
        break
    have_count=int(input().split())
    for i in have_count:
        lists[i-1]=1
print(lists.count(0))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

n, k = map(int, input().split())
a = np.zeros(n)

for i in range(k):
    d = input()
    temp = input()

    for j in range(int(d)):
        a[int(temp[j*2]) - 1] = 1

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

print(count)

Submission status: Runtime Error

Solution code:
# coding: utf-8
a,b = map(int, input().split())
count=[0]*a
for i in range(b):
    n = int(input())
    num_list = list(map(int, input().split())) 
    for j in num_list:
       count[j-1]+=1
c=0

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

Submission status: Runtime Error

Solution code:
aa,b = map(int, input().split())
s=[]
k=[]
for _ in range(2*aa-2):
    s.append(input().split())
#print("a",a)
#print("s",s[1::2])
for a in s[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())
d = []
A = []
safe = []
ubsafe = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

for _ in range(K):
    for p in range(d[K-1]):
        safe.append(A[_][p])
        
L = len(list(set(safe)))
print(N-L)

Submission status: Runtime Error

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,n+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: Runtime Error

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

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

for i in range(n):
    if all((x == i for x in a)):
        print(i)

Submission status: Runtime Error

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

print( N - d)

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())
    for j in range(d):
        list = list(input())
    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:
^CTraceback (most recent call last):
  File "testcon1.py", line 6, in <module>
    if x>=x2 and x<=y2:
N,K = map(int,input().split())
okashi=[0] * N
for i in range(K):
  x=input()
  y=input().split()
  for j in y:
    okashi[int(j)-1]=1
counter=0

for i in okashi:
  if i==0:
    counter=counter+1
print(counter)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
lis=[i for i in range(1,n+1)]
for i in range(m):
    d=int(input())
    for j in range(d):
        a=int(input())
        if a in lis:
            lis.remove(a)
print(len(lis))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c=int(input())
for i in range(a+b-c):
  d=list(map(int,input().split()))
print(a-c)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
d = int(input())
while True:
  val = [int(i) for i in input().split()]
  if len(val) == 0:
    break

print(N - d)

Submission status: Runtime Error

Solution code:
(n, k) = [int(s) for s in input().split()]

data = arr = [[0 for i in range(k + 1)] for j in range(n + 1)]

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

    for m in a:
        data[m - 1][d - 1] = 1

dd = []

for d in data:
    dd.append(sum(d))

ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)

Submission status: Runtime Error

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

x = 0
for i in range(K):
  d = input()
  x += d[i]
print(N - x)

Submission status: Runtime Error

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 = list(num -c)
L=[str(a) for a in L_int]
L=" ".join(L)
print(L)

Submission status: Runtime Error

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

print(list_A.count(1))

Submission status: Runtime Error

Solution code:
N,K=int(input().split())
lists=[0]*N
while 1:
    tmp=int(input())
    if not tmp:
        break
    have_count=int(input().split())
    for i in have_count:
        lists[i-1]=1
print(lists.count(0))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=input()
  list=list(map(int,input().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:
N, K = map(int, input().split())
mem = set()
for _ in range(K):
  _ = input()
  mem = mem | {input().split()}
mem_count = len(mem)
print(N-mem_count)

Submission status: Runtime Error

Solution code:
import collections

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

L = []
for i in range(K):
    d = int(input())
    for j in range(d):
        L.append(int(input()))

L = collections.Counter(L)
print(N - len(L))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x,y=list(map(int,input().split()))
cal=1
fin=[]
while cal==1:
    tmp=input()
    if tmp=='':
        break
    fin.extend(list(map(int,input().split())))
count=0
for i in range(1,x+1):
    if i not in set(fin):
        count+=1
    #print(i)
print(count)

Submission status: Runtime Error

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

d = []
l = []
i = 0

while i <= 2*K:
  i += 1
  if i % 2 == 1:
    d.append(int(input()))
  else:
    l = l + list(map(int,input().split()))

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

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
withSnacks = []
for x in range(K):
  nUmsnakes = int(input)
  snakes = list(map(int, input().split()))
  withSnacks.extend(snakes)
withSnacks = list(set(withSnacks))
count = 0
for x in range(1, x + 1):
  if not x in withSnacks:
    count += 1

print(count)

Submission status: Runtime Error

Solution code:
N, K = input().split()
num = int(N)
kind = int(K)
dict = {}
for i in range(nun):
  dict[i] = 0

for j in range(kind):
  count = input()
  mem = input().split()
  for mem_f in mem:
    dict[mem] += 1

print(count(dict.value["0"]))

Submission status: Runtime Error

Solution code:
def main():
    n, k = map(int, input().split())
    cnt = [0]*n
    for _ in range(k):
        d = int(input())
        A_i = list(map(int, input().split()))
        for i in range(1, n+1):
            if i not in A_i:
                cnt[i] += 1
    res = 0
    for j in cnt:
        if j == k:
            res += 1
    print(res)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

d = []
l = []
i = 0

while i <= 2*K:
  i += 1
  if i % 2 == 1:
    d.append(int(input()))
  else:
    l + list(map(int,input().split()))

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

Submission status: Runtime Error

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))
print(sunukes)
for i in range(0,k+2,2):
  syoji = sunukes[i]
  okashi = sunukes[i+1]
  print(syoji,okashi)
  for n in okashi:
    if n in names:
      names.remove(n)

print(len(names))

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
m = int(input())
table = [[int(i) for i in input().split()] for m in range(m)]
print(a-m)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


if __name__ == '__main__':
    any_haver = set()
    num_nusuke, num_treat_type = list(map(int, input().split()))
    d_for_loop = int(input())
    for i in range(d_for_loop):
        treat_haver = list(map(int, input().split()))
        for nusuke_id in treat_haver:
            any_haver.add(nusuke_id)
    # check
    count_not_have = 0
    for nusuke_id in range(1, num_nusuke + 1):
        #print('nusuke_id') # debug
        #print(nusuke_id) # debug
        if nusuke_id not in any_haver:
            count_not_have += 1
    #print('count_not_have') # debug
    #print(count_not_have) # debug
    print(count_not_have)



    #print('\33[32m' + 'end' + '\033[0m') # debug

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
(n, k) = [int(s) for s in input().split()]

data = arr = [[0 for i in range(k)] for j in range(n)]

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

    for m in a:
        data[m - 1][d - 1] = 1

dd = []

for d in data:
    dd.append(sum(d))

ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
s = set()
for _ in range(k):
    input()
    s.add(*list(map(int, input().split())))
print(n - len(s))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
from sys import stdin
import re
import bisect
import numpy as np

n, k = map(int(), stdin.readline().rstrip().split())
data = np.zeros((n,k),dtype=bool)
for i in range(k):
    _ = stdin.readline()
    line = map(int(), stdin.readline().rstrip().split())
    for j in line:
        data[i][j] = True

count = int(0)
for i in range(n):
    if (data.T[n]).all() == True:
        count += 1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

d = []
l = []
i = 0

while i <= 2*K:
  i += 1
  if i % 2 == 1:
    d.append(int(input()))
  else:
    l.append(list(map(int,input().split()))

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

Submission status: Runtime Error

Solution code:
n,k=list(map(int, input().split()))
dic={}
for i in range(2*k):
  j=int(input())
  l=list(map(int, input().split()))
  for a in l:
    if a not in dic:
      dic[a]=True
x=len(list(dic.keys()))
print(n-x)

Submission status: Runtime Error

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

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

for i in d:
    for j in range(i):
        for k in A[j]:
            if k in person:
                person.remove(k)

print(len(person))

Submission status: Runtime Error

Solution code:
def do():
    n,m=map(int,input().split())
    d=int(input())
    l=[]
    for i in range(n):
        a=list(map(int,input().split()))
        l.extend(a)
    for j in range(1,n+1):
        if j not in l:
            return j
print(do())

Submission status: Runtime Error

Solution code:

d = []
A = []
for i in range(K):
    _d = int(input())
    d.append(_d)
    _a = [int(x) for x in input().split()]
    A.append(_a)

res = []
for i in range(1, N+1):
    res.append(i)

for a in A:
    for _a in a:
        if _a in res:
            res.remove(_a)
print(len(res))

Submission status: Runtime Error

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

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

print(n-len(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#B問題
N, K = map(int, input().split())
Result = [True] * N
count = 0
for i in range(K):
    d = int(input())
    A = input().split()
    for j in range(len(A_i)):
        Result[A_i[j]-1] = False

count = Result.count(True)
print(count)

Submission status: Runtime Error

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

Solution code:
n,k=map(int,input().split())
l=[]
for k in range(n):
  l.append(k)
for i in range(k):
  d=int(input())
  s=input().split()
  for j in s:
    if int(j) in l:
      l.remove(int(j))
print(len(l))

Submission status: Runtime Error

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

d = []
l = []
i = 0

while i <= 2*K:
  i += 1
  if i % 2 == 1:
    d.append(input())
  else:
    l.appemd(input())

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Solution code:
import numpy as np

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

count = np.zeros(N)

for i in range(K):
    tmp = int(input())
    L = list(map(int, input().split()))
    for j in range(len(L)):
        count[L[j]-1] += 1

ans = 0
for i in range(K):
    if count[i] == 0: ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
#B問題
N, K = map(int, input().split())
Result = [True] * N
for i in range(K):
    d = int(input())
    A = input().split()
    for j in range(len(A_i)):
        Result[A_i[j]-1] = False

count = Result.count(True)
print(count)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())

sunuke_list = [False for i in range(n)]

for i in range(k):
    d = int(input())
    has_sunuke_list = input().split()
    for k in has_sunuke_list:
        sunuke_list[int(k)-1] = True

print(sunuke_list.coutn(False))

Submission status: Runtime Error

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

if __name__ =='__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
import itertools
import heapq
import numpy as np
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,K=nm()
A=[0]*K
for i in range(K):
    d=int(input())
    tmp=nl()
    for j in range(d):
        A[tmp[j]-1]+=1
c=0
for i in range(N):
        if(A[i]==0):
            c+=1

print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#整数の入力
N,K = int(input())

d_list = []
A_list_list = []
for i in range(K):
  #整数の入力
  d = int(input())
  d_list.append(d)
  #スペース区切りの整数の入力リスト
  A_list = list(map(int, input().split()))
  A_list_list.append(A_list)
  
counter = 0
for i in range(N):
  if((i+1 in A_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

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

mat = np.array([[False] * N for i in range(N)])

for i in range(K):
    d = int(input())
    a = list(map(int, input().split()))
    for j in range(d):
        mat[i][a[j]-1] = True

mat = mat.T


ans = 0
for i in range(N):
    flg = False
    for j in range(N):
        if mat[i][j]:
            flg = True

    if not flg:
        ans += 1

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
ans=[None]*n
while k>0:
  d=input()
  a=list(map(int,input().split()))
  #print (d,a)
  for i in a:
    ans[i-1]=d
  k-=1
count=0
for item in ans:
  if item==None:
    count+=1
print (count)a

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, K = int(input().split())
Sunuke = set(range(N))
for i in range(K):
  d = int(input())
  X = list(map(int, input().split()))
  for x in X:
    Sunuke.discard(x-1)
print(len(Sunuke))

Submission status: Runtime Error

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