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 = [int(x) for x in input().split(' ')]

def solve(n, k):
    snukes = [0] * n
    victims = 0

    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[j-1] = snukes_snacks[j-1]

    for w in range(n):
        if snukes[w] == 0:
            victims += 1
    
    print(snukes)
    print(victims)

solve(n, k)

Submission status: Wrong Answer

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

def solve(n, k):
    snukes = [None] * n
    victims = 0

    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[j-1] = snukes_snacks[j-1]

    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)

solve(n, k)

Submission status: Wrong Answer

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

def solve(n, k):
    snukes = [None] * n
    victims = 0

    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[j-1] = snukes_snacks[j]

    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)

solve(n, k)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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

visited = [False] * N
for i in range(K):
    for j in range(d[i]):
        visited[j] = True

print(visited.count(False))

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

l = []
counter = 0

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

for i in range(1,K+1):
    if Counter(l)[i]==0:
        counter += 1
    else:
        continue
        
print(counter)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# B
n, k = map(int, input().split())
d = []
a = []
people = [0] * n
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int, input().split())))
# print(a)
for i in range(k):
    for j in range(d[i]):
        # print(d[i])
        people[j - 1] += 1
ans = 0
# print(people)
for i in people:
    if i == 0:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
l = []
for k in range(K):
    a = int(input())
    lis=list(map(int,input().split()))
    l.extend(lis)
for j in range(N):
    if not j+1 in l:
        print(j+1)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
l = []
for k in range(K):
    a = int(input())
    lis=list(map(int,input().split()))
    print(lis)
    l.extend(lis)
print(l)
for j in range(N):
    if not j+1 in l:
        print(j+1)

Submission status: Wrong Answer

Solution code:
N, K = [int(i) for i in input().split()]
result = []
for i in range(K):
    d = int(input())
    x = [int(i) for i in input().split()]
    for i in x:
        if x not in result:
            result.append(x)

print(N - len(result))

Submission status: Wrong Answer

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

sunuke = [1] * N

for i in range(K):
    tmp = map(int, input().split())
    for t in tmp:
        sunuke[t-1] = 0
print(sum(sunuke))

Submission status: Wrong Answer

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

for j in range(k):
  d.append(int(input()))
  A.append(list(map(int,input().split())))
  
  
print(d,A)
for i in A:
  for j in i:
    if j in a:
      a.remove(j)
      
      
print(len(a)-1)

Submission status: Wrong Answer

Solution code:
n, k = map(lambda x: int(x), input().split(' '))
sunukes = [0] * int(n)
for i in range(1, k):
    d = input()
    A = map(lambda x: int(x), input().split(' '))
    for a in A:
        sunukes[a - 1] = 1
result = sunukes.count(0)
print(result)

Submission status: Wrong Answer

Solution code:
import math
import time
from collections import defaultdict,deque
from sys import stdin,stdout
from bisect import bisect_left,bisect_right
n,k=map(int,stdin.readline().split())
ans=n
done=defaultdict(lambda:False)
for _ in range(k):
    d=int(input())
    a=list(map(int,stdin.readline().split()))
    if(d not in done):
        ans-=1
        done[d]=True
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int, input().split())
peoples=[]
for i in range(k):
    candies = input()
    # リストに追加
    tmp = [int(i) for i in list(input().split())]
    peoples.extend(tmp)

# listから重複を削除し
print(3-len(set(peoples)))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
d = int(input())
if d < n:
  print(n-d)
else:
  print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1, N + 1):
    all_A.append(i)
for j in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    all_A = set(all_A) ^ set(A)
print(len(all_A))

Submission status: Wrong Answer

Solution code:
[N, K] = list(map(int, input().split()))
all_A =[]
after_A =[]
for i in range(1, N + 1):
    all_A.append(i)
for j in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    after_A = set(after_A) ^ set(A)
print(len(after_A))

Submission status: Wrong Answer

Solution code:
[N, K] = list(map(int, input().split()))
all_A =[]
for i in range(1, N + 1):
    all_A.append(i)
for j in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    after_A = set(all_A) ^ set(A)
print(len(after_A))

Submission status: Wrong Answer

Solution code:
[N, K] = list(map(int, input().split()))
all_A =[]
for i in range(N):
    all_A.append(i)
for j in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    after_A = set(all_A) ^ set(A)
print(len(after_A))

Submission status: Wrong Answer

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


count = [0]*(n+1)

