ZhenlongDai/ACPR huggingface dataset:
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int,input().split())
ans = [1]*m

for i in range(1,n+1):
    x = list(map(int,input().split()))
    x.pop(0)
    for j in range(m):
        if j not in x:
            ans[j-1] = 0

print(ans.count(1))

Failing test case input:
1 30
3 5 10 30

Expected output:
3

Actual output:
2


Fixed submission (verdict: Accepted):
n, m = map(int,input().split())
ans = [1]*m

for i in range(n):
    x = list(map(int,input().split()))
    x.pop(0)
    for j in range(1,m+1):
        if j not in x:
            ans[j-1] = 0

print(ans.count(1))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int, input().split())
count = 0
for i in range(n):
  k, *aaa = list(map(int, input().split()))
  if i == 0:
    mmm = aaa
  for j in mmm:
    if not j in aaa:
      mmm.remove(j)
print(len(mmm))

Failing test case input:
3 7
2 1 3
3 1 2 3
2 5 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
lll = [0]*m
for i in range(n):
  k, *aaa = list(map(int, input().split()))
  for a in aaa:
    lll[a-1] += 1
count = 0
for l in lll:
  if l == n:
    count += 1
print(count)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

n,m = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]

lin = []
for i in range(n):
    lin.append(li[i][1:])

flat = [flatten for inner in lin for flatten in inner]

flat.sort()

point = 0
for i in range(m):
    if flat.count(i) == n:
        point += 1
print(point)

Failing test case input:
1 30
2 3 20 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
from sys import stdin

n,m = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]

lin = []
for i in range(n):
    lin.append(li[i][1:])

flat = [flatten for inner in lin for flatten in inner]

flat.sort()
point = 0
for i in range(1,m+1):
    if flat.count(i) == n:
        point += 1
print(point)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = [int(i) for i in input().split(" ")]

pre_res = [0 for i in range(m)]

for i in range(n):
    sel = [int(i)-1 for i in input().split(" ")][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[s] == n:
        res += 1

print(res)


Failing test case input:
1 50
1 7 6 3

Expected output:
3


Actual output:
50


Fixed submission (verdict: Accepted):
n, m = [int(i) for i in input().split(" ")]

pre_res = [0 for i in range(m)]

for i in range(n):
    sel = [int(i)-1 for i in input().split(" ")][1:]
    for s in sel:
        pre_res[s] += 1

res = 0
for i in range(m):
    if pre_res[i] == n:
        res += 1

print(res)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=[int(i) for i in input().split()]
P=[[int(i) for i in input().split()] for j in range(n)]

for i in range(n):
    del P[i][0]
    
K = set(P[0])
L = {}
for i in range(1,n):
    L = set(P[i])
    K = K & L
M = list(K)
if len(M) == 0:
    print(0)
else:
    for i in range(len(M)):
        print(M[i])

Failing test case input:
1 30
3 3 20 30

Expected output:
3


Actual output:
3
20
30


Fixed submission (verdict: Accepted):
n,m=[int(i) for i in input().split()]
P=[[int(i) for i in input().split()] for j in range(n)]

for i in range(n):
    del P[i][0]
    
K = set(P[0])
L = {}
for i in range(1,n):
    L = set(P[i])
    K = K & L
print(len(K))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = list(map(int, input().split()))
food = []
for i in range(M):
    food.append(True)

for i in range(N):
    x = list(map(int, input().split()))
    for j in x[1:]:
        food[j-1] = False

print(food.count(True))

Failing test case input:
1 54
5 4 16 6

Expected output:
3


Actual output:
51


Fixed submission (verdict: Accepted):
N,M = list(map(int, input().split()))
food = []
for i in range(M):
    food.append(0)

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

print(food.count(N))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
list = [list(map(int,input().split())) for x in range(N)]


for i in range(0,N):
    list[i].pop(0)

stock = []


for i in range(0,N):
    if N == 1:
        stock = list[i]
    else:
        cnt = 0
        for j in range(0,len(list[i])):
            if list[i][j] in list[i]:
                cnt += 1
        if cnt == N:
            stock.append(list[i][j])

print(len(stock))

Failing test case input:
3 7
2 1 3
1 0 2 3
0 4 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
list = [list(map(int,input().split())) for x in range(N)]


for i in range(0,N):
    list[i].pop(0)

stock = []


for i in range(0,N):
    for j in range(0,len(list[i])):
        cnt = 0
        for k in range(0,N):
            if list[i][j] in list[k]:
                cnt += 1
        if cnt == N:
            stock.append(list[i][j])

if N == 1:
    stock = list[i]

print(len(set(stock)))

Problem: p03126
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,m = map(int, input().split())
judge = [i for i in range(1, m+1)]
for i in range(n):
    a = list(map(int, input().split()))
    a.pop(0)
    for j in judge:
        if not j in a:
            judge.remove(j)
print(len(judge))


Failing test case input:
1 30
3 5 10 30

Expected output:
3

Actual output:
16


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
judge = [i for i in range(1, m+1)]
ans = [1 for i in range(m)]
for i in range(n):
    a = list(map(int, input().split()))
    a.pop(0)
    for j in judge:
        if not j in a:
            ans[j-1] = 0
print(sum(ans))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=[int(i) for i in input().split()]
foods=set(range(M))
for i in range(N):
    foods=foods&set([int(i) for i in input().split()][1:])
print(len(foods))

Failing test case input:
1 30
3 4 20 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N,M=[int(i) for i in input().split()]
foods=set(range(1,M+1))
for i in range(N):
    foods=foods&set([int(i) for i in input().split()][1:])
print(len(foods))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())

