Problem: Katsusando loves omelette rice.  Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.  To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.  The i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.  Find the number of the foods liked by all the N people.

Submission attempts (in order):
n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n+1):
        if listA[0][j] not in listA[i] and listA[0][j] == listA[i][0]:
            break
    else:
    	x += 1
print(x)

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n):
        if listA[0][j] not in listA[i]:
            break
        x += 1
print(x)

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n+1):
        if listA[0][j] not in listA[i]:
            break
        x += 1
print(x)

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n):
        listB = []
        for k in range(1,listA[i][0]+1):
        	listB.append(listA[i][k])
        	if listA[0][j] not in listB:
            	break
    else:
    	x += 1
print(x)

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n):
        if listA[0][j] not in listA[i]:
            break
    x += 1
print(x)

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n):
        listB = []
        for k in range(1,listA[i][0]+1):
          listB.append(listA[i][k])
          if listA[0][j] not in listB:
            break
    else:
    	x += 1
print(x)

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n):
        if listA[0][j] not in listA[i] or listA[0][j] == listA[i][0]:
            break
    else:
    	x += 1
print(x)

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n+1):
        if listA[0][j] not in listA[i] and listA[0][j] == listA[i][0]:
            break
        x += 1
print(x)

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n):
        listB = []
        for k in range(1,listA[i][0]+1):
          listB.append(listA[i][k])
        if listA[0][j] not in listB:
          break
    else:
    	x += 1
print(x)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted