ZhenlongDai/ACPR huggingface dataset:
Problem: p03126
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=map(int,input().split())
KA=[]
A=[]
a=0
for i in range(N):
    KA.append(list(map(int,input().split())))
for i in range(N):
    KA[i].remove(KA[i][0])
for i in range(N):
    for j in range(len(KA[i])):
        A.append(KA[i][j])
print(A)
for i in range(1,M+1):
    if N==A.count(i):
        a+=1
print(a)

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

Expected output:
0


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


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

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

a = set(str(x) for x in range(1,M+1))
for i in range(N):
  li = list(input().split())
  a = a & set(li[1:])

print (' '.join(a))

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

Expected output:
0


Actual output:

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

a = set(str(x) for x in range(1,M+1))
for i in range(N):
  li = list(input().split())
  a = a & set(li[1:])

print (len(a))

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

    for j in range(len(food)): 
        if food[j] not in a[1:]:
            erase.append(j)
print(len(food)-len(erase))      

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

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
erase = set()
for i in range(N):
    a = list(map(int, input().split())) 
    
    if i == 0:
        food = a[1:]
    for j in range(len(food)): 
        
        if food[j] not in a[1:]:
            erase.add(j)

print(len(food)-len(erase))

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

Failing test case input:
1 30
6 4 2 30

Expected output:
3


Actual output:
2


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

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

Failing test case input:
1 30
2 2 10 20

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
c = [0]*m
for i in range(n):
  a = list(map(int, input().split()))
  for e in a[1:]:
    c[e-1] += 1
print(c.count(n))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
nm = list(map(int,input().split()))
n=nm[0]
m=nm[1]
a = [0 for i in range(n)]
for i in range(n):
    a[i]=list(map(int,input().split()))
b = [[0 for i in range(m+1)] for i in range(n)]
for i in range(n):
    for j in range(1,len(a[i])):
        b[i][a[i][j]] = 1
c = [1 for i in range(m)]
for i in range(n):
    for j in range(m):
        c[j] = c[j]*b[i][j]
print(sum(c))


Failing test case input:
1 30
6 6 2 30

Expected output:
3


Actual output:
2


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

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int,input().split())
S = {i 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))



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())
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,m=[int(i) for i in input().split()]

s=set()
for i in range(m):
    s.add(i+1)


for i in range(n):
    a= [int(j) for j in input().split()]
    a.pop(0)
    a=set(a)
    s=s and a

print(len(s))


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

Expected output:
0


Actual output:
2


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

s=set()
for i in range(m):
    s.add(i+1)


for i in range(n):
    a= [int(j) for j in input().split()]
    a.pop(0)
    a=set(a)
    s=s & a

print(len(s))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
List = list(range(1,M))
anser = []
def judge(N,M,List,anser):
  for i in range(N):
    L = list(map(int, input().split()))
    anser.extend(L)
    anser = list(set(anser))
    print(anser)
  print(len(anser))
judge(N,M,List,anser)

Failing test case input:
1 50
1 4 3 1

Expected output:
3


Actual output:
[1, 3, 4]
3


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
List = list(range(1,M))
anser = []
def judge(N,M,List,anser):
  for i in range(N):
    L = list(map(int, input().split()))
    del L[0]
    if i==0:
      anser.extend(L)
    else:
      anser = list(set(L)&set(anser))
    
    
  print(len(anser))
judge(N,M,List,anser)
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(list(map(int,input().split())))

b = [x[1:] for x in a ]

c = []
for j in range(1,31):
    for k in range(n):
        if j in b[k]:
            c.append(j)

d = [x for x in set(c) if c.count(x) == n]

Failing test case input:
1 54
5 4 10 6

Expected output:
3


Actual output:

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

b = [x[1:] for x in a ]

c = []
for j in range(1,31):
    for k in range(n):
        if j in b[k]:
            c.append(j)

d = [x for x in set(c) if c.count(x) == n]

print(len(d))

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