ans = 0
i_list = []

for i in range(N):
	tmp_list = list(map(int,input().split()))
	i_list.extend(tmp_list[1:])
	print(i_list)

for i in range(1,M+1):
  if i_list.count(i) == N:
    ans += 1

print(ans)

Failing test case input:
1 30
3 2 10 20

Expected output:
3


Actual output:
[2, 10, 20]
3


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())

ans = 0
i_list = []

for i in range(N):
	tmp_list = list(map(int,input().split()))
	i_list.extend(tmp_list[1:])

for i in range(1,M+1):
  if i_list.count(i) == N:
    ans += 1

print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
K = [None]*30
A = [None]*30
Ms = [0]*31
def main():
    N, M = map(int, input().split())
    for i in range(N):
        K[i], *A[i], = map(int, input().split())
    for i in A:
        if i == None:
            break
        for j in i:
            print(j)
            Ms[j] += 1
    print(Ms.count(N))

main()


Failing test case input:
1 30
2 2 10 19

Expected output:
3


Actual output:
2
10
19
3


Fixed submission (verdict: Accepted):
K = [None]*30
A = [None]*30
Ms = [0]*31
def main():
    N, M = map(int, input().split())
    for i in range(N):
        K[i], *A[i], = map(int, input().split())
    for i in A:
        if i == None:
            break
        for j in i:
            Ms[j] += 1
    print(Ms.count(N))

main()

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import collections

N = int(sys.stdin.readline().strip().split()[0])
print("N=",N)

new = []
for i in range(N):
  tmp = sys.stdin.readline().strip().split()
  for j in range(len(tmp)-1):
    new.append(tmp[j+1])

print("new len:, ",len(new))
    
c = collections.Counter(new)


cnt = 0
for i in range(len(c.most_common())):
  if int(c.most_common()[i][1]) == N:
    cnt += 1
  else:
    break
    
print(cnt)

Failing test case input:
3 7
2 1 3
1 0 2 3
0 4 2

Expected output:
0


Actual output:
N= 3
new len:,  7
0


Fixed submission (verdict: Accepted):
import sys
import collections

N = int(sys.stdin.readline().strip().split()[0])

new = []
for i in range(N):
  tmp = sys.stdin.readline().strip().split()
  for j in range(len(tmp)-1):
    new.append(tmp[j+1])

c = collections.Counter(new)


cnt = 0
for i in range(len(c.most_common())):
  if int(c.most_common()[i][1]) == N:
    cnt += 1
  else:
    break
    
print(cnt)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
a = []
counter = 0
total = [0 for i in range(M + 1)]
for i in range(N):
  for j in (list(map(int, input().split()))[1 :]):
    total[j] += 1
for i in range(M):
  if total[i] == N:
    counter += 1
    
print(counter)

Failing test case input:
1 30
3 3 20 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
a = []
counter = 0
total = [0 for i in range(M + 1)]
tmp = []
for i in range(N):
  tmp.append(list(map(int, input().split()))[1 :])
for i in tmp:
  for j in i:
    total[j] += 1
for i in range(len(total)):
  if total[i] == N:
    counter += 1
    
print(counter)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
a = [0] * n
food = [0] * (m+1)
for i in range(n):
    a = list(map(int, input().split()))
    for j in a[1:]:
        food[j] += 1

sum = 0
for i in range(m):
    if food[i] == n:
        sum += 1

print(sum)

Failing test case input:
1 30
2 4 20 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = [0] * n
food = [0] * (m+1)
for i in range(n):
    a = list(map(int, input().split()))
    for j in a[1:]:
        food[j] += 1

sum = 0
for i in range(1,m+1):
    if food[i] == n:
        sum += 1

print(sum)

Problem: p03126
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=map(int,input().split())
h={i for i in range(1,M+1)}
for _ in range(N):
  a=list(map(int,input().split()))
  a=set(a[1:])
  h-=a
print(len(a))

Failing test case input:
3 7
4 1 3
3 1 2 3
2 3 2

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
h={i for i in range(1,M+1)}
for _ in range(N):
  a=list(map(int,input().split()))
  a=set(a[1:])
  h&=a
print(len(h))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



N, M = [int(x) for x in input().split()]
ls =[]
for _ in range(N):
    foodlist = [int(x) for x in input().split()]
    ls += foodlist

answer = 0
for M  in range(M):
    if ls[1:].count(M +1) == N:
        answer += 1

print (answer)


Failing test case input:
3 7
2 1 3
3 1 2 3
2 5 -1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):



N, M = [int(x) for x in input().split()]
ls =[]
for _ in range(N):
    foodlist = [int(x) for x in input().split()]
    ls += foodlist[1:]

answer = 0
for M  in range(M):
    if ls.count(M +1) == N:
        answer += 1

