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 random

def sunuke():
  n = int(input('すぬけくんの人数は??(1-100で入力) :'))
  k = int(input('お菓子の種類は??(1-100で入力) :'))
  n_list = range(n)

  if 1 <= n <= 100 == False or 1 <= k <= 100 == False:
    print("すぬけくん、お菓子の種類は100以下で入力して下さい")
  else:
    treat = 0
    treat_list = {}
    for sunuke in n_list:
      treat_list.setdefault(sunuke, random.randint(0, k))
    
    for x in treat_list.values():
      if x == 0:
        treat += 1

    print('いたずらされるのは' + str(treat) + '人です')

sunuke()

Submission status: Runtime Error

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

Sanuke=list(range(K))

def calc_double(n):
	return n - 1
def calc_zero(n):
	return n *0

Sanuke=map(calc_Sanuke, Sanuke)
  
for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  A=map(calc_double, A)
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
c = 0
n = 1
for i in range(K):
  Lists = list(int(input()))
  List = list(map(int, input().split()))
for I in range(N):
  if n in List:
    n = n+1
  else:
    c = c+1
    n = n+1
print(c)

Submission status: Runtime Error

Solution code:
N, K= map(int, input().split())
d=[]
a=[]
for i in range(N):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
    if N==sum(d):
        print(N-len(set(sum(a,[]))))
        break

Submission status: Runtime Error

Solution code:
n, k = [int(i) for i in input().split()]
ds = []
As = []
for i in range(2*k):
    ds.append(int(input()))
    As += [int(j) for j in input().split()]
 
 
print(n-len(set(As)))

Submission status: Runtime Error

Solution code:
import random

def sunuke():
  n = int(input('すぬけくんの人数は??(1-100で入力) :'))
  k = int(input('お菓子の種類はは??(1-100で入力) :'))
  n_list = range(n)

  if 1 <= n <= 100 == False or 1 <= k <= 100 == False:
    print("すぬけくん、お菓子の種類は100以下で入力して下さい")
  else:
    treat = 0
    treat_list = {}
    for sunuke in n_list:
      treat_list.setdefault(n, random.randint(0, k))
    
    for x in treat_list.values():
      if x == 0:
        treat += 1

    print('いたずらされるのは' + str(treat) + '人です')

sunuke()

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f,g=(int(x) for x in input().split())
a-c

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 21:46:59 2020

@author: nanasakiwataru
"""

N, K = map(int,input().split()) 
P = [list(map(int,input().split())) for i in range(2*K)]
Q = [0]*N
for i in range(1,2*K,1):
    for j in range(len(P[i-1])):
      Q[P[i][j]-1] += 1

cnt = 0
for k in range(N):
    if Q[k] == 0:
        cnt += 1

print(cnt)

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(set(sum(a,[]))))
        break

Submission status: Runtime Error

Solution code:
a,b = (map(int,input().split()))
x = [0]*999999
preans = 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(0,a):
    if j in x:
        preans += 1
print(a-ans)

Submission status: Runtime Error

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

Sanuke=list(range(K))

def calc_double(n):
      return n -1

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  A=map(calc_double, A)
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
di = int(input())
L1 = [list(map(int,input().split())) for i in range(K)]
L2 = list(map(int,input().split()))
print(N-di)

Submission status: Runtime Error

Solution code:
import collections
N,K = input.split()
for i in int(range(K)):
    d = input()
    A = []
    A = input.split()
    c = collections.Counter(A)
    
answer = N - c
print(answer)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
nameset=set()
for i in range(1,K+1):
    d=int(input())
    name=[int,input().split()]
    for t in range(1,d+1):
        nameset.add(name[t-1])
    name.clear()
print(N-int(len(nameset)))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
c = 0
n = 1
List = []
for i in range(1,K):
  d = int(input())
  m = int(input())
  List.append(m)
for I in range(1,N):
  if n in List:
    n = n+1
  else:
    c = c+1
    n = n+1
print(c)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
list0 = [list(map(int, input().split())) for i in range(2*K-1)]
listd = list0[1::2]
listf = listd[0]
count = 0
for i in range(1, K-1):
  listf = listf + listd[i]

for i in range(1, N):
  if i not in listf:
    count = count + 1

print(count)

Submission status: Runtime Error

Solution code:
n, k = [int(i) for i in input().split()]
ds = []
As = ()
for i in range(2*k):
    ds.append(int(input()))
    As += set([int(j) for j in input().split()])


print(n-len(As))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 21:46:59 2020

@author: nanasakiwataru
"""