def solve():
    N, M = list(map(int, input().split()))

    A = list(map(int, input().split()))
    candidates = A[1:]

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

        for food in candidates:
            if food in A:
                pass
            else:
                candidates.remove(food)
    
    print(len(candidates))




if __name__ == "__main__":
    solve()


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):

import copy

def solve():
    N, M = list(map(int, input().split()))
    A = list(map(int, input().split()))
    candidates = copy.deepcopy(A[1:])

    for i in range(N-1):
        A = list(map(int, input().split()))
        A = copy.deepcopy(A[1:])

        copied_candidates = copy.deepcopy(candidates)
        for candidate in copied_candidates:
            if candidate in A:
                continue
            else:
                candidates.remove(candidate)
            
    print(len(candidates))



if __name__ == "__main__":
    solve()

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

def hantei(x):
  for j in range(N):
    if x not in List[j][1:]:
      return(0)
  return(1)

ans = 0
for i in range(M):
  ans = ans + hantei(i)
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())
List = [list(map(int, input().split())) for i in range(N)]

def hantei(x):
  for j in range(N):
    if x not in List[j][1:]:
      return(0)
  return(1)

ans = 0
for i in range(1,M+1):
  ans = ans + hantei(i)
print(ans)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
print(N, M)

def main():
    cnts = [0]*M
    ans = 0

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

    for cnt in cnts:
        if cnt == N:
            ans += 1
    return ans


if __name__ == '__main__':
    print(main())


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

Expected output:
0


Actual output:
3 7
0


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

def main():
    cnts = [0]*M
    ans = 0

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

    for cnt in cnts:
        if cnt == N:
            ans += 1
    return ans


if __name__ == '__main__':
    print(main())

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:
        food[j] += 1

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

print(sum)

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

Expected output:
1


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.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

ans = 0
lst = []
kari = []
for i in range(N):
    if i == 0:
        lst += list(map(int, input().split()))
        lst = lst[1:]
    else:
        if lst == []:
            print (0)
            break
        else:      
            kari = list(map(int, input().split()))
            for j in lst:
                if j in kari[1:]:
                    pass
                else:
                    lst.remove(j)


ans = len(lst)
print (ans)

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

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
import sys
ans = 0
lst = []
kari = []
for i in range(N):
    if i == 0:
        lst += list(map(int, input().split()))
        lst = lst[1:]

    else:
        if lst == []:
            print (0)
            sys.exit()
        else:      
            kari = list(map(int, input().split()))

            sakujo = []
            for j in lst:
                if j in kari[1:]:
                    pass
                else:
                    sakujo += [j]


            for k in sakujo:
                lst.remove(k)


        if lst == []:
            print (0)
            sys.exit()


ans = len(lst)
print (ans)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
ans={i for i in range(1,m)}
for i in range(n):
    a=[int(i) for i in input().split()]
    a=a[1:]
    ans=ans&set(a)