print (answer)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
del l[0:N][0]

sum = []
for i in range(N-1):
  sum += list(set(l[i])&set(l[i+1]))

print(len(sum))

Failing test case input:
1 30
5 2 4 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
for i in range(N):
  del l[i][0]

for i in range(N-1):
    a = set(l[i])&set(l[i+1])
    l[i+1] = a
if N==1:
  print(len(l[0])) 
else:
  print(len(a))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = [int(item) for item in input().split()]

k = []
list = [0] * m
for i in range(n):
  line = [int(item) for item in input().split()]
  for item in range(m):
    if item in line[1:]:
      list[item] += 1

num = 0
for item in list:
  if item == n:
    num+=1

print(num)

Failing test case input:
1 30
2 3 20 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n, m = [int(item) for item in input().split()]

k = []
list = [0] * m
for i in range(n):
  line = [int(item) for item in input().split()]
  for item in range(m):
    if (item+1) in line[1:]:
      list[item] += 1

num = 0
for item in list:
  if item == n:
    num+=1

print(num)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int,input().split())

allset = set()
for i in range(n):
    l_raw = input().split()
    l_new = l_raw[1:]
    if i != 0:
        allset = allset ^ set(l_new)
    else:
        allset = set(l_new)

print(len(allset))

Failing test case input:
3 7
2 1 3
3 1 2 3
2 3 1

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n, m = map(int,input().split())

allset = set()
for i in range(n):
    l_raw = input().split()
    l_new = l_raw[1:]
    if i != 0:
        allset = allset & set(l_new)
    else:
        allset = set(l_new)


print(len(allset))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

(sn, sm) = sys.stdin.readline().split()
n = int(sn)
m = int(sm)

flg = [0 for j in range(m)]
for i in range(n):
  sa = sys.stdin.readline().split()
  for saj in sa:
    aj = int(saj)
    flg[aj - 1] += 1

suma = 0
for sumaj in flg:
  if sumaj == n:
    suma += 1
print(suma)

Failing test case input:
1 38
6 6 2 11

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import sys

(sn, sm) = sys.stdin.readline().split()
n = int(sn)
m = int(sm)

flg = [0 for j in range(m)]
for i in range(n):
  sa = sys.stdin.readline().split()
  if len(sa) > 1:
    for saj in sa[1:]:
      aj = int(saj)
      flg[aj - 1] += 1

suma = 0
for sumaj in flg:
  if sumaj == n:
    suma += 1
print(suma)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
n,m=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(list(map(int,input().split())))
  del a[i][0]
a=list(itertools.chain.from_iterable(a))
count=0
for i in range(0,m):
  if a.count(i)==n:
    count=count+1
print(count)

Failing test case input:
1 30
5 2 4 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import itertools
n,m=map(int,input().split())
a=[]
for i in range(0,n):
  a.append(list(map(int,input().split())))
  del a[i][0]
a=list(itertools.chain.from_iterable(a))
count=0
for i in range(0,m):
  if a.count(i+1)==n:
    count=count+1
print(count)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int, input().split())

listA = [[list(map(int, input().split()))] for j in range(n)]

ans = 0


for a in range(m):
    for i in range(n):
        if a in listA[i]:
            ans += 1


print(ans)

Failing test case input:
1 60
3 2 3 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())

listA = [list(map(int, input().split())) for j in range(n)]

ans = 0


for a in range(1, m+1):
    ok = True
    for i in range(n):
        if a not in listA[i][1:]:
            ok = False
    if ok:
        ans += 1



print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


def main():
    A,B = map(int,input().split())
    
    originalList = set(list(map(int,input().split()))[1:])
    print(originalList)
    for i in range(A-1):
        list1=set(list(map(int,input().split()))[1:])
        print(list1)
        print(type(list1))
        originalList = originalList & list1
        print(originalList)
        print(type(originalList))

    print(len(originalList))










if __name__== "__main__":
    main() 

Failing test case input:
1 89
2 16 1 30

Expected output:
3


Actual output:
{16, 1, 30}
3


Fixed submission (verdict: Accepted):


def main():
    A,B = map(int,input().split())
    
    originalList = set(list(map(int,input().split()))[1:])
    for i in range(A-1):
        list1=set(list(map(int,input().split()))[1:])
        originalList = originalList & list1

    print(len(originalList))


if __name__== "__main__":
    main()
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
favlist = []
for i in range(n):
    favlist.append(list(map(int, input().split())))
notfav = favlist[0]

if n != 1:
    for i in range(n):
        for j in range(1, len(notfav)):
            if not notfav[j] in favlist[i]:
                notfav[j] = 0
    print(m - len(notfav))
else:
    print(len(favlist[0]) - 1)

Failing test case input:
3 9
2 1 3
3 0 2 3
0 4 1

Expected output:
0


Actual output:
6


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
favlist = []
notfav = []
for i in range(n):
    favlist.append(list(map(int, input().split())))

for i in range(1,len(favlist[0])):
    notfav.append(favlist[0][i])

for i in range(n):
    favlist[i][0] = 0

if n != 1:
    for i in range(n):
        for j in range(len(notfav)):
            if not notfav[j] in favlist[i]:
                notfav[j] = 0
    cnt = 0
    for i in range(len(notfav)):
        if notfav[i] != 0:
            cnt += 1
    print(cnt)