N, K = map(int,input().split()) 
P = [list(map(int,input().split())) for i in range(2*K)]
Q = [0]*100
for i in range(1,2*K,1):
    for j in range(len(P[i-1])):
      Q[P[i][j]-1] += 1

cnt = 0
for k in range(100):
    if Q[k] == 0:
        cnt += 1

print(cnt)

Submission status: Runtime Error

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

for i,word in enumerate(a):
#	print("i",i,word)
	if (i % 2) == 1:
#		print(word)
		for j,check in enumerate(Sunuke):
			if check in word:
#				print(check,word,Sunuke)  
				Sunuke.remove(check)
print(len(Sunuke))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
A_list  =[]
nuske = np.zeros(n)
import numpy as np
for _ in range(k): 
    d = input()
    a = list(map(int, input().split()))
    for i in a:
        nuske[ i-1] +=1

p =0

for i in range(len(nuske)):
    if nuske[i] ==0:
        p+=1

print(p)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
sunuke_dic = {}
for i in range(N):
    sunuke_dic[i+1] = 0
while True:
    try:
        n = input()
        okasi_get = input()
        for i in okasi_get:
            if i == ' ':
                continue
            else:
                sunuke_dic[int(i)] += 1
    except EOFError:
        itazura = list(sunuke_dic.values()).count(0)
        print(itazura)
        break

Submission status: Runtime Error

Solution code:
N, K= map(int, input().split())
d=[]*N
a=[]*N
while True:
    d.append(int(input()))
    a.append(list(map(int,input().split())))
    if N==sum(d):
        break
print(N-len(set(sum(a,[]))))

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)
for _ in listA:
    
    if _ in list_A:
        list_sunuke.remove(_)


print(len(list_sunuke))

Submission status: Runtime Error

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

Sanuke=list(range(K))

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))-1
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
d_list = []
A_list  =[]
nuske = np.zeros(n)
print(nuske)
import numpy as np
for _ in range(k): 
    d = input()
    a = list(map(int, input().split()))
    for i in a:
        nuske[i-1] +=1

p =0

for i in range(len(nuske)):
    if nuske[i] ==0:
        p+=1

print(p)

Submission status: Runtime Error

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

Sanuke=list(range(K))

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

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+1 for i in range(a)}

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

Submission status: Runtime Error

Solution code:
line1 = list(map(int, input().split()))
peple = list(range(line1[0]+1))
kashi = list(range(line1[1]+1))
peple.remove(0)
kashi.remove(0)

i = 1
while i =< kashi[-1]:

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1

print(len(peple))

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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 21:46:59 2020