print(len(list(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={i for i in range(1,m+1)}
for i in range(n):
    a=[int(i) for i in input().split()]
    a=a[1:]
    ans=ans&set(a)
print(len(list(ans)))

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

import sys










def main():
    nm, *likes = [line.rstrip() for line in sys.stdin.readlines()]
    n, m = [int(x) for x in nm.split()]
    menu = set(str(i) for i in range(1, m+1))
    res = menu
    for i in range(n):
        res &= set(likes[i][1:])
    
    print(len(res))

if __name__ == "__main__":
    main()


Failing test case input:
1 31
2 4 15 30

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):

import sys










def main():
    nm, *lines = sys.stdin.readlines()
    n, m = [int(x) for x in nm.split()]
    likes = [[int(x) for x in line.split()] for line in lines]
    menu = set(range(1, m+1))
    res = menu
    for i in range(n):
        res &= set(likes[i][1:])
    
    print(len(res))

if __name__ == "__main__":
    main()

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N, M = map(int, input().split())
    all = list(map(int, input().split()))
    all.pop(0)
    for _ in range(N - 1):
        tmp = list(map(int, input().split()))
        tmp.pop(0)
        for i in all:
            if i not in tmp:
                all.remove(i)
    print(len(all))


if __name__ == "__main__":
    main()


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):
def main():
    N, M = map(int, input().split())
    all = list(map(int, input().split()))
    all.pop(0)
    tmp = []
    for _ in range(N - 1):
        tmp.clear()
        tmp = list(map(int, input().split()))
        tmp.pop(0)
        all = list(set(tmp) & set(all))
    print(len(all))


if __name__ == "__main__":
    main()

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

product = set(i for i in range(1, m+1))
for i in range(0, n):
	As = set(input().split()[1:])
	product &= As
	
print(len(product))
	

Failing test case input:
1 50
1 7 6 3

Expected output:
3


Actual output:
0


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

product = set(i for i in range(1, m+1))

for i in range(0, n):
	As = set(map(int, input().split()[1:]))
	product = product.intersection(As)
	
print(len(product))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
list=[]
s=set(range(1, M+1))
for i in range(N):
    list.append(input().split())
    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  = list(map(int, input().split()))
k = list(list(map(int, input().split())) for _ in range(n))
c = 0
f = 0
for i in range(m):
    for j in range(n):
        if not i in k[j]:
            f == 1

    if f == 0:
        c += 1

print(c)

Failing test case input:
1 50
5 4 10 6

Expected output:
3


Actual output:
50


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

for i in range(m):
    f = 0
    for j in range(n):
        if not i+1 in k[j][1:]:
            f = 1
            
            
    if f == 0:
        c += 1

print(c)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s,m=map(int,input().split())
l=[]
for _ in range(s):
  n=[]
  n=list(map(int,input().split()))
  n.pop(0)
  l=l+n
m=dict()
for i in l:
  if i in m:
    m[i]+=1
  else:
    m[i]=1
  print(m)
cnt=0
for j in m:
  if m[j]==s:
    cnt+=1
print(cnt)

Failing test case input:
1 30
5 8 10 6

Expected output:
3


Actual output:
{8: 1}
{8: 1, 10: 1}
{8: 1, 10: 1, 6: 1}
3


Fixed submission (verdict: Accepted):
s,m=map(int,input().split())
l=[]
for _ in range(s):
  n=[]
  n=list(map(int,input().split()))
  n.pop(0)
  l=l+n
m=dict()
for i in l:
  if i in m:
    m[i]+=1
  else:
    m[i]=1
cnt=0
for j in m:
  if m[j]==s:
    cnt+=1
print(cnt)

Problem: p03126
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, m = map(int, input().split())
truely_loved_food = {x for x in range(m)}
for i in range(n):
    li = list(map(int, input().split()))
    k=li[0]
    loved_food = set(li[1:])
    truely_loved_food = truely_loved_food & loved_food
print(len(loved_food))

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

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
truely_loved_food = {x for x in range(m + 1)}
for i in range(n):
    li = list(map(int, input().split()))
    k=li[0]
    loved_food = set(li[1:])
    truely_loved_food = truely_loved_food & loved_food
print(len(truely_loved_food))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = (int(x) for x in input().split()) 

like = []
cnt = 0

for i in range(N):
	like.append([int(x) for x in input().split()][1:])

for j in range(M):
	if all([j in x for x in like]):
		cnt += 1

print(cnt)

Failing test case input:
1 30
5 2 4 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N, M = (int(x) for x in input().split()) 

like = []
cnt = 0

for i in range(N):
	like.append([int(x) for x in input().split()][1:])

for j in range(1, M+1):
	if all([j in x for x in like]):
		cnt += 1

print(cnt)

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

ka=[]
for i in range(n):
    atmp=list(input().split())
    ka.append(atmp)


like=ka[0][1::]
ans=len(like)

if n>1:
    for i in range(1,n):
        liketmp=ka[i][1::]
        print(liketmp)
        for j in range(0,len(liketmp)-1):
            if liketmp[j] not in like:
                ans-=1

print(ans)

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

Expected output:
0


Actual output:
['0', '2', '3']
['2', '1']
-1


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

ka=[]
ans=0

for i in range(n):
    atmp=list(input().split())
    ka.append(atmp)


like=ka[0][1::]

if n>1:
    for i in range(1,n):
        liketmp=ka[i][1::]
        for k in range(0,len(like)):
            if like[k] not in liketmp:
                     like[k]='0'

for j in range(len(like)):
    if like[j]!='0':
        ans+=1
print(ans)

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

for i in range(N-1):
    A = list(map(int, input().split()))
    for j in A0[1:]:
        if j not in A[1:]:
            A0.remove(j)
            print(A0)

print(len(A0[1:]))

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

Expected output:
0


Actual output:
[2, 0]
[2]
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(range(1, m))
for i in range(n):
    tmp = list(map(int, input().split()))
    ans = ans & set(tmp[1:])

print(len(ans))


Failing test case input:
1 30
2 2 10 30

Expected output:
3


Actual output:
2


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

ans = set(range(1, m+1))
for i in range(n):
    tmp = list(map(int, input().split()))
    ans = ans & set(tmp[1:])

print(len(ans))
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):
    ii=0
    for j in map(int,input().split()):
        if ii > 0:
        	a.append(j)
        ii+=1

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

