Problem:


Score : 200 points

Problem Statement

N Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.

There are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \cdots, A_{i, {d_i}}.

Takahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq K \leq 100

1 \leq d_i \leq N

1 \leq A_{i, 1} < \cdots < A_{i, d_i} \leq N

Input

Input is given from Standard Input in the following format:

N K
d_1
A_{1, 1} \cdots A_{1, d_1}
\vdots
d_K
A_{K, 1} \cdots A_{K, d_K}

Output

Print the answer.

Sample Input 1

3 2
2
1 3
1
3

Sample Output 1

1

Snuke 1 has Snack 1.

Snuke 2 has no snacks.

Snuke 3 has Snack 1 and 2.

Thus, there will be one victim: Snuke 2.

Sample Input 2

3 3
1
3
1
3
1
3

Sample Output 2

2



Sample input:
3 2
2
1 3
1
3


Sample output:
1

Submission status: Wrong Answer

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

sunuke=[0]*n

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

print(sunuke.count(0))

Submission status: Wrong Answer

Solution code:
a = 1;
treat = 0;
n, k = map(int, input().split());

data = [input().split() for l in range(2*k)]
print(data);


while a <= n:
    print("これからすぬけ君");
    print(a);
    print("を調べる");
    b = 0;
    d = 0;
    
    while b < k:
        search = int(data[2*b][0]);
        c = 0;
        
        while c < search:
            print("今は");
            print(data[2*b+1][c]);
            x = int(data[2*b+1][c]);
            if x == a :
                d = d + 1;
            c = c + 1
            
        b = b + 1;
        print(d);
        
    if d == 0:
        treat = treat + 1;
        
    a = a + 1;
    
print(treat);

Submission status: Wrong Answer

Solution code:
a = 1;
treat = 0;
n, k = map(int, input().split());

data = [input().split() for l in range(2*k)]


while a <= n:
    b = 0;
    d = 0;
    
    while b < k:
        search = int(data[2*b][0]);
        c = 0
        
        while c < search:
            if data[2*b+1][c] == a:
                d = d + 1;
            c = c + 1
            
        b = b + 1;
        
    if d == 0:
        treat = treat + 1;
        
    a = a + 1;
    
print(treat);

Submission status: Wrong Answer

Solution code:
a = 1;
treat = 0;
n, k = map(int, input().split());

oven = [input() for i in range(2*k)];

while a <= n:
    b = 1;
    c = 0;
    while b <= 2*k-1:
        x = str(a);
        if oven[b].count(x) >= 1:
            c = c + 1;
            
        b = b +2;
        
    if c == 0:
        treat = treat + 1;
        
    a = a + 1;
    
print(treat);

Submission status: Wrong Answer

Solution code:
a = str(1);
treat = 0;
n, k = map(int, input().split());
m = str(n);

oven = [input() for i in range(2*k)];

while a <= m:
    b = 1;
    c = 0;
    while b <= 2*k-1:
        if oven[b].count(a) >= 1:
            c = c + 1;
            
        b = b +2;
        
    if c == 0:
        treat = treat + 1;
        
    x = int(a);
    x = x + 1;
    a = str(x);
    
print(treat);

Submission status: Wrong Answer

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

for i in range(k): #k種類のお菓子を順に見て行く
    d=int(input())  #参照しなくていい数
    a=list(map(int,input().split()))
    for j in a:    #そのお菓子を持っていれば配列の要素を1にする
        ans.append(1)

print(n-sum(ans)) #(全集合)-(お菓子を持っている人)
                  #n-(0+1+1+1+0+0+...)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

for k in a:
    for j in k:
        aa[j-1]=1
        
for x in range(N+1):
    if aa[x-1]==0:
        counts+=1

print(counts)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

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

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

ans = set()
for _ in range(K):
    input()
    ans.add(map(int, input().split()))

print(N-len(ans))

Submission status: Wrong Answer

Solution code:
whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(int(N) - len(set(whatMan)))

Submission status: Wrong Answer

Solution code:
whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(whatMan)

Submission status: Wrong Answer

Solution code:
whatMan = []

N, K = input().split()
print(input().split())