else:
    print(len(favlist[0]) - 1)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int,input().split())
S = {i+1 for i in range(M)}

for i in range(N):
    L = [int(j) for j in input().split()]
    K = set(L[1::])
    S = S & K
    print(S)
print(len(S))



Failing test case input:
1 52
5 5 10 22

Expected output:
3


Actual output:
{10, 5, 22}
3


Fixed submission (verdict: Accepted):
N, M = map(int,input().split())
S = {i+1 for i in range(M)}

for i in range(N):
    L = [int(j) for j in input().split()]
    K = set(L[1::])
    S = S & K
    
print(len(S))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = list(map(int, input().split()))

list = [list(map(int, input().split())) for i in range(n[0])]

a = {}
for i in list:
    for j in i[1:]:
        if j in a:
            a[j] = a[j] + 1
        else:
            a[j] = 1

cnt = 0
for x in a:
    if x == n[0]:
        cnt += 1

print(cnt)

Failing test case input:
1 30
3 2 4 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n = list(map(int, input().split()))

list = [list(map(int, input().split())) for i in range(n[0])]

a = {}
for i in list:
    for j in i[1:]:
        if j in a:
            a[j] = a[j] + 1
        else:
            a[j] = 1

cnt = 0
for x in a.values():
    if x == n[0]:
        cnt += 1

print(cnt)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=list(map(int,input().split()))
a=set(input()[1:])
for i in range(n-1):
  b=set(input()[1:])
  a=set(a&b)
print(len(a)-1)


Failing test case input:
1 52
5 5 10 30

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n,m=list(map(int,input().split()))
a=set(input().split()[1:])
for i in range(n-1):
  b=set(input().split()[1:])
  a=set(a&b)
print(len(a))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

def main():
  input = sys.stdin.readline
  N, M = map(int, input().split())
  A = set(list(range(1, N+1)))
  for _ in range(N):
    B = set(list(map(int, input().split()))[1:])
    A = A & B
  print(len(A))


if __name__ == '__main__':
  main()

Failing test case input:
1 43
5 9 6 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
import sys

def main():
  input = sys.stdin.readline
  N, M = map(int, input().split())
  A = set(list(range(1, M+1)))
  for _ in range(N):
    B = set(list(map(int, input().split()))[1:])
    A = A & B
  print(len(A))


if __name__ == '__main__':
  main()

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int, input().split())
k = set(range(m))
for i in range(n):
    temp_k = list(map(int, input().split()))
    k = k & set(temp_k[1::])
print(len(k))

Failing test case input:
1 30
3 1 10 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
k = set(range(1, m + 1))
for i in range(n):
    temp_k = list(map(int, input().split()))
    k = k & set(temp_k[1::])
print(len(k))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
food=[] 
for i in range(n):
    food.append(list(map(int,input().split())))

tmp = set(food[0][1:])
for i in range(1, n-1):
    tmp = tmp & set(food[i+1][1:])
print(len(tmp))

Failing test case input:
3 7
2 1 3
3 0 2 3
2 5 1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
food=[] 
for i in range(n):
    food.append(list(map(int,input().split())))

tmp = set(food[0][1:])
for i in range(1, n):
    tmp = tmp & set(food[i][1:])
print(len(tmp))

Problem: p03126
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int, input().split())
an_li = list(map(int, input().split()))
an_li.remove(an_li[0])
for i in range(N-1):
    li = list(map(int, input().split()))
    li.remove(li[0])
    for t in an_li:
        if t in li:
            a = 1
        else:
            an_li.remove(t)
print(len(an_li))

Failing test case input:
3 9
2 0 3
3 0 2 3
0 2 1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
an_li = list(map(int, input().split()))
an_li.remove(an_li[0])
for i in range(N-1):
    flag = False
    r = []
    li = list(map(int, input().split()))
    li.remove(li[0])
    for t in an_li:
        if t in li:
            a = 1
        else:
            r.append(t)
            flag = True
    if flag:
        for w in r:
            an_li.remove(w)
print(len(an_li))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
A = []

for i in range(N):
    A.append([int(m) for m in input().split()])
    A[i].pop(0)
cnt =0
for i in range(M):
    flag = 1
    for k in range(N):
        if i not in A[k]:
            flag = 0
    if flag == 1:
        cnt += 1
        

print(cnt)

Failing test case input:
1 30
5 2 10 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = []

for i in range(N):
    A.append([int(m) for m in input().split()])
    A[i].pop(0)
cnt =0
for i in range(1,M+1):
    flag = 1
    for k in range(N):
        if i not in A[k]:
            flag = 0
    if flag == 1:
        cnt += 1
        

print(cnt)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = map(int,input().split())
K_A = []
for i in range(N):
	K_A.append(list(map(int,input().split())))

l = []

for i in range(N):
	del K_A[i][0]
	for j in range(len(K_A[i])):
		l.append(K_A[i][j])
		
count = 0

for i in range(K+1):
	print(l.count(i),i)
	if l.count(i) == N:
		count  += 1

print(count)


Failing test case input:
1 30
5 9 2 30

Expected output:
3