Failing test case input:
1 30
5 2 4 30

Expected output:
3


Actual output:
2


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

a_li =[]
for i in range(n):
    li = input().split()
    del li[0]
    a_li += li

count_li =[]
for o in range(m):
    x = a_li.count(str(o))
    count_li.append(int(x))
    
print(count_li.count(n))

Failing test case input:
1 30
3 2 10 30

Expected output:
3


Actual output:
2


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

a_li =[]
for i in range(n):
    li = input().split()
    del li[0]
    a_li += li

count_li =[]
for o in range(m+1):
    x = a_li.count(str(o))
    count_li.append(int(x))
    
print(count_li.count(n))

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):
    ls[1:].count(M +1)
    if M +1 == N:
        answer += 1

print (answer)



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 = [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())
kLst = [list(map(str, input().split())) for i in range(N)]

ansLst = []
for i in range(1, len(kLst[0])):
    ansLst.append(kLst[0][i])

for i in range(N):
    del kLst[i][0]

for i in range(1, N):
    if len(ansLst) == 0:
        break
    for j in ansLst:
        if kLst[i].count(j) == 0:
            ansLst.remove(j)
print(len(ansLst))

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())
kLst = [list(map(int, input().split())) for i in range(N)]

ansLst = [0] * M
for i in range(N):
    for j in range(1, len(kLst[i])):
        ansLst[kLst[i][j] - 1] += 1

ansCnt = 0
for i in ansLst:
    if i == N:
        ansCnt += 1

print(ansCnt)
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):
	if l.count(i) == N:
		count  += 1

print(count)


Failing test case input:
1 30
3 3 20 30

Expected output:
3


Actual output:
2


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())
foods = [0]*(M)

for i in range(N):
  person = list(map(int, input().split()))
  for j in range(M):
    if j in person:
      foods[j] += 1
ans = 0
for i in range(M):
  if foods[i] == N:
    ans += 1
print(ans)

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

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
foods = [0]*(M+1)

for i in range(N):
  person = list(map(int, input().split()))
  for j in range(1,M+1):
    if j in person[1:]:
      foods[j] += 1
ans = 0
for i in range(1,M+1):
  if foods[i] == N:
    ans += 1
print(ans)

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

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 = []
c = m*[0]
for i in range(n):
    k,*a = map(int, input().split())
    for j in range(1,m+1):
        c[j-1] += a.count(j)