Submission status: Wrong Answer

Solution code:
whatMan = []

N, K = input().split()
for i in range(int(K)):
    print(input().split())

Submission status: Wrong Answer

Solution code:
whatMan = []
 
N, K = input().split()
print(N)

Submission status: Wrong Answer

Solution code:
N,K=map(int, input().split())
kosu = []
for i in range(N):
  kosu.append(0)
for i in range(K):
  d = int(input())
  A=list(map(int, input().split()))
  for t in range(d):
    kosu[t] += 1
print(len([1 for x in kosu if x==0]))

Submission status: Wrong Answer

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

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


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

Submission status: Wrong Answer

Solution code:
import sys

n, k = map(int, sys.stdin.readline().split())

snukes = [1] * n

for _ in range(k):
  nums = list(map(int, sys.stdin.readline().split()))
  for num in nums:
    snukes[num - 1] = 0

print(sum(snukes))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
for i in range (k):
    d=int(input())
    ar=list(map(int,input().split()))
    l=list()
    for j in range(len(ar)):
        l.append(ar[j])
    s=set(l)
    ans=n-len(s)
print(ans)

Submission status: Wrong Answer

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

c = set()
e = set([i for i in range(1,a)])
for i in range(1,len(aaa),2):
  for k in aaa[i]:
     e.discard(k)

print(len(e))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
lists=[]
for _ in range(k):
  d=int(input())
  lis=list(map(int,input().split()))
  lists.append(lis)
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: Wrong Answer

Solution code:
N_nin, K_ko = map(int, input().split())

sunuke = []

for i in range(K_ko):
    d = int(input())
    
    if (d != 1):
        sunuke.append(map(int, input().split()))
    else:
        sunuke.append(int(input()))

ans = N_nin - len(set(sunuke))

print(ans)

Submission status: Wrong Answer

Solution code:
n,*t=open(0)
print(int(n[:2])-len({*''.join(t[1::2]).split()}))

Submission status: Wrong Answer

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

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

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

print(count)

Submission status: Wrong Answer

Solution code:
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(1,NK[0]+1):
    if table.count(j) != 0:
      ans[j-1] = 1
print(NK[1]-sum(ans))

Submission status: Wrong Answer

Solution code:
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) != 0:
      ans[j-1] = 1
print(NK[1]-sum(ans))

Submission status: Wrong Answer

Solution code:
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) != 0:
      ans[j] = 1
print(NK[1]-sum(ans))

Submission status: Wrong Answer

Solution code:
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) != 0:
      ans[j] = 0
print(NK[1]-sum(ans))

Submission status: Wrong Answer

Solution code:
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) == 1:
      ans[j] = 0
print(NK[1]-sum(ans))

Submission status: Wrong Answer

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

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) == 0:
      ans[j] = 0
print(NK[0]-sum(ans))

Submission status: Wrong Answer

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

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) == 0:
      ans[j] = 0
print(1-sum(ans))

Submission status: Wrong Answer

Solution code:
total, kinds = map(int, input().split())

l = [False]*total
print(list)

for i in range(kinds):
    non = input()
    people = list(map(int, input().split()))
    for j in range(len(people)) :
        l[people[j]-1] = True
    
print(l.count(False))

Submission status: Wrong Answer

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


C = [0 for i in range(N+1)]
for i in range(K):
    d.append(input())  #Kこの文字列を読み込み　行列

    A = list(map(int, input().split())) #一行ずつ処理


    for v in A:
        C[v-1] = 1


print(N-sum(C))
print(d)
print(A)

Submission status: Wrong Answer

Solution code:
N, K = [int(ipt) for ipt in input().split(' ')]

sunukekuns = [str(i) for i in range(N)]

for k in range(K):
  _ = input()
  sunukekun = input().split(' ')
  for kun in sunukekun:
    if kun in sunukekuns:
      sunukekuns.remove(kun)

print(len(sunukekuns))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(snuke.count(0))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
s = [input() for i in range(K*2)]
l = []
c = 0
k = 0
m = 0
f = []
# スペース区切りの整数の入力
num = []
for i in range(K*2):
  if i%2==1:
    for m in range(int(s[i-1])):
      num.append(s[i].split()[m])