Actual output:
0 0
0 1
1 2
0 3
0 4
0 5
0 6
0 7
0 8
1 9
0 10
0 11
0 12
0 13
0 14
0 15
0 16
0 17
0 18
0 19
0 20
0 21
0 22
0 23
0 24
0 25
0 26
0 27
0 28
0 29
1 30
3


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
K_A = []
for i in range(N):
	K_A.append(list(map(int,input().split())))

l = []

for i in range(N):
	del K_A[i][0]
	for j in range(len(K_A[i])):
		l.append(K_A[i][j])
		
count = 0

for i in range(K+1):
	if l.count(i) == N:
		count  += 1

print(count)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
s=set(range(1,m))
for i in range(n):
	_,*a = list(map(int,input().split()))
	s &= set(a)

print(len(s))



Failing test case input:
1 30
6 6 2 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
s=set(range(1,m+1))
for i in range(n):
	_,*a = list(map(int,input().split()))
	s &= set(a)

print(len(s))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int, input().split())
a= [list(map(int,input().split())) for i in range(n)]
for i in range(n):
    del a[i][0]
print(a)
v=[]

x=0
for i in range(31):
    for j in range(n):
        v.append(a[j].count(i))
print(v)
for i in range(0,31,n):
    print(v[i:i+n])
    if v[i:i+n].count(1)==n:
        x+=1

  
print(x)

Failing test case input:
1 31
2 1 15 30

Expected output:
3


Actual output:
[[1, 15, 30]]
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
[0]
[1]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[1]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[1]
3


Fixed submission (verdict: Accepted):
n,m=map(int, input().split())
a= [list(map(int,input().split())) for i in range(n)]
for i in range(n):
    del a[i][0]
v=[]

x=0
for i in range(1,m+1):
    for j in range(n):
        v.append(a[j].count(i))

for i in range(0,m*n,n):
  
    if v[i:i+n].count(1)==n:
        x+=1

  
print(x)

Problem: p03126
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,m=map(int,input().split())
l=[0 for i in range(m)]
for i in range(n):
  s=input().split()
  for j in s[1:]:
    l[int(j)-1]+=1
res=0
for i in l:
  if i==m:
    res+=1
print(res)

Failing test case input:
1 60
3 2 3 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
l=[0 for i in range(m)]
for i in range(n):
  s=input().split()
  for j in s[1:]:
    l[int(j)-1]+=1
res=0
for i in l:
  if i==n:
    res+=1
print(res)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
for i in range(N):
  del l[i][0]
if N!=1:
  for i in range(N-1):
    a = set(l[i])&set(l[i+1])
    l[i+1] = a
    print(len(a))
else:
  print(len(l))

Failing test case input:
1 50
1 4 10 3

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
for i in range(N):
  del l[i][0]

for i in range(N-1):
    a = set(l[i])&set(l[i+1])
    l[i+1] = a
if N==1:
  print(len(l[0])) 
else:
  print(len(a))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b = map(int, input().split())
c = []
for i in range(a):
  *s, = map(int, input().split())
  c += s[1:]
count=[]
e = c[:]
d=list(set(c))

for i in d:
  if c.count(i) == a:
    count.append(i)
  else:continue

Failing test case input:
3 7
2 1 3
1 0 2 3
0 4 2

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
c = []
for i in range(a):
  *s, = map(int, input().split())
  c += s[1:]
count=[]
e = c[:]
d=list(set(c))

for i in d:
  if e.count(i) == a:
    count.append(i)
    
print(len(count))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map( int,input().split() )
k = [ list(map( int,input().split() )) for _ in range(n) ]

c = [0] * (m+1)

for i in k:
  for j,data in enumerate(i):
    if j == 0:
      continue
    else:
      c[data] += 1

ans = 0
for i in c:
  if i == 3:
    ans += 1

print(ans)


Failing test case input:
1 31
2 1 20 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n,m = map( int,input().split() )
k = [ list(map( int,input().split() )) for _ in range(n) ]

c = [0] * (m+1)

for i in k:
  for j,data in enumerate(i):
    if j == 0:
      continue
    else:
      c[data] += 1

ans = 0
for i in c:
  if i == n:
    ans += 1

print(ans)

Problem: p03126
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, M = map(int, input().split())
A = []
for n in range(N):
    KA = list(map(int, input().split()))
    A.append(KA[1:])

if N == 1:
    print(len(A))
    quit()
else:
    res = list(set(A[0]) & set(A[1]))
    for a, v in enumerate(A):
        res = list(set(res) & set(v))
    print(len(res))

Failing test case input:
1 38
2 2 10 30

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = []
for n in range(N):
    KA = list(map(int, input().split()))
    A.append(KA[1:])

if N == 1:
    print(len(A[0]))
    quit()
else:
    res = list(set(A[0]) & set(A[1]))
    for a, v in enumerate(A):
        res = list(set(res) & set(v))
    print(len(res))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = input().split(" ")
S = set(str(i) for i in range(1, int(M)+1))
print(S)

for _ in range(int(N)):
    S = S & set(input().split(" ")[1:])
print(len(S))

Failing test case input:
1 30
3 2 10 20

Expected output:
3