print(c.count(n))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
lis = [[int(x) for x in input().split()] for _ in range(N)]
ans = 0
for item in range(1, M + 1):
  for i in lis:
    if not item in i:
      break
  else:
    ans += 1
print(ans)    

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())
lis = [[int(x) for x in input().split()] for _ in range(N)]
ans = 0
for item in range(1, M + 1):
  for i in lis:
    if not item in i[1:]:
      break
  else:
    ans += 1
print(ans)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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(m):
        if j not in x:
            ans[j-1] = 0

print(ans.count(1))

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())
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())
K = list(map(int,input().split()))
for i in range(N-1):
  K_ = list(map(int,input().split()))
  K = list(set(K[1:]) & set(K_[1:]))
if N == 1:
  print(len(K)-1)
else:
  print(len(K))

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

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
K = list(map(int,input().split()))
K = K[1:]
for i in range(N-1):
  K_ = list(map(int,input().split()))
  K = list(set(K) & set(K_[1:]))

print(len(K))

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

Failing test case input:
1 52
5 9 10 30

Expected output:
3


Actual output:
4


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

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import collections
input_lines = sys.stdin.readlines()

N = input_lines[0].strip()[0]
N = N.strip()
N = int(N)

new = []
for i in range(1,len(input_lines)):
  tmp = input_lines[i].strip()
  tmp = tmp.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())):
  print("i=",i,",",c.most_common()[i][1])
  if int(c.most_common()[i][1]) == N:
    print("hit")
    cnt += 1
    
print(cnt)

Failing test case input:
1 50
1 4 3 1

Expected output:
3


Actual output:
i= 0 , 1
hit
i= 1 , 1
hit
i= 2 , 1
hit
3


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):
import sys
from collections import deque
input = sys.stdin.readline

N, M = map(int, input().split())
A = deque()
ans = set()
for _ in range(N):
    A.append(list(map(int, input().split())))

for i in range(N):
    for j in range(1,M+1):
        if j in A[i]:
            ans.add(j)
            
print(M - len(ans))

Failing test case input:
1 60
3 2 3 30

Expected output:
3


Actual output:
57


Fixed submission (verdict: Accepted):
import sys
from collections import deque
input = sys.stdin.readline

N, M = map(int, input().split())
A = deque()
ans = [[0]*M for i in range(N)]
counter = [0 for i in range(M)]
counter2 = 0
for _ in range(N):
    A.append(list(map(int, input().split())))

for i in range(N):
    for j in range(1, len(A[i])):
        counter[A[i][j]-1] += 1

for i in range(len(counter)):
    if counter[i] == N:
        counter2 += 1
print(counter2)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
N,M=map(int, input().split())
res=[]
for _ in range(N):
  data=list(map(int, input().split()))
  K=data.pop(0)
  A=data
  res.append(A)
print(res)
flatten_list = list(itertools.chain.from_iterable(res))
cnt=0
for i in range(1, M+1):
  if flatten_list.count(i) == N:
    cnt +=1
print(cnt)


Failing test case input:
1 30
3 2 4 30

Expected output:
3


Actual output:
[[2, 4, 30]]
3


Fixed submission (verdict: Accepted):
import itertools
N,M=map(int, input().split())
res=[]
for _ in range(N):
  data=list(map(int, input().split()))
  K=data.pop(0)
  A=data
  res.append(A)
flatten_list = list(itertools.chain.from_iterable(res))
cnt=0
for i in range(1, M+1):
  if flatten_list.count(i) == N:
    cnt +=1
print(cnt)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
check = [1] * M
for i in range(N):
    a = [int(i) for i in input().split()]
    a = a[1:]
    for i in a:
        check[i-1] = 0

print(sum(check))

Failing test case input:
1 30
4 2 10 20

Expected output:
3


Actual output:
27


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


ans = 0
for i in check:
    if i == N:
        ans += 1
print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int, input().split())
a = list(map(int, input().split()))
K_past = a[0]
A_past = a[1:]
  