for j in (1,N+1):
  f.append(num.count(str(j)))
print(N-len(f))

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
s = [input() for i in range(K*2)]
l = []
c = 0
k = 0
m = 0
f = []
# スペース区切りの整数の入力
num = []
for i in range(K*2):
  if i%2==1:
    for m in range(int(s[i-1])):
      num.append(s[i].split()[m])
for j in (1,N):
  f.append(num.count(str(j)))
print(N-len(f))

Submission status: Wrong Answer

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

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for v in A:
        has_snack[v-1] = True

print(sum(has_snack))

Submission status: Wrong Answer

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1::2]
z = ''.join(set(m))
l = ''.join(set(z))
w = l.split()
y = [int(a) for a in w]
output = N - len(y)
print(output)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split()) #n任 k種類
d = []
a = []
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))


sunuke =[0] * n
for i in range(k):
    #print("d[i]",d[i])
    for j in range(int(d[i])):
        temp = a[i][j] -1 
        sunuke[temp] += 1

print(sunuke)
print(sunuke.count(0))

Submission status: Wrong Answer

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1:2]
z = ''.join(set(m))
l = ''.join(set(z))
w = l.split()
y = [int(a) for a in w]
output = N - len(y)
print(output)

Submission status: Wrong Answer

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1::2]
print(m)
z = ''.join(set(m))
l = ''.join(set(z))
print(l)
w = l.split()
y = [int(a) for a in w]
print(y)
output = N - len(y)
print(output)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
s = [input() for i in range(K*2)]
l = []
c = 0
k = 0
m = 0
# スペース区切りの整数の入力
num = []
for i in range(K*2):
  if i%2==1:
    for m in range(int(s[i-1])):
      num.append(s[i].split()[m])
for j in (1,N):
  k=num.count(str(j))
  if k == 0:
    c = c+1
print(c)

Submission status: Wrong Answer

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

sunuke = 0
for i in range(N):
    if i in okashi_sunuke:
        sunuke +=1

print(N-sunuke)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
s = [input() for i in range(K*2)]
l = []
c = 0
k = 0
m = 0
# スペース区切りの整数の入力
num = []
for i in range(K*2):
  if i%2==1:
    for m in range(int(s[i-1])):
      num.append(s[i].split()[m])
for j in (1,N+1):
  k=num.count(str(j))
  if k == 0:
    c = c+1
print(c)

Submission status: Wrong Answer

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

i=0
while i<K*2:
    if not i%2==0:
        anslist.append(numlist[i])
    i+=1

checklist=str(anslist)
ans=0
j=1
while j<N+1:
    check=j
    if str(check) not in checklist:
        ans+=1
    j+=1
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

okashi = [0] * N

for l in range(K):
    print(l)
    for i in A[l]:
        okashi[i-1] += 1

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

print(count)

Submission status: Wrong Answer

Solution code:
N, K= map(int, input().split())
member = [1 for n in range(0, N)]

for i in range(1, K):
  input()
  shuger = map(int, input().split())
  for n in shuger:
    member[int(n)-1]=0
print(member.count(1))

Submission status: Wrong Answer

Solution code:
import itertools
n, k = map(int, input().split())
a = []
n= map(str, list(range(1,n+1)))
for num in range(k):
    d = int(input())
    a.append(list(input()))
#print(set(list(itertools.chain.from_iterable(a))))
#print(n,list(itertools.chain.from_iterable(a)))
#print(set(n)&set(itertools.chain.from_iterable(a)))

list1 = list(set(list(itertools.chain.from_iterable(a))))
list1.sort()
result =list(set(n)-set(list1))
print(len(result))

Submission status: Wrong Answer

Solution code:
# This Python file uses the following encoding: utf-8

# if __name__ == "__main__":
#     pass
n, k = map(int, input().split())
d_a = [list(map(int, input().split())) for i in range(2*k)]

l = list()
for i in range(1, k, 2):
    for j in range(d_a[i-1][0]):
        l.append(d_a[i][j])
print(n - len(l))

Submission status: Wrong Answer

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