Actual output:
{'3', '11', '10', '12', '29', '21', '23', '25', '1', '6', '4', '18', '19', '22', '24', '20', '27', '28', '17', '2', '16', '9', '8', '7', '14', '26', '13', '15', '30', '5'}
3


Fixed submission (verdict: Accepted):
N, M = input().split(" ")
S = set(str(i) for i in range(1, int(M)+1))
for _ in range(int(N)):
    S = S & set(input().split(" ")[1:])
print(len(S))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin, exit
from math import factorial
input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())
si = lambda: input().strip('\n')
ssi = lambda: input().strip('\n').split()

n, m = mi()
foods = [0 for i in range(m+1)]
for i in range(n):
    arr = lmi()
    for j in arr:
        foods[j] += 1
cnt= 0
for i in range(1, m+1):
    if foods[i] == n:
        cnt += 1
print(cnt)

Failing test case input:
1 30
3 3 20 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
from sys import stdin, exit
from math import factorial
input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())
si = lambda: input().strip('\n')
ssi = lambda: input().strip('\n').split()

n, m = mi()
foods = [0 for i in range(m+1)]
for i in range(n):
    arr = lmi()
    for j in arr[1:]:
        foods[j] += 1
cnt= 0
for i in range(1, m+1):
    if foods[i] == n:
        cnt += 1
print(cnt)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
KA = [list(map(int,input().split())) for i in range(N)]

tabe = []

for i in range(1,M+1):
    tabe.append(int(i))

count = 0

KACOUNT = []

for i in range(N):
    for j in range(len(KA[i])):
        KACOUNT.append(KA[i][j])

for i in tabe:
    if KACOUNT.count(i) < N:
        count += 1

print(M-1-count)

Failing test case input:
1 32
2 2 10 20

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
KA = [list(map(int,input().split())) for i in range(N)]

unko = []
for j in range(1,M+1):
     unko.append(j)

count = 0
ans = 0

for k in range(M):
    for l in range(N):
        if unko[k] in KA[l][1:]:
            count += 1
    if count == N:
        ans += 1
    count = 0
        
          
print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
import sys
import random
from operator import itemgetter
input = sys.stdin.readline












N, M = map(int, input().rstrip().split())
likeList = []
for i in range(N):
	l = (list(map(int, input().rstrip().split())))
	likeList.append(l[1::])

ans = likeList[0]
for i in range(1, len(likeList)):
	j = 0
	while j < len(ans):
		tmp = ans[j]
		if not tmp in likeList[i]:
			ans.remove(tmp)
		j += 1
		
print(len(ans))

Failing test case input:
3 7
2 1 3
3 1 2 3
2 5 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import math
import sys
import random
from operator import itemgetter
input = sys.stdin.readline












N, M = map(int, input().rstrip().split())
ans = []
for i in range(M):
	ans.append(i+1)
ans_set = set(ans)

for i in range(N):
	tmp = list(map(int, input().rstrip().split()))
	ans_set = ans_set & set(tmp[1::])
print(len(ans_set))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
lovelist=[]
count=0
for _ in range(n):
    a=list(map(int,input().split()))
    a=set(a[1:])
    lovelist.append(a)
for i in range(n-1):
    lovelist[i+1]=lovelist[i]&lovelist[i+1]
    print(len(lovelist[-1]))

Failing test case input:
1 52
5 5 10 30

Expected output:
3


Actual output:

Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
l=[]
for _ in range(n):
    a=list(map(int,input().split()))
    a=set(a[1:])
    l.append(a)
for i in range(n-1):
    l[i+1]=l[i]&l[i+1]
print(len(l[-1]))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n, m = map(int, input().split())
likes = [list(map(int, input().split())) for _ in range(n)]
if n == 1:
    print(len(likes[0]) - 1)
    sys.exit(0)
common = set(likes[0][1:]) & set(likes[1][1:])
for i in range(2, len(likes)):
    common = common & set(likes[i][1:])
print(common)
print(len(common))


Failing test case input:
3 9
1 0 3
3 1 2 3
0 2 1

Expected output:
0


Actual output:
set()
0


Fixed submission (verdict: Accepted):
import sys
n, m = map(int, input().split())
likes = [list(map(int, input().split())) for _ in range(n)]
if n == 1:
    print(len(likes[0]) - 1)
    sys.exit(0)
common = set(likes[0][1:]) & set(likes[1][1:])
for i in range(2, len(likes)):
    common = common & set(likes[i][1:])
print(len(common))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
list=[]
s=[]
for i in range(N):
    list.append(input().split())
    s = set(s) & set(list[1:])
    list=[]
print(len(s)) 

Failing test case input:
1 55
1 5 20 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
list=[]
s=set(range(1, M+1))
for i in range(N):
    K, *A = map(int, input().split())
    s &= set(A)
print(len(s))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
a=[]
ans=0
for i in range(n):
    for j in map(int,input().split()):
        a.append(j)

for k in range(m):
    if a.count(k) == m:
        ans+=1
print(ans)
    

    

Failing test case input:
1 139
9 9 1 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=[]
ans=0
for i in range(n):
    ii=0
    for j in map(int,input().split()):
        if ii > 0:
        	a.append(j)
        ii+=1

 