for n in range(1,N):
  a = list(map(int, input().split()))
  K = a[0]
  A = a[1:]
  
  for i in range(K):
    l = []
    if A[i] in A_past:
      l.append(A[i])
    A_past = l
    

Failing test case input:
1 32
2 2 10 20

Expected output:
3


Actual output:

Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
a = list(map(int, input().split()))
K_past = a[0]
A_past = a[1:]
  

for n in range(1,N):
  a = list(map(int, input().split()))
  l = []
  K = a[0]
  A = a[1:]
  
  for i in range(K):
    if A[i] in A_past:
      l.append(A[i])
  A_past = l
    
print(len(A_past))
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 = [int(i) for i in k.split()]
    tmp = set(tmp)
    common = common.intersection(tmp)

print(len(common))

Failing test case input:
1 55
1 5 20 30

Expected output:
3


Actual output:
4


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))

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)]

list_ = set([i for i in range(M)])

for j in range(N):
    list_ &= set(a[j][1:])
    

if len(list_) !=0:
    print(len(list_))
else:
    print(0)

Failing test case input:
1 30
5 5 2 30

Expected output:
3


Actual output:
2


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

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


for j in range(N):
    list_ &= set(a[j][1:])
    

if len(list_) !=0:
    print(len(list_))
else:
    print(0)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
a = [0]*(m+1)
b = [0]*(m+1)

for i in range(n) :
    a = list(map(int,input().split()))
    for j in range(1,len(a)) :
        b[a[j]] += 1

print(a.count(n))

Failing test case input:
1 24
2 2 10 19

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
k = [0]*n
a = [0]*(m+1)
b = [0]*(m+1)

for i in range(n) :
    a = list(map(int,input().split()))
    for j in range(1,len(a)) :
        b[a[j]] += 1

print(b.count(n))

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


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

Expected output:
0


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


Fixed submission (verdict: Accepted):
n, m = list(map(int, input().split()))
a = []
for i in range(n) :
    a.extend(list(map(int, input().split()))[1:])
b = []
for i in range(1, m + 1) :
    if a.count(i) == n :
        b.append(i)
print(len(b))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = list(map(int,input().split()))

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

for i in range(N):
    myLIKE = list(map(int,input().split()[1:]))
    for j in LIKE:
        if j not in myLIKE:
            LIKE.remove(j)
print(len(LIKE))

Failing test case input:
1 50
1 4 10 6

Expected output:
3


Actual output:
25


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

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

for i in range(N):
    myLIKE = list(map(int,input().split()[1:]))
    for j in ref:
        try:
            if j not in myLIKE:
                LIKE.remove(j)
        except ValueError:
            pass
            
print(len(LIKE))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
x=[]
sum=0
for i in range(n):
  s=list(map(int,input().split()))
  x+=s
for i in range(1,m+1):
  if x.count(i)==n:
    sum+=1
print(sum)

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())
x=[]
sum=0
for i in range(n):
  s=list(map(int,input().split()))
  s.pop(0)
  x+=s
for j in range(1,m+1):
  if x.count(j)==n:
    sum+=1
print(sum)

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:]
    allset = allset ^ set(l_new)

print(len(allset))

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

Expected output:
0


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):
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])) 
    print(len(a))


Failing test case input:
1 30
3 2 10 20

Expected output:
3


Actual output:

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):
import sys
from collections import Counter

N, M = map(int, input().split())
KA = ''
for i in range(N):
    KA += input()[1:].replace(' ', '')
c = Counter(KA)

ans = 0
for k, v in c.items():
    if v == N:
        ans += 1

print(ans)


Failing test case input:
1 43
5 9 4 30

Expected output:
3


Actual output:
4


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

N, M = map(int, input().split())
KA_list = []
for i in range(N):
    for j in input().split()[1:]:
        KA_list.append(j)
c = Counter(KA_list)

ans = 0
for k, v in c.items():
    if v == N:
        ans += 1