for i in range(k):
    for j in range(d[i]):
        #print(A[i][j])
        count[A[i][j]] += 1

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for j in range(n):
    cnt = 0
    for s in a:
        if (j + 1) in s:
            break
        else:
            cnt += 1
    if cnt >= 1:
        result += 1

print(result)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)

# first line
N, K = list(map(int, input().rstrip().split()))

ans = []
while 1:
    try:
        d = input().rstrip()
        _ = input().rstrip()
        ans.append(d)
    except EOFError:
        break
print(N - len(set(ans)))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)

# first line
N, K = list(map(int, input().rstrip().split()))

ans = []
try:
    for i in range(N):
        d = input().rstrip()
        _ = input().rstrip()
        ans.append(d)
except:
    pass

print(N - len(set(ans)))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)

# first line
N, K = list(map(int, input().rstrip().split()))

ans = []
for i in range(K):
    d = input().rstrip()
    _ = input().rstrip()
    ans.append(d)

print(N - len(set(ans)))

Submission status: Wrong Answer

Solution code:
first_line = list(map(int, input().split()))
N = first_line[0]
K = first_line[1]
rest = list(range(1, N+1))
for i in range(K):
  d = int(input())
  given = list(map(int, input().split()))
  for j in range(1, N+1):
    if j in given and j in rest:
      print(j)
      rest.remove(j)

print(len(rest))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
D=[]
A=[]
for i in range(K):
    d=int(input())
    D.append(d)
    Ai=[int(x) for x in input().split()]
    A.append(Ai)
NUMBERS=[int(x) for x in range(1,N+1)]
for i in range(K):
    for j in range(D[i]):
        if A[i][j] in NUMBERS:
            NUMBERS.remove(A[i][j])
for i in range(len(NUMBERS)):
    print(len(NUMBERS))

Submission status: Wrong Answer

Solution code:
first_line = list(map(int, input().split()))
N = first_line[0]
K = first_line[1]
rest = list(range(1, N+1))
for i in range(K):
  d = int(input())
  given = list(map(int, input().split()))
  for j in rest:
    if j in given:
      rest.remove(j)

print(len(rest))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k = list(map(int,input().split()))
snukes = [0]*n
count = 0
for _ in range(k):
  d = int(input())
  temp = list(map(int,input().split()))
  for i in range(len(temp)):
    snukes[i]+=temp[i]
for i in snukes:
  if i==0:
    count+=1
print(count)

Submission status: Wrong Answer

Solution code:
N, K = (int(num) for num in input().split(" "))
cnt = 0
dic = {i+1: 0 for i in range(N)}
print(dic)
while cnt < K:
    d = input()
    a = input().split(" ")
    for n in a:
        dic[int(n)] += 1
    cnt += 1

treated = 0
for key in dic:
    if dic[key] == 0:
        treated += 1
print(treated)

Submission status: Wrong Answer

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

N1 = N +1
for o in range(1,N+1):
    D.append(o)
    
#print(D)


for i in range(K):
    A =int(input())
    C.append(A)
    B =list(map(int,input().split()))
    for j in D:
        for z in B:
            if j ==z:
                D.remove(j)

#print(D)
                
                
                
#print(E)
print(len(D))

Submission status: Wrong Answer

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

N1 = N +1
for o in range(1,N+1):
    D.append(o)
    
print(D)


for i in range(K):
    A =int(input())
    C.append(A)
    B =list(map(int,input().split()))
    for j in D:
        for z in B:
            if j ==z:
                D.remove(j)

print(D)
                
                
                
#print(E)
print(len(D))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, K = list(map(int, input().split()))
d = defaultdict(list)
for x in range(K):
    input()
    for i in map(int, input().split()):
        d[i].append(True)
count = 0
for i in range(1, K):
    if len(d[i]) == 0:
        count += 1
print(count)

Submission status: Wrong Answer

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

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


for j in range(K):
    d =int(input())
    lista = list(map(int,input().split()))
    for l in list1:
        for h in lista:
            if (l==h):
                list1.remove(l)