for k in range(1,m+1):
    if a.count(k) == n:
        ans+=1
print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
K = []
food = set(range(1, M+1))
for _ in range(N):
    temp = list(map(int, input().split()))
    K.append(temp[0])
    food -= set(temp[1:])
print(len(food))

Failing test case input:
1 60
3 2 3 30

Expected output:
3


Actual output:
57


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
K = []
food = set(range(1, M+1))
for _ in range(N):
    temp = list(map(int, input().split()))
    K.append(temp[0])
    food &= set(temp[1:])
print(len(food))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
ans = [0 for _ in range(M)]
for _ in range(N):
  like = list(map(int,input().split()))
  for i in like:
    ans[i-1] += 1
print(ans.count(N))

Failing test case input:
1 30
3 2 10 20

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
ans = [0 for _ in range(M)]
for _ in range(N):
  like = list(map(int,input().split()))
  del like[0]
  for i in like:
    ans[i-1] += 1
print(ans.count(N))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

res = [0 for _ in range(m)]

for i in range(n):
  res_tmp = [0 for _ in range(m)]
  for j in list(map(int,input().split()))[1:]:
    res[j-1] += 1
  print(res)

print(sum([res[i]==n for i in range(m)]))

Failing test case input:
1 30
1 4 1 30

Expected output:
3


Actual output:
[1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
3


Fixed submission (verdict: Accepted):


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

res = [0 for _ in range(m)]

for i in range(n):
  res_tmp = [0 for _ in range(m)]
  for j in list(map(int,input().split()))[1:]:
    res[j-1] += 1

print(sum([res[i]==n for i in range(m)]))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

ans_list=[i for i in range(M)]

for i in range(N):
    K = list(map(int, input().split()))[1:]
    ans_list = set(ans_list) & set(K)

print(len(ans_list))

Failing test case input:
1 30
5 2 10 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):


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

ans_list=[i+1 for i in range(M)]

for i in range(N):
    K = list(map(int, input().split()))[1:]
    ans_list = set(ans_list) & set(K)

print(len(ans_list))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int, input().split())
count = 0
mmm = [i for i in range(1,m+1)]
for i in range(n):
  k, *aaa = list(map(int, input().split()))
  for j in mmm:
    if not j in aaa:
      mmm.remove(j)
print(len(mmm))
      


Failing test case input:
3 7
2 1 3
3 1 2 3
2 5 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
lll = [0]*m
for i in range(n):
  k, *aaa = list(map(int, input().split()))
  for a in aaa:
    lll[a-1] += 1
count = 0
for l in lll:
  if l == n:
    count += 1
print(count)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
a = list(map(int, input().split()))[1:]
for i in range(n - 1):
  foods = list(map(int, input().split()))[1:]
  for food in a:
    if not food in foods:
      a.remove(food)
print(len(a))


Failing test case input:
3 7
2 1 3
3 1 2 3
2 5 2

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
likes = [0 for i in range(m + 1)]

for i in range(n):
  for food in list(map(int, input().split()))[1:]:
    likes[food] += 1
print(len(list(filter(lambda x: x==n, likes))))
Problem: p03126
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n,m = map(int, input().split())
k = [list(map(int, input().split())) for i in range(n)]
c = 0
for i in range(n):
    for j in range(1,n+1):
        if j not in k[i][1:]:
            break
    else:
        c+=1
print(c)

Failing test case input:
3 7
2 1 3
3 1 2 3
2 5 0

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
k = [list(map(int, input().split())) for i in range(n)]
c = 0
for i in range(1,m+1):
    for j in range(n):
        if i not in k[j][1:]:
            break
    else:
        c+=1
print(c)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
b=list(map(int,input().split()))
a=set()
for i in range(1,m+1):
    a.add(i)
b=set(b[1::])
a &= b
print(len(a))

Failing test case input:
3 4
2 1 3
3 1 2 3
2 3 2

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a = set()
for i in range(1,m+1):
    a.add(i)
for i in range(n):
    b = list(map(int,input().split()))
    b = set(b[1::])
    a &= b
print(len(a))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
A0 = list(map(int, input().split()))
A0.pop(0)
for i in range(N-1):
    A = list(map(int, input().split()))
    for j in A0:        
        if j not in A[1:]:
            A0.remove(j)

print(len(A0))

Failing test case input:
3 7
2 0 3
3 0 4 3
2 5 1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
cnt = [0]*M
for i in range(N):
    A = list(map(int, input().split()))
    for j in A[1:]:
        cnt[j-1] += 1

ans = 0
for i in range(M):
    if cnt[i]==N:
        ans += 1
        
print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
S=set(range(1,m+1))
for i in range(n):
    K,*A=map(int,input().split())
print(len(S))

Failing test case input:
1 31
2 4 15 30

Expected output:
3


Actual output:
31


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
S=set(range(1,m+1))
for i in range(n):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
A0 = list(map(int, input().split()))
A0.pop(0)
for i in range(N-1):
    A = list(map(int, input().split()))
    for j in A0:
        
        if j not in A[1:]:
            A0.remove(j)
            print(A0)

print(len(A0))

Failing test case input:
5 5
4 2 3 4 5
4 1 3 4 5
4 1 2 4 5
4 1 2 3 5
4 1 2 3 4