print(ans)

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

Failing test case input:
1 30
1 4 20 30

Expected output:
3


Actual output:
2


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

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
c = [0] * M
for i in range(N):
    a = [int(i) for i in input().split()]
    for j in a[1:]:
        c[j-1] += 1
        print(c)

Failing test case input:
1 30
1 4 20 30

Expected output:
3


Actual output:
[0, 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, 0]
[0, 0, 0, 1, 0, 0, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
c = [0] * M
for i in range(N):
    a = [int(i) for i in input().split()]

    for j in a[1:]:
        c[j-1] += 1
 
print(c.count(N))

Problem: p03126
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n, m = map(int, input().split())
truely_loved_food = {x for x in range(m)}
for i in range(n):
    li = list(map(int, input().split()))
    k=li[0]
    loved_food = set(li[1:])
    truely_loved_food = truely_loved_food & loved_food
print(len(truely_loved_food))

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())
truely_loved_food = {x for x in range(m + 1)}
for i in range(n):
    li = list(map(int, input().split()))
    k=li[0]
    loved_food = set(li[1:])
    truely_loved_food = truely_loved_food & loved_food
print(len(truely_loved_food))
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

List = []
all_and = []
for i in range(N):
    l = list(map(int, input().split()))
    
    del l[0]
    
    List.append(l)
    
    
    

    all_and = set(all_and) & set(List[i])

all_and_list = list(all_and)


print(len(all_and_list))


Failing test case input:
1 30
3 2 3 30

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):


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

List = []
all_and = []
for i in range(N):
    l = list(map(int, input().split()))
    del l[0]
    List.append(l)

    if i ==0:
        all_and = List[0]
    else:
        all_and = set(all_and) & set(List[i])
        all_and = list(all_and)


print(len(all_and))

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
k,*a=input().split()
for i in range(n-1):
    k,*b=input().split()
    for j in a:
        if j not in b:
            a.remove(j)
print(len(a))         


Failing test case input:
3 9
1 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())
_,*ans=map(int,input().split())
for i in range(n-1):
    _,*k=map(int,input().split())
    ans=[i for i in k if i in ans]
print(len(ans))

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

cnt = 0
for i in range(1, m+1):
    flag = True
    for j in range(len(a)):
        if not i in a[j]:
            flag = False
    if flag:
        cnt += 1

print(cnt - 1)



Failing test case input:
1 53
2 9 2 30

Expected output:
3


Actual output:
2


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

cnt = 0
for i in range(1, m+1):
    flag = True
    for j in range(len(a)):
        if not i in a[j]:
            flag = False
    if flag:
        cnt += 1

print(cnt)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s,m=map(int,input().split())
l=[]
for _ in range(s):
  n=[]
  n=list(map(int,input().split()))
  n.pop(0)
  l=l+n
m=dict()
for i in n:
  if i in m:
    m[i]+=1
  else:
    m[i]=1
cnt=0
for j in m:
  if m[j]==s:
    cnt+=1
print(cnt)
  

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

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
s,m=map(int,input().split())
l=[]
for _ in range(s):
  n=[]
  n=list(map(int,input().split()))
  n.pop(0)
  l=l+n
m=dict()
for i in l:
  if i in m:
    m[i]+=1
  else:
    m[i]=1
cnt=0
for j in m:
  if m[j]==s:
    cnt+=1
print(cnt)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = list(map(int, input().split()))
se = set(range(1, m + 1))
for _ in range(n):
    x = set(map(int, input().split()))
    se -= x

print(len(se))


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

Expected output:
0


Actual output:
3


Fixed submission (verdict: Accepted):
n, m = list(map(int, input().split()))
se = set(range(1, m + 1))
for _ in range(n):
    x = se - set(list(map(int, input().split()))[1:])
    se -= x

print(len(se))

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

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

print(ans)

Failing test case input:
1 52
5 5 10 22

Expected output:
3