l = list()
for i in range(1, k, 2):
    for j in range(d_a[i-1][0]):
        l.append(d_a[i][j])
print(n - len(l))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
data = set(range(N + 1))
data = data - {0}
data_remove = set()
for i in range(K):
    n = int(input())
    data_n = set(input().split())
    data_remove = data_remove | data_n
print(len(data - data_remove))

Submission status: Wrong Answer

Solution code:
NK=input().split()
N=int(NK[0])
K=int(NK[1])
listd=[]
listA=[]
for i in range(K):
    listd.append(input())
    listA.append(input().split())
ans=0
for a in range(1,N+1):
    n=0
    for i in range(1,K+1):
        for j in range(1,int(listd[i-1])+1):
            if a==listA[i-1][j-1]:
                n+=1
            else:
                pass
    if n==0:
        ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
d = []
A = []
while len(d) < K:
    x = input()
    y = list(map(int, input().split()))
    d.append(x)
    A.append(y)
print(N - len(set(d)))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
data = set(range(N + 1))
data = data - {0}
data_remove = set()
for i in range(K):
    n = int(input())
    data_n = set(input().split())
    data_remove = data_remove | data_n
print(data)
print(data_remove)
print(len(data - data_remove))

Submission status: Wrong Answer

Solution code:
import itertools
N, K = map(int, input().split())
d_list = []
A = []
a_set = set()
al_set = {i for i in range(N)}
for i in range(K):
    d_list.append(int(input()))
    A.append(list(map(int, input().split())))
for i in itertools.chain.from_iterable(A):
    a_set.add(i)
print(len(al_set - a_set))

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

Solution code:
N, K= map(int, input().split())
member = [1 for n in range(0, N)]

for i in range(1, K*2, 1):
  shuger = map(int, input().split())
  if i%2==0:
    for n in shuger:
      member[int(n)-1]=0
      #print(n-1)
print(member.count(1))

Submission status: Wrong Answer

Solution code:
import sys
N, K = map(int, input().split())
a = []
a = [list(map(int, input().split())) for _ in range(K*2)]
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: Wrong Answer

Solution code:
N, K = map(int, input().split())
A = [list(map(int,input().split())) for i in range(2*K)]
num = 0
# 偶数行に１〜Nが入っているか確認する
for w, name in enumerate(A[1::2]):
  print(w)
  print(A[1::2][w])
  if w+1 in A[1::2][w]:
    print(num)
    num = num +1
    print(num)
print(num)

Submission status: Wrong Answer

Solution code:
nk = input().split()
n = int(nk[0])
k = int(nk[1])
s = [input() for i in range(k*2)]
o = []

for  j in range(len(s)):
    if j % 2 == 0:
        pass
    else:
        o[len(o):len(o)] = s[j]

l =list(set(o))
ans = n - len(l) 
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1::2]
q = m[0].split()
output = N - len(q)
print(output)

Submission status: Wrong Answer

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

d =[i for i in range(k)]
ans = []

for index in range(k):
  d = int(input())
  ak = [int(x) for x in input().split()]
  ans.extend(ak)

for index in range(n):
  if ans.count(index+1) == 0:
    print(index+1)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
S = set()
for _ in range(K):
    d = int(input())
    S.add(map(int, input().split()))
print(N - len(S))

Submission status: Wrong Answer

Solution code:
import sys
N, K = map(int, input().split())
a = [0] * N
a = [list(map(int, input().split())) for _ in range(K*2)]
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)
				break
print(len(Sunuke))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
data = set(range(1, N - 1))
data_remove = set()
for i in range(K):
    n = int(input())
    data_n = set(input().split())
    data_remove = data_remove | data_n
print(len(data - data_remove))

Submission status: Wrong Answer

Solution code:
nk = input().split()
n = int(nk[0])
k = int(nk[1])
s = [input() for i in range(k*2)]
o = []

for  j in range(len(s)):
    if j % 2 == 0:
        pass
    else:
        o[len(o):len(o)] = s[j]
        print(o)

l =list(set(o))
ans = n - len(l) 
print(ans)