Expected output:
0

Actual output:
[3, 4, 5]
[4, 5]
[5]
[]
0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
cnt = [0]*M
for i in range(N):
    A = list(map(int, input().split()))
    for j in A[1:]:
        cnt[j-1] += 1

ans = 0
for i in range(M):
    if cnt[i]==N:
        ans += 1
        
print(ans)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n , m = map(int, input().split())
ans = set(list(i for i in range(m)))
for i in range(n):
  ans = ans & set(list(map(int, input().split()))[1:])
print(len(ans))

Failing test case input:
1 30
5 4 10 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n , m = map(int, input().split())
ans = set(list(i for i in range(1, m + 1)))
for i in range(n):
  ans = ans & set(list(map(int, input().split()))[1:])
print(len(ans))

Problem: p03126
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m=map(int,input().split())
kouho=[i for i in range(1,m+1)]
for i in range(n):
    x=list(map(int, input().split()))
    a=x[1:]
    for i in kouho:
        if not i in a:kouho.remove(i)
print(len(kouho))

Failing test case input:
1 30
1 4 20 30

Expected output:
3


Actual output:
15


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
li=[list(map(int, input().split()))[1:] for _ in range(n)]
res=[0]*m
for i in range(n):
    for j in range(len(li[i])):
        res[li[i][j]-1]+=1
print(res.count(n))

Problem: p03126
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = [int(i) for i in input().split()]
list_a = [[int(i) for i in input().split()] for j in range(0, n)]
list_ans = [1 for i in range(0, m)]
if n == 1:
    print(list_a[0][0])
    exit()
for i in range(0, n):
    for j in range(1, len(list_a[i])):
        if list_ans[list_a[i][j] - 1] == 1:
            list_ans[list_a[i][j] - 1] = 0
print(sum(list_ans))

Failing test case input:
3 7
2 1 3
3 1 2 3
2 5 0

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n, m = [int(i) for i in input().split()]
list_a = [[s for s in input().split()] for i in range(0, n)]
list_ans = [str(s) for s in range(1, m + 1)]
for i in range(0, n):
    for j in range(0, m):
        if list_ans[j] not in list_a[i][1:]:
            list_ans[j] = '0'
print(len([s for s in list_ans if s != '0']))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from operator import add

n, m = map(int, input().split())
li = []
for i in range(n):
    li.append(list(map(int, input().split())))
    del li[i][0]
li = sum(li, [])

count = 0
for num in li:
    if n == li.count(num):
        count += 1
print(count)

Failing test case input:
3 7
2 1 3
3 1 2 3
2 5 1

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
from operator import add

n, m = map(int, input().split())
li = []
for i in range(n):
    li.append(list(map(int, input().split())))
    del li[i][0]
li = sum(li, [])
li_2 = list(set(li))
count = 0
for num in li_2:
    if n == li.count(num):
        count += 1
print(count)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
ans = set([str(m) for m in range(M)])
for n in range(N):
    A = input().split()
    A.pop(0)
    ans = ans & set(A)
print(len(ans))


Failing test case input:
1 30
3 2 4 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
ans = set([str(m) for m in range(1,M+1)])
for n in range(N):
    A = input().split()
    A.pop(0)
    ans = ans & set(A)
print(len(ans))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())

ans = 0
i_list = []

for i in range(N):
	tmp_list = list(map(int,input().split()))
	i_list.extend(tmp_list[1:])

for i in range(M):
  if i_list.count(i) == N:
    ans += 1

print(ans)

Failing test case input:
1 30
2 4 20 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())

ans = 0
i_list = []

for i in range(N):
	tmp_list = list(map(int,input().split()))
	i_list.extend(tmp_list[1:])

for i in range(1,M+1):
  if i_list.count(i) == N:
    ans += 1

print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
list = [list(map(int,input().split())) for x in range(N)]


for i in range(0,N):
    list[i].pop(0)

stock = []


for i in range(0,N):
    cnt = 0
    for j in range(0,len(list[i])):
        if list[i][j] in list[i]:
            cnt += 1
    if cnt == N:
        stock.append(list[i][j])

if N == 1:
    stock = list[i]

print(len(stock))

Failing test case input:
3 9
2 0 3
3 0 4 6
0 2 1

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
list = [list(map(int,input().split())) for x in range(N)]


for i in range(0,N):
    list[i].pop(0)

stock = []


for i in range(0,N):
    for j in range(0,len(list[i])):
        cnt = 0
        for k in range(0,N):
            if list[i][j] in list[k]:
                cnt += 1
        if cnt == N:
            stock.append(list[i][j])

if N == 1:
    stock = list[i]

print(len(set(stock)))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m= map(int, input().split())
ka = [input() for i in range(n)]
common = {i for i in range(1,m+1)}
for k in ka:
    tmp = k.split()
    tmp = set(tmp[1:])
    common = common.intersection(tmp)

print(len(common))

Failing test case input:
1 43
5 9 2 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n, m= map(int, input().split())
ka = [input() for i in range(n)]
common = {i for i in range(1,m+1)}
for k in ka:
    tmp = {int(i) for i in k.split()[1:]}
    common = common.intersection(tmp)

print(len(common))