Actual output:
[5, 10, 22]
3


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
c = [0] * m
for i in range(n):
    k, *a = map(int, input().split())
    
    for e in a:
        c[e-1] += 1

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

print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=[int(i) for i in input().split()]
ans=[0]*m
a=[]
for i in range(n):
    hoge=[int(i) for i in input().split()[1:]]
    a.append(hoge)
for i in range(n):
    for j in range(len(a[i])):
        ans[a[i][j]-1]=a[i][j]
print(ans.count(n))

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

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n,m=[int(i) for i in input().split()]
ans=[0]*m
a=[]
for i in range(n):
    hoge=[int(i) for i in input().split()[1:]]
    a.append(hoge)
for i in range(n):
    for j in range(len(a[i])):
        ans[a[i][j]-1]+=1
print(ans.count(n))

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

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

cnt = 0
for i in range(1, M+1):
    jlist = []
    for j in range(N):
        if i in kaito[j]:
            jlist.append(True)
        else:
            jlist.append(False)
    if all(jlist):
        cnt += 1
print(cnt)

Failing test case input:
1 50
1 7 6 3

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):

N, M = map(int, input().split())
kaito = []
for i in range(N):
    kaito.append([int(i) for i in input().split()])

cnt = 0
for i in range(1, M+1):
    jlist = []
    for j in range(N):
        if i in kaito[j][1:]:
            jlist.append(True)
        else:
            jlist.append(False)
    if all(jlist):
        cnt += 1
        
print(cnt)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
K = []
sum = 0
for i in range(N):
  W=list(map(int,input().split()))
  W.pop(0)
  K+=W
for T in range(1,len(K)+1):
  B=K.count(T)
  if B == N:
    sum+=1
print(sum)

Failing test case input:
1 50
1 4 10 6

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
K = []
sum = 0
if N==1:
  W=list(map(int,input().split()))
  W.pop(0)
  K+=W
  print(len(K))
  exit()
for i in range(N):
  W=list(map(int,input().split()))
  W.pop(0)
  K+=W
for T in range(1,len(K)+1):
  B=K.count(T)
  if B == N:
    sum+=1
print(sum)

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

N, M = map(int, input().split())
memo = [0]*(M+1)

for _ in range(N):
    Ki, *A = map(int, input().split())
    for item in A:
        memo[int(item)] += 1

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

Failing test case input:
1 30
3 4 10 30

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):

N, M = map(int, input().split())
memo = [0]*(M+1)

for _ in range(N):
    Ki, *A = map(int, input().split())
    for item in A:
        memo[int(item)] += 1

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

print(ans)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
Likes = [True] * M
count = [0] * M
for n in range(N):
    KA = list(map(int,input().split()))[1:]
    for nn in range(M):
        count[nn] += 1
        if not nn in KA :
            Likes[nn] = False
for i,j in enumerate(count):
    if i == 0:
        Likes[i] = False
print(Likes.count(True))


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())
Likes = [True] * M
count = [0] * M
nums = 0
for n in range(N):
    KA = list(map(int,input().split()))[1:]
    for i in KA:
        count[i-1] += 1
for i,j in enumerate(count):
    if j == N:
      nums +=1
print(nums)

Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
ll0 = list(map(int, input().split()))
lt = ll0[1:]
ll = [list(map(int, input().split())) for _ in range(n-1)]
for l in ll:
    for i in lt:
        if  i in l[1:]:
            pass
        else:
            lt.remove(i)
print(len(lt))


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())
ans = [0 for _ in range(m+1)]
for i in range(n):
    ll = list(map(int, input().split()))
    for l in ll[1:]:
        ans[l] += 1
count = 0
for i in ans:
    if i == n:
        count += 1
    else:
        pass
print(count)
Problem: p03126
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
s = set(str(i) for i in range(m))
for _ in range(n):
  s = s & set(input().split())
print(len(s))

Failing test case input:
1 31
2 4 28 30

Expected output:
3


Actual output:
4


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