print(len(list1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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


for j in range(K):
    d =int(input())
    lista = list(map(int,input().split()))
    for l in list1:
        for h in lista:
            if (l==h):
                list1.remove(l)

print(len(list1))

Submission status: Wrong Answer

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

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



for j in range(K):
    d =int(input())
    lista = list(map(int,input().split()))
    for l in list1:
        for h in lista:
            if (l==h):
                list1.remove(l)

[print(m)for m in list1]

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
mp = [0]*(n+1)
for i in range(k):
  a = list(map(int,input().split()))
  for j in a:
    mp[j]+=1
res = 0
for i in range(1,n+1):
  if mp[i]==0:
    res+=1
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sunuke_list = []
for i in range(K):
    input()
    okashi_sunukes = map(int, input().split())
    for okashi_sunuke in okashi_sunukes:
        sunuke_list.insert(okashi_sunuke, '')

print(N - len(sunuke_list))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
N,K=s.split()
N=int(N)
K=int(K)
line=[]
number=[]
count=0
for n in range(K*2):
    line+=[input()]
for m in range(K):
    line[2*m+1]=line[2*m+1].split()
    number+=line[2*m+1]
for i in range(K):
    if str(i+1) in number:
        count+=1
print(K-count)

Submission status: Wrong Answer

Solution code:
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

n,k = I2()
l = []
for i in range(k):
    d = I()
    for k in intl():
        l.append(k)
print(len(l)-len(list(set(l))))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()  # ignore
  for j in map(int, input().split(" ")):
    flag[j - 1] = 0
sum(flag)

Submission status: Wrong Answer

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

for _ in range(K):
    n = int(input())
    a = list(map(int, input().split()))
    for j in a:
        if j in lists:
            lists.remove(j)
print(len(lists))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
dic={}
for i in range(n):
		dic[i+1]=0;
f=input()
for i in range(k):
	a=list(map(int,input().split()))
	
	for i in a:
		# print(i)
		dic[i]+=1
ans=0
# print(dic)
for i in dic:
	if(dic[i]==0):
		ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N,K = (int(x) for x in input().split())
all = set(map(lambda a: a+1,range(N)))
for i in range(K):
	d = input()
	Ai = set(int(x) for x in input().split())
	all -= Ai
	print(Ai)
print(len(all))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
list = []
for p in range(k):
  k_list = [int(x) for x in input().split()]
  m = len(k_list)
  for q in k_list:
    if not q in list:
      list.append(q)
k_l = len(k_list)
print(n-k_l)

Submission status: Wrong Answer

Solution code:
init=input().split()
num=int(init[0])
snacks=int(init[1])
check=[]

for i in range(snacks):
  sNum=int(input())
  if sNum>1:
    whos=input().split()
    for j in range(sNum):
      check.append(whos[j])
  else:
    who=input()
    check.append(who)
   
count=0
for i in range(1,num):
  if str(i) not in check:
    count=count+1
print(count)

Submission status: Wrong Answer

Solution code:
init=input().split()
num=int(init[0])
snacks=int(init[1])
check=[]

for i in range(snacks):
  sNum=int(input())
  if sNum>1:
    whos=input().split()
    for j in range(sNum):
      check.append(whos[j])
  else:
    who=input()
    check.append(who)
    
for i in range(1,num):
  if str(i) not in check:
    print(i-1)

Submission status: Wrong Answer

Solution code:
init=input().split()
num=int(init[0])
snacks=int(init[1])
check=[]

for i in range(snacks):
  sNum=int(input())
  if sNum>1:
    whos=input().split()
    for j in range(sNum):
      check.append(whos[j])
  else:
    who=input()
    check.append(who)
    
for i in range(1,num):
  if str(i) not in check:
    print(i+1)

Submission status: Wrong Answer

Solution code:
def l(): return [int(a) for a in input().split(" ")] 
ka = l()
lis = [a + 1 for a in range(ka[0])]
input()
for a in range(ka[1]):
  q = l()
  for b in q:
    if b in lis:
      lis.pop(lis.index(b))
print(len(lis))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
list = []
for p in range(k):
  k_list = [int(x) for x in input().split()]
  m = len(k_list)
  for q in range(m):
    if not k_list[q] in list:
      list.append(k_list[q])
k_l = len(k_list)
print(n-k_l)

Submission status: Wrong Answer

Solution code:
n, k = [int(x) for x in input().split()]
d = {}
for _ in range(k):
    d.setdefault(input(), list(map(int, input().split())))
l = []
for _ in d.values():
    l.extend(_)
s = set(l)
print(n - len(s))

Submission status: Wrong Answer

Solution code:
nums = [int(e) for e in input().split()]
N = nums[0]
K = nums[1]

list0 = []
for i in range(0, 2*K):
  val = input()
  if i%2 == 1:
      list0.append(val)

num = N - len(list(set(list0)))

print(num)

Submission status: Wrong Answer

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

for j in range(K):
    d = int(input())
    remove_list = list(map(int,input().split()))
    for k in remove_list:
        try:
            Sunuke.remove(k)
        except ValueError:
            pass

print(len(Sunuke) - 1)

Submission status: Wrong Answer

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

for _ in range(k):
  d = int(input())
  a.add(map(int, input().split()))

print(n - len(a))

Submission status: Wrong Answer

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

for t in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in range(1, n + 1):
        for j in a:
            if j in dict:
                dict[j] += 1
            else:
                dict[i] = 0

res = 0
for v in dict.values():
    if v == 0:
        res += 1
print(res)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, K = [int(_) for _ in input().split()]
A = [[int(_) for _ in input().split()] for i in range(K+K)]
A = [A[i] for i in range(K) if i % 2 == 1]
a = []
for i in A:
    a += i
print(N - len(list(set(a))))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
master = []
count = 0
for num in range(k):
    d = input()
    sunuke = list(map(int,input().split()))
    master+=sunuke

print(3-len(set(master)))

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, K = [int(_) for _ in input().split()]
d1 = int(input())
A = [[int(_) for _ in input().split()] for i in range(K)]
A = [A[i] for i in range(K) if i % 2 == 0]
a = []
for i in A:
    a += i
print(N - len(list(set(a))))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
hoge={}
for j in range(K):
    input()
    [hoge.update({int(j):1}) for j in input().split()]
print(sum([not j in hoge for j in range(N)]))

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()
    print(n,k)
    flag_list = [False] * n
    print(flag_list)
    for _ in range(k):
        d = I()
        print(d)
        a = LI()
        print(a)
        for i in range(d):
            flag_list[a[i]-1] = True
    print('---')
    print(flag_list.count(False))
    print(flag_list)
    
    return


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()
    flag_list = [False] * n
    for _ in range(k-1):
        d = I()
        a = LI()
        for i in range(d):
            flag_list[a[i]-1] = True
    print(flag_list.count(False))
    
    return


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
line1 = input().split()
n = int(line1[0])
k = int(line1[1])
list1 = []
for i in range(k):
  d = input()
  lst = input().split()
  list1 += lst

set1 = set(list1)
print(set1)
nothing = set(str(i+1) for i in range(n)) - set1
print(len(nothing))

Submission status: Wrong Answer

Solution code:
line1 = input().split()
n = int(line1[0])
k = int(line1[1])
list1 = []
for i in range(k):
  d = input()
  lst = input().split()
  list1 += lst

set1 = set(list1)
nothing = set(i for i in range(n)) - set1
print(len(nothing))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
kashi_num = [str(i+1) for i in range(N)]
for _ in range(K):
  d = input()
  for a in input().split():
    if a in kashi_num:
      kashi_num.remove(a)
  if len(kashi_num)==0:
    break
print(' '.join(kashi_num))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
kashi_num = [str(i+1) for i in range(N)]
for _ in range(K):
  d = input()
  for a in input().split():
    if a in kashi_num:
      kashi_num.remove(a)
print(' '.join(kashi_num))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
ans=0
for i in range(K):
    ans=max(ans,int(input()))
    _=input()

print(N-ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,K = list(map(int,input().split()))

snk_sweets = []

for i in range(K):
    try:
        sweets = int(input())
        snk_sweets = (list(int(x) for x in input().split()))

    except:
        break;

counter_snk = Counter(snk_sweets)
len_snk = len(counter_snk.keys())
print(N - len_snk)

Submission status: Wrong Answer

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

snk_sweets = []

for i in range(K):
    try:
        sweets = int(input())
        snk_sweets.append(set(int(x) for x in input().split()))

    except:
        break;

len_snk = len(snk_sweets)
print(N - len_snk)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(len(set(count)-set(A)))

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()
    d = [0]*k
    a = [0]*k
    ans = [0]*k
    for i in range(k):
        d[i] = I()
        a[i] = LI()
        ans[i] = n - d[i]
    print(min(ans))
    return


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()
    d = [0]*k
    a = [0]*k
    for i in range(k):
        d[i] = I()
        a[i] = LI()
    print(n - max(d))
    return


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n, k = LI()
    d = I()
    print(n - d)
    return


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = [0] * n
print(a)
for w in range(k):
    d = int(input())
    ds = list(map(lambda x:int(x),input().split()))
    for i in ds:
        a[i-1] = 1

print(len(list(filter(lambda x:x==0,a))))