Submission status: Wrong Answer

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:
        itazura = list(sunuke_dic.values()).count(0)
        print(itazura)
        break

Submission status: Wrong Answer

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

listd = list0[1::2]
listf = listd[0]
count = 0
for i in range(1, K):
  listf = listf + listd[i]

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

print(count)

Submission status: Wrong Answer

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

print(len(snukes) - len(set(snukes)))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
c = 0
n = 1
for i in range(K):
  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: Wrong Answer

Solution code:
import sys
N, K = map(int, input().split())
a = [0] * N
a = [list(map(int, input().split())) for _ in range(K*2)]
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: Wrong Answer

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

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

for k in range(K):
    d = int(input())
    A_list = list(map(int,input().split()))
    

    list_A.append(A_list)
for _ in list_A:
    if _ in list_sunuke:
        list_sunuke.remove(_)


print(len(list_sunuke))

Submission status: Wrong Answer

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

sunuke=0
for i in range(1,len(okashi_sunuke)+1):
    if i in okashi_sunuke:
        sunuke +=1

print(N-sunuke)

Submission status: Wrong Answer

Solution code:
nk = input().split()
n = int(nk[0])
k = int(nk[1])
s = [input() for i in range(k*2)]
o = []

for  j in range(len(s)):
    if j % 2 ==0:
        o[len(o):len(o)] = s[j]
    else:
        pass

l =list(set(o))
ans = n - len(l) 
print(ans)

Submission status: Wrong Answer

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

A = []
for i in range(K):
    a = int(input())
    b = map(int, input().split())
    if a not in A:
        A.append(a)
count = 0

for i in A:
    count += 1

print(N - count)

Submission status: Wrong Answer

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

sunuke=0
for i in range(len(okashi_sunuke)+1):
    if i in okashi_sunuke:
        sunuke +=1

print(N-sunuke)

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = input()
n = int(x.split()[0])
k = int(x.split()[1])
moji = ''
count = 0
 
for i in range(k * 2):
  s = input()
  if i % 2 != 0:
    moji = moji + s + ' '
for i in range(n):
  num = str(i+1)
  if moji.count(num):
    count
  else:
    count = count + 1
    
print(count)

Submission status: Wrong Answer

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

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

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
            if not S[j] in ANSlist:
                ANSlist.append(S[j])
                
            


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

Submission status: Wrong Answer

Solution code:
x = input()
n = int(x.split()[0])
k = int(x.split()[1])
moji = ''
count = 0
 
for i in range(k * 2):
  s = input()
  if i % 2 != 0:
    moji = moji + s + ' '
print(moji)
for i in range(n):
  num = str(i+1)
  if moji.count(num):
    count
  else:
    count = count + 1
    
print(count)

Submission status: Wrong Answer

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

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

print(listf)
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def extract(lst, value):
    return [i for i, x in enumerate(lst) if x == value]


import numpy as np

N, K = map(int, input().split())
d = []
A = np.zeros(N + 1)
A[0] = 1
for _ in range(K):
    int(input())
    li = list(map(int, input().split()))
    for i in li:
        A[i] += 1
print(extract(A, 0))
print(A)

Submission status: Wrong Answer

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1::2]
l = list(set(m))
q = l[0].split()
output = N - len(q)
print(output)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
lists = []
for i in range(k) :
    d = int(input())
    lists.append(list(map(int,input().strip().split())))
  
count = -1
trick = 0
for c in range(n) :
    trick = lists.count(c)
    if trick == 0 :
        count += 1
    else :
        count += 0    
print(count)

Submission status: Wrong Answer

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

s=[]
for j in range(1,K+1,2):
    s.append(l[j])

counts=0
for k in range(1,K+1,2):
    for n in range(1,N+1):
        if l[k].count(n)==0:
            counts+=1

print(counts)

Submission status: Wrong Answer

Solution code:
NK = input()
N = int(NK.split()[0]) #すぬけくんの人数
K = int(NK.split()[1]) #お菓子
s = [input() for i in range(K*2)]
m = s[1::2]
print(m)
l = list(set(m))
q = l[0].split()
print(q)
output = N - len(q)
print(output)

Submission status: Wrong Answer

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

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