@author: nanasakiwataru
"""

N, K = map(int,input().split()) 
P = [list(map(int,input().split())) for i in range(2*K)]
Q = [0]*100
for i in range(1,2*K,1):
    for j in range(P[i-1]):
      Q[P[i][j]-1] += 1

cnt = 0
for k in range(100):
    if Q[k] == 0:
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
kashi = [0] * n
cnt = 0
M = 0
for s in range(n-1):
	i=int(input())
	li=list(map(int,input().split()))
	if i > 0:
		for m in li:
			kashi[m-1] +=1

for i in kashi:
	if i == 0:
		cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
c = 0
n = 1
w = 1
z = 1
while w<=K
  d = int(input())
  List = list(map(int, input().split()))
  w = w+1
while w<=N
  if n in List:
    n = n+1
    z = z+1
  else:
    c = c+1
    n = n+1
    z = z+1
print(c)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
kashi = [0] * n
cnt = 0
M = 0
for s in range(n):
	i=int(input())
	li=list(map(int,input().split()))
	if i > 0:
		for m in li:
			kashi[m-1] +=1

for i in kashi:
	if i == 0:
		cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
namelist=[]
for i in range(1,K+1):
    d=int(input())
    name=[int,input().split()]
    for t in range(1,d+1):
                if not name[t-1] in namelist:
                    namelist.append(name[t-1])               
    name.clear()
print(N-int(len(namelist)))

Submission status: Runtime Error

Solution code:
a,b = (map(int,input().split()))
x = [0]*999999
preans = 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 in x:
        preans += 1
print(a-preans)

Submission status: Runtime Error

Solution code:
import random

def sunuke():
  n = int(input('すぬけくんの人数は??(1-100で入力) :'))
  k = int(input('お菓子の種類はは??(1-100で入力) :'))

  if 1 <= n <= 100 == False or 1 <= k <= 100 == False:
    print("すぬけくん、お菓子の種類は100以下で入力して下さい")
  else:
    treat = 0
    treat_list = []
    for sunuke in n:
      treat_list.setdefault(n, random.randint(0, k))
    
    for x in treat_list.values():
      if x == 0:
        treat += 1

    print('いたずらされるのは' + treat + '人です')

sunuke()

Submission status: Runtime Error

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

Sanuke=list(range(K))

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  for j in A:
    Sanuke[j]+=1

temp=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

Submission status: Runtime Error

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

for i,word in enumerate(a):
	if (i % 2) == 1:
#		print(word)
		for j,check in enumerate(Sunuke):
			if check in word:
#				print(check,word,Sunuke)  
				Sunuke.remove(check)
print(len(Sunuke))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
namelist=[]
for i in range(1,K+1):
    d=int(input())
    name=[int,input().split()]
    for t in range(1,d+1):
                if not name[t-1] in namelist:
                    namelist.append(name[t-1])               
                name.clear()
print(N-int(len(namelist)))

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+1 for i in range(a)}


if(a == 0):
    print(0)
elif(b == 0):
    print(len(aaa))
else:
    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())
s = []
ans = 0
rangecounter = 0
for i in range(k-1):
  d = int(input())
  rangecounter += d
  for j in range(d):
    s.append(input().split())
for i in range(rangecounter):
  if s.count(i) == 0:
    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
import itertools
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):
        break
print(N-len(set(sum(a,[]))))

Submission status: Runtime Error

Solution code:

import sys
import itertools
 
 
N, K = map(int, input().split())

nums = [ ]
for _ in range(N):
    _ =  int(input())
    nums.extend([int(x.strip()) for x in input().split(' ') ])

print(N - len(set(nums)))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
kashi = [0] * n
cnt = 0
M = 0
for s in range(n):
	i=int(input())
	li=list(map(int,input().split()))
	for m in li:
		kashi[m-1] +=1

for i in kashi:
	if i == 0:
		cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
line1 = list(map(int, input().split()))
peple = list(range(line1[0] + 1))
kashi = list(range(line1[1] + 1))
peple.remove(0)
kashi.remove(0)
i = 1
while i < len(kashi):

    holder_count = input()
    holder = list(map(int, input().split()))

    for j in holder:

        try:
        	peple.remove(int(j))
        except ValueError:
        	pass
        finally:

            i = i + 1
print(peple)

peple.remove(0)
print(len(peple))

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
 
p = [1]*a
 
while True:
  try:
    input()
  except EOFError:
    break
  c = input().split()
  for d in c:
    p[int(d)]=0
 
print(sum(p))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
number = 0
data = []
nolist = list(range(1,K+1))
for i in range(N):
  number = int(input())
  for j in range(number):
    data = input().split()
    nolist[int(data[j])-1] = 0
try:
  for i in range(N):
  	nolist.remove(0)
except:
  pass
print(len(nolist))

Submission status: Runtime Error

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

i=1
d=[]
A=[]
while i<=K:
	j=0
	a=[]
    #お菓子iを買う人の人数
	num=int(input())
	d.append(num)
   	#お菓子iを買う人
	a=input().split()
	for x in a:
		a[j]=int(x)
		j=j+1
	A.append(a)
	i=i+1

cnt=0
m=1
while m<=K:
	flag=False
	for j in range(len(A[m-1])):
		if m in A[j]:
			flag=True
			break
	if flag==False:
		cnt=cnt+1
	m=m+1
    
print(cnt)

Submission status: Runtime Error

Solution code:
import itertools
N, K= map(int, input().split())
d=[]*N
a=[]*N
seen = []*N
while True:
    d.append(int(input()))
    a.append(list(map(int,input().split())))
    if N==sum(d):
        break
    elif N<=0 or K<=0:
        break
seen = list(itertools.chain.from_iterable(a))
print(N-len(set(seen)))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
number = 0
data = []
nolist = list(range(1,K+1))
print(nolist)
for i in range(N):
  number = int(input())
  for j in range(number):
    data = input().split()
    nolist[int(data[j])-1] = 0
try:
  for i in range(N):
  	nolist.remove(0)
except:
  pass
print(len(nolist))

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 + 1 for i in range(0,a)}

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 = input().split()
N = int(n[0])
K = int(n[1])
s = [list(map(int, input().split())) for i in range(2*K+1)] 
b = list(range(N))
for l in b:
    for i in range(K):
        di = s[2*i]
        ai = s[2*i+1]
        for k in ai:
            if k == l:
                b.remove(l)
                ai.remove(l)
print(len(b))

Submission status: Runtime Error

Solution code:
import itertools
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
    elif N<=0 or K<=0:
        break
seen = list(itertools.chain.from_iterable(a))
print(N-len(set(seen)))

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())

p = [1]*a

while True:
  if !input():
    break
  c = input().split()
  for d in c:
    p[d]=0

print(sum(p))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
namelist=[]
for i in range(1,K+1):
    d=int(input())
    name=[int,input().split()]
    for t in range(1,d+1):
                if not name[t-1] in namelist:
                    namelist.append(name[t-1])               
                name=[]
print(N-int(len(namelist)))

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <cstdlib>



using ll = long long;
using llu = long long unsigned;

int fastscan(int &x) {
    bool neg = false;
    int c; x = 0; c = getchar();
    if (c == '-') neg = true, c = getchar();
    for (; (c > 47 && c < 58); c = getchar())
        x = x * 10 + c - 48;
    if (neg) x *= -1;
    //printf("c:%d\n", c);
    return c;
}

int main(void)
{

    int snu[1000]={};
    int n, k, di;
    fastscan(n); fastscan(k);
    int sum,out = 0;
    out=fastscan(di);
    do {
        snu[di-1]=1;
        while (((out=fastscan(di))!='\n') && out != EOF);
        if (fastscan(di)!= EOF) continue; else break;
    } while (out != EOF);
    for (int i=0;i<n; i++) {
        if(!snu[i])
            sum++;
    }
    printf("%d", sum);
    return 0;
}

Submission status: Runtime Error

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

for i in range(K):
    I = input() #
    S = list(input())
    for j in range(len(S)):
        if S[j] != " ":
            ANSlist[int(S[j])-1] = 0

ANS = 0

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

print(ANS)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

import sys
sys.setrecursionlimit(12)
n, k =map(int, input().split())
d = int(input())

n_meajor = [0 for i in range(0,n)]

sunuke=[]
count=0

# for i in sys.stdin:
#     sunuke.append(int(input()))

for a in range(0,100):
    sunuke.append(int(input()))

for j in range(0,n):
    if j in sunuke:
        n_meajor[j]=1


sunuke_people = sum(n_meajor)

if sunuke_people<d:
    print(n-d)

else:
    print(n-sunuke_people)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <cstdlib>



using ll = long long;
using llu = long long unsigned;

int fastscan(int &x) {
    bool neg = false;
    int c; x = 0; c = getchar();
    if (c == '-') neg = true, c = getchar();
    for (; (c > 47 && c < 58); c = getchar())
        x = x * 10 + c - 48;
    if (neg) x *= -1;
    //printf("c:%d\n", c);
    return c;
}

int main(void)
{

    int snu[1000]={};
    int n, k, di;
    fastscan(n);
    fastscan(k);
 //   printf("n:%d k:%d\n", n, k);
    int sum,out = 0;
    out=fastscan(di);
    do {
        //printf("out:%d, di:%i\n", out, di);
//        printf("di:%i\n", di);
        snu[di-1]=1;
        int tmp;
        while (((out=fastscan(di))!='\n') && out != EOF);
        if (fastscan(di)!= EOF) continue; else break;
    } while (out != EOF);
    puts("");
    for (int i=0;i<n; i++) {
        if(!snu[i])
            sum++;
    }
    printf("%d", sum);
    return 0;
}

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10**6)]

n,k = map(int,input().split())
lisN = list(range(1,n+1))

lis =[]


for i in range(k):
    a =int(input())
    for j in range(a):
        lis.append(int(input()))

    
print(len(set(lisN) ^ set(lis)))

Submission status: Runtime Error

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

i=1
d=[]
A=[]
while i<=K:
	j=0
	a=[]
    #お菓子iを買う人の人数
	num=int(input())
	d.append(num)
   	#お菓子iを買う人
	a=input().split()
	for x in a:
		a[j]=int(x)
		j=j+1
	A.append(a)
	i=i+1

cnt=0
m=1
while m<=K:
	flag=False
	print(cnt)
	for j in range(len(A[m-1])):
		if m in A[j]:
			flag=True
			break
	if flag==False:
		cnt=cnt+1
	m=m+1

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[2*i+1])
    bi = a[2*i+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:
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)}

if a == 0:
    print(0)
    exit

if b == 0:
    print(len(aaa))
    exit
    

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:
import sys
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)}

if a == 0:
    print(0)
    sys.exit

if b == 0:
    print(len(aaa))
    sys.exit
    

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:
import collections
N,K=map(int,input().split())
while K>0:
  K=K-1
  d=int(input())
  a.append(map(str,input().split()))
e=collections.Counter(a)
p=N-len(e)
print(p)

Submission status: Runtime Error

Solution code:
import itertools
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
seen = list(itertools.chain.from_iterable(a))
print(N-len(set(seen)))

Submission status: Runtime Error

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

i=1
d=[]
A=[]
while i<=K:
	j=0
	a=[]
    #お菓子iを買う人の人数
	num=int(input())
	d.append(num)
   	#お菓子iを買う人
	a=input().split()
	for x in a:
		a[j]=int(x)
		j=j+1
	A.append(a)
	i=i+1

cnt=0
for i in range(K):
	flag=False
	print(cnt)
	for j in range(len(A[i])):
		if i+1 in A[j]:
			flag=True
			break
	if flag==False:
		cnt=cnt+1

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
lisN = list(range(1,n+1))

lis =[]


for i in range(k):
    a =int(input())
    for j in range(a):
        lis.append(int(input()))

    
print(len(set(lisN) ^ set(lis)))

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
kashi = [0] * n
cnt = 0
for s in range(n-1):
	i=int(input())
	li=list(map(int,input().split()))
	for m in li:
		kashi[m-1] +=1

for i in kashi:
	if i == 0:
		cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
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)}

if a == 0:
    print(0)
    sys.exit

if b == 0:
    [print(i) for i in aaa]
    sys.exit
    

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:
import sys
n, k =map(int,input().split())
d = int(input())

n_meajor = [0 for i in range(0,n)]

sunuke=[]
count=0

for i in sys.stdin:
    sunuke.append(int(input()))

for j in range(0,n):
    if j in sunuke:
        n_meajor[j]=1


sunuke_people = sum(n_meajor)

if sunuke_people<d:
    print(n-d)

else:
    print(n-sunuke_people)

Submission status: Runtime Error

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

for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])

for j in range(k):
    for k in range(d[j]):
        c.append(A[j][k])

print(n-len(set(c)))

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])
if set(range(1,n+1)) == l:
	print(0)
else:
	print(len(set(range(1,n+1))-l))

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

Submission status: Runtime Error

Solution code:
import numpy as np
human = []
N,K=input().split()
number = range(K)
for i in range(K):
    d = input()
    A11,Ak1=input().split()
    
    np.insert(human,A11)
    np.insert(human,Ak1)

answer = human - number
print(answer)

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 j in range(len(A)):
		if A[j] in se:
			del se[A[j]]
print(len(se))

Submission status: Runtime Error

Solution code:
def solve():
    N, K = map(int, input().split())
    i = 0
    num = 0
    m = 1
    n = 0
    d = []
    while i < K:
        d[i] = int(input())
        A = []
        for j in range(0, d[i]):
            A[j] = int(input())
    for i in range(0, K):
        num += d[i]
    while m < N + 1:
        times = A.count(m)
        if times == 0:
            n += 1
        m += 1
    print('{}'.format(n))


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
p = []
for s in range(1,K+1):
    p.append(s)
for i in range(K):
    d = int(input())
    A = [int(x) for x in input().split()]
    for j in range(len(A)-1):
        if A[j] in p:
            p.pop(A[j])
ans = len(p)    
print(ans)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
c = 0
n = 0
for i in range(K):
  d = int(input())
  List = list(map(int, input().split()))
for I in range(N):
  n = n+1
  if n in List:
  else:
    c = c+1
print(c)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
namelist=[]
for i in range(1,int(K+1)):
    d=int(input())
    name=[input().split()]
    for t in range(1,d+1):
                if not name[t-1] in namelist:
                    namelist.append(name[t-1])               
                name=[]
print(N-int(len(namelist)))

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([1]*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] = 0

        
for j in have:
    if j == [1]*K:
        result += 1

print(result)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
di=int(input())
List1 = [list(map(int,input().split())) for i in range(K)]
List2 = list(map(int,input().split()))
print(N-di)

Submission status: Runtime Error

Solution code:
import itertools
N, K = list(map(int, input().split()))
d = []
A = [[0]]*N
for i in range(K):
    d.append(int(input()))
    A[i] = list(map(int, input().split()))

s = list(set((list(itertools.chain.from_iterable(A)))))
#print(s)
#s.pop(0)
#print(s)

S = list(range(1,N+1))
#print(S)

for i in range(len(s)):
    if s[i] == 0:
        s.remove(0)
        break

diff = list(set(S) - set(s))
#print(diff)
print(len(diff))

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 i in range(di)]
    for x in Ai :
        S.append(x)

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