TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
A, B = map(int, input())
if B % A == 0:
  print(A + B)
else:
  print(A - B)

A, B = map(int, input().split(" "))
if B % A == 0:
  print(A + B)
else:
  print(B - A)


Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a = list(map(int,input().split()))
A = a[0]
B = a[1]
if A % B == 0:
    print(str(A+B))
else:
    print(str(B-A))

a = list(map(int,input().split()))
A = a[0]
B = a[1]
if B % A == 0:
    print(str(A+B))
else:
    print(str(B-A))

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):

data = input().split()
n = int(data[0]) 
m = int(data[1]) 
ans = 0


j = 1 
i = 1 
c = [0] * m 
    

while i <= n:
    tmp = input()
    td = tmp[1:] 
    tn = tmp[0]  
    print(td)
    
    while j <= m: 
        j = str(j)
        if j in td: 
            j = int(j) 
            c[j] += 1 
        j = int(j) 
        j += 1
    j = 1    
    i += 1 



for x in c:
    if x == n:
        ans += 1

print(c)

print(ans)


data = input().split()
a = int(data[0])
b = int(data[1])

if b%a == 0:
  print(a+b)
  else:
    print(b-a)


data = input().split()
n = int(data[0]) 
m = int(data[1]) 
ans = 0


j = 1 
i = 1 
c = [0] * (m +1)
    

while i <= n:
    tmp = [int(s) for s in input().split()]
    td = tmp[1:] 
    tn = tmp[0]  
    
    
    while j <= m: 
        
        if j in td: 
            j = int(j) 
            
            c[j] += 1 
        j = int(j) 
        j += 1
    j = 1    
    i += 1 



for x in c:
    if x == n:
        ans += 1



print(ans)


data = input().split()
a = int(data[0])
b = int(data[1])

if b%a == 0:
  print(a+b)
else:
  print(b-a)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
n = int(input())
tmp = input()
an = []
for t in tmp.split():
    an.append(int(t))

while True:
    
    
    min_tmp = 0
    for i in range(len(an)):
        if(an[i] < an[min_tmp] and an[i] > 0):
            min_tmp = i

    # i_min = an.index(min(an))
    i_min = min_tmp
    for i in range(len(an)):
        if i == i_min:
            continue
        an[i] = an[i] - int(an[i]/an[i_min]) * an[i_min]

    flag = True
    for i in range(len(an)):
        if(an[i] > 0 and not i == i_min):
            flag = False
    if flag:
        break

print(an[i_min])

a,b = [int(x) for x in input().split()]
if b % a == 0:
    print(a+b)
else:
    print(b-a)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
A, B = map(int, input().split())

if A % B == 0:
    print(A + B)
else:
    print(B - A)

A, B = map(int, input().split())

if B % A == 0:
    print(A + B)
else:
    print(B - A)

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
import numpy as np
n,m = map(int,input().split())
if b%a == 0:
    print(b+a)
else:
    print(b-a)

import numpy as np
a,b = map(int,input().split())
if b%a == 0:
    print(b+a)
else:
    print(b-a)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
def ans():
  a, b = map(int,input().split())
  if(a%b == 0):
    print(a+b)
  else:
    print(b-a)
ans()

a, b = map(int,input().split())
if b%a == 0:
  print(a+b)
else:
  print(b-a)

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
from sys import stdin

a, b = stdin.readline().rstrip().split()

for i in range(1, 21):
    if a * i > b:
        break

    if b % (a * i) == 0:
        print(a + b)
        break
else:
    print(b - a)

for i in range(1, 21):
    if a * i > b:
        break

    if b % (a * i) == 0:
        print(a + b)
        break
else:
    print(b - a)

from sys import stdin

a, b = stdin.readline().rstrip().split()
a, b = int(a), int(b)

for i in range(1, 21):
    if a * i > b:
        print(b - a)
        break

    if b % (a * i) == 0:
        print(a + b)
        break
else:
    print(b - a)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
N = int(input())
lst = list(map(int, input().split()))
boolean = False
updated_lst = []
minimum = min(lst)
min_num = 0
for i in lst:
  num = i % minimum
  if (i != minimum):
    updated_lst.append(num)
  else:
    updated_lst.append(minimum)
    min_num += 1
  if (num % 2 == 1):
    boolean = True

if (min_num == len(lst)):
  print(minimum)
else:
  if (boolean):
    print(1)
  else:
    print(min(updated_lst))


A, B = map(int, input().split())
if (B % A == 0):
  print(A + B)
else:
  print(B - A)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b = int(input())
if b%a:
  print(b-a)
else:
  print(b+a)

a,b = map(int,input().split())
if b%a:
  print(b-a)
else:
  print(b+a)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
A=int(input())
B=int(input())
if(A>0 and B%A==0):
  print(B+A)
else:
  print(B-A)
  

A B = map(int(),input().split())
if(A>0 && B%A==0):
  print(B+A)
else:
  print(B-A)
  

A,B = map(int,input().split())
if(A>0 && B%A==0):
  print(B+A)
else:
  print(B-A)
  

A=int(input())
B=int(input())
if(A>0 & B%A==0):
  print(B+A)
else:
  print(B-A)
  

A B = map(int(),input().split())
if(B%A==0):
  print(B+A)
else:
  print(B-A)
  

A=int(input())
B=int(input())
if(A>0 && B%A==0):
  print(B+A)
else:
  print(B-A)
  

A,B=map(int,input().split())
if(A>0 and B%A==0):
  print(B+A)
else:
  print(B-A)
  

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
from math import ceil
N = int(input())
a = [int(input()) for i in range(5)]
i = a.index(min(a))
ans = i-1 + ceil(N/min(a)) + 5 -i
print(ans)

A, B = map(int,input().split())
if B%A==0:
    print(A+B)
else:
    print(B-A)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a, b = map(int, input().split())

if a % b == 0:
    print(a + b)
else:
    print(a - b)


a, b = map(int, input().split())

if b % a == 0:
    print(a + b)
else:
    print(b - a)


Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b = input().split()

if b % a == 0:
	print(a+b)
else:
	print(b-a)


a,b = input().split()
a = int(a)
b = int(b)

if b % a == 0:
	print(a+b)
else:
	print(b-a)


Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
A = int(input())
B = int(input())
if(B%A == 0):
  print(A+B)
else:
  print(B-A)

A, B = map(int,input().split())
if(B%A == 0):
  print(A+B)
else:
  print(B-A)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
A, B = map(int, input().split())
if B%A=0:
  print(A+B)
else:
  print(B-A)

A, B =map(int, input().split())
if B%A=0:
    print(A+B)
else:
    print(B-A)

A, B = map(int, input().split())
if B%A==0:
  print(A+B)
else:
  print(B-A)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b = map(int,input().split())

if a%b==0 :
   print(a+b)
else :
   print(b-a)

a,b = map(int,input().split())

if b%a==0 :
   print(a+b)
else :
   print(b-a)

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):



def solve():
    
    num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
    N, M = map(int, input().split())
    A = [int(i) for i in input().split()]
    A.sort(reverse=True)
    
    
    dp = [-1 * float("inf")] * (N + 1)

    
    dp[0] = 0
    for a in A:
        if num[a] <= N:
            dp[num[a]] = 1
    
    for n in range(1, N + 1):
        for a in A:
            if n - num[a] >= 0:
                
                
                
                dp[n] = max(dp[n], dp[n - num[a]] + 1)
    
    # print(dp)

    
    ans = ''
    for i in range(dp[N]):  
        for a in A:
            
            
            
            
            
            
            
            if dp[N] - 1 == dp[N - num[a]]:
                ans += str(a)
                N -= num[a]
                break
        

    print(ans)


if __name__ == '__main__':
    solve()



def solve():
    A, B = [int(i) for i in input().split()]
    result = 0
    if B % A == 0:
        result = B + A
    else:
        result = B - A
    print(result)


if __name__ == '__main__':
    solve()


Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b=map(int, input().split())
if b/a==0:
  print(a+b)
else:
  print(b-a)

a,b=map(int, input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)


Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b = map(in(),input().split())
if(b%2 == 0):
  print(a+b)
else:
  print(b-a)

a,b = map(int,input().split())
if(b%a == 0):
  print(a+b)
else:
  print(b-a)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b=map(int,input().split())

if B%A==0:
    print(a+b)
else:
    print(b-a)

a,b=map(int,input().split())

if b%a==0:
    print(a+b)
else:
    print(b-a)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b = map(int,input().split())
if a % b == 0:
    print(a+b)
else:
    print(b-a)

A,B= map(int,input().split())
print(A+B if B%A==0 else B-A)


Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
nums = input().spilt(" ")
num1 = int(nums[0])
num2 = int(nums[1])
if num2 % num1 == 0:
  print(num1+num2)
else:
  print(num2-num1)

nums = input().spilt(" ")
num1 = int(nums[0])
num2 = int(nums[1])
if num2 % num1 == 0:
    print(num1+num2)
else:
    print(num2-num1)

nums = input().split(" ")
num1 = int(nums[0])
num2 = int(nums[1])
if num2 % num1 == 0:
  print(num1+num2)
else:
  print(num2-num1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a, b = input()
if b%a ==0:
  print(a+b)
  else:
    print(b-a)

a,b = input()
if b%a ==0:
  print(a+b)
else:
  print(b-a)


x,y=map(int,input().split())
if y%x ==0:
  print(x+y)
else:
  print(y-x)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
I = lambda: map(int, input().split())
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
minf = -10**9
n, _ = I()
*A, = sorted(I(), reverse = True)
digs = [0]*(n+1)
for i in range(1, n+1):
    d = []
    for a in A :
        before = i-nums[a]
        d.append(minf if before < 0 else digs[before]+1)
    digs[i] = max(d)
ans = []
while n > 0:
    for a in A:
        if digs[n-nums[a]] == digs[n]-1:
            ans.append(a)
            n -= nums[a]
            break
print(*ans, sep = '')

I = lambda: map(int, input().split())
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
minf = -float('inf')
n, _ = I()
*A, = sorted(I(), reverse = True)
digs = [0]*(n+1)
for i in range(1, n+1):
    d = []
    for a in A :
        before = i-nums[a]
        d.append(minf if before < 0 else digs[before]+1)
    digs[i] = max(d)
ans = []
while n > 0:
    for a in A:
        if digs[n-nums[a]] == (digs[n]-1):
            ans.append(a)
            n -= nums[a]
            break
print(*ans, sep = '')

I = lambda: map(int, input().split())
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
minf = -float('inf')
n, _ = I()
*A, = sorted(I(), reverse = True)
digs = [0]*(n+1)+[-1]*9
for i in range(1, n+1):
    d = []
    for a in A :
        before = i-nums[a]
        d.append(minf if before < 0 else digs[before]+1)
    digs[i] = max(d)
ans = []
while n > 0:
    for a in A:
        if digs[n-nums[a]] == digs[n]-1:
            ans.append(a)
            n -= nums[a]
            break
print(*ans, sep = '')

a, b = map(int, input().split())
print((-1)**(b%a != 0)*a+b)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a, b = map(int, input())
print([b+a,b-a][b%a>0])

a, b = map(int, input().split())
print([b+a,b-a][b%a>0])

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b = map(int,input().split())
print(a+b if a%b == 0 else b-a)

a,b = map(int,input().split())
print(a+b if b%a == 0 else b-a)

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b = [int(i) for i in input().split(" ")]
if(b//a == 0):
  print(a+b)
else:
  print(b-a)

a,b = [int(i) for i in input().split(" ")]
if(b%a == 0):
  print(a+b)
else:
  print(b-a)


Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a, b = map(int,input().split())
if a % b == 0:
  print(a+b)
else:
  print(a-b)

a, b = map(int,input().split())
if b % a == 0:
  print(a+b)
else:
  print(b-a)

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
A, B = map(int, input().split())

if A % B ==0:
    print(A + B)
else:
    print(B - A)


A, B = map(int, input().split())

if B % A ==0:
    print(A + B)
else:
    print(B - A)


Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
a,b = map(int, input().split())
if a%b==0:
  print(a+b)
else:
  print(b-a)

a,b = map(int, input().split())
if b%a==0:
  print(a+b)
else:
  print(b-a)

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
import collections
N = int(input())
mli = sorted(list(map(int,input().split())), reverse = False)
hp_min = mli[0]
index = 1
for i in range(1,N):
  if mli[index] % hp_min == 0:
    mli.pop(index)
  else:
    mli[index] = mli[index] % hp_min
    hp_min = mli[index]
    index += 1
    
#if mli[i] % hp_min != 0:
  #hp_min = mli[i] % hp_min 
print(hp_min)

A,B = map(int, input().split())
if B % A == 0:
  print(A+B)
else:
  print(B-A)

Verdicts: Runtime Error

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
from sys import stdin, exit

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

a, b = mi()
if a / b % 1 == 0:
    print(a+b)
else:
    print(b-a)

from sys import stdin, exit

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

a, b = mi()
if b / a % 1 == 0:
    print(a+b)
else:
    print(b-a)

Verdicts: Wrong Answer

Accepted
Problem: You are given positive integers A and B.  If A is a divisor of B, print A + B; otherwise, print B - A.

Submission attempts (in order):
import copy

n, m = map(int, input().rstrip().split())
number_list = list(map(int, input().rstrip().split()))
number_list.sort()
match = [2, 5, 5, 4, 5, 6, 3, 7, 6]
new_match = []
answer = []

for i in number_list:
    new_match.append(match[i-1])


for index in range(m):
    value = new_match[index]
    new_match_tmp = copy.copy(new_match)
    new_match_tmp.remove(value)
    maximum = max(new_match_tmp)
    
    quotient = int(n / value)
    remainder = n % value
    answer_tmp = [number_list[index]] * quotient
    
    if remainder != 0:
        while True:
            quotient -= 1
            remainder += value
            answer_tmp.pop(0)
            if remainder in new_match:
                answer_tmp.append(number_list[new_match.index(remainder)])
                break
            elif remainder > maximum:
                try:
                    minimum = min(new_match_tmp)
                    remainder -= minimum
                    answer_tmp.append(number_list[new_match.index(minimum)])
                except:
                    answer_tmp = []
                    break
            if remainder == n:
                answer_tmp = []
                break

    if len(answer_tmp) != 0:
        answer.append(answer_tmp)

answer.sort(key=lambda x:len(x), reverse=True)
ans = reversed(answer[0])

print(*ans, sep='')
print()


a,b = map(int, input().rstrip().split())

if b % a == 0:
  print(a+b)
else:
  print(b-a)


Verdicts: Runtime Error

Accepted
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 = int(input())
a = list(map(int,input().split()))

x = [a[1],a[0],a[1] % a[0]]
a.sort()
for i in range(1,n+1):
    while x[2] > 0:
        x[0] = x[1]
        x[1] = x[2]
        x[2] = x[0] % x[1]
    x[0] = a[i+1]
    x[2] = x[0] % x[1]

print(x[1])


n,m = map(int,input().split())
ka = list(list(map(int,input().split())) for _ in range(n))

like = [0]*m
for i in range(n):
    for j in range(1,ka[i][0]+1):
        like[ka[i][j]-1] += 1

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

print(answer)


Verdicts: Runtime Error

Accepted
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):
number=list(map(int,input().split()))
likes=[]
result=0
for i in number[0]:
    for j in number[1]:
        rawdata=list(map(int,input().split()))
        for k in rawdata[0]:
            likes.append(rawdata[k+1])
for i in number[1]:
    if likes.count(i+1):
        result+=1
print(result)

number=list(map(int,input().split()))
likes=[]
result=0
for i in range(number[0]):
    rawdata=list(map(int,input().split()))
    for k in range(rawdata[0]):
        likes.append(rawdata[k+1])
for i in range(number[1]):
    if likes.count(i+1):
        result+=1
print(result)

number=list(map(int,input().split()))
likes=[]
result=0
for i in range(number[0]):
    for j in range(number[1]):
        rawdata=list(map(int,input().split()))
        for k in range(rawdata[0]):
            likes.append(rawdata[k+1])
for i in range(number[1]):
    if likes.count(i+1):
        result+=1
print(result)

number=list(map(int,input().split()))
likes=[]
result=0
for i in range(number[0]):
    rawdata=list(map(int,input().split()))
    for k in range(rawdata[0]):
        likes.append(rawdata[k+1])
for i in range(number[1]):
    if likes.count(i+1)==number[0]:
        result+=1
print(result)


Verdicts: Runtime Error

Wrong Answer

Runtime Error

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

x_set = set(A_list[0][1:])
for i in range(1, N):
  x_set = x_set | set(A_list[i][1:])
print(len(x_set))
  

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

x_set = set(A_list[0][1:])
for i in range(1, N):
  x_set = x_set & set(A_list[i][1:])
print(len(x_set))
  

Verdicts: Runtime Error

Accepted
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):
man,food = map ( int ,input ().split())
num = set(range(food+1))
for i in range(man) :
    a = list ( map ( int () , input . split ()))
    del a[0]
    num = num & a
plint (len (num) )


man,food = map ( int ,input().split())
num = set(range(food+1))
for i in range(man) :
    a = list ( map ( int  , input().split ()))
    del a[0]
    a = set (a)
    num = num & a
print (len (num) )


Verdicts: Runtime Error

Accepted
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())
l=[]
for i in range(n):
    a=len(l)
    l.append(map(str,input().split()))
    b=len(l)-a
    l.pop(-b)
s=[]
i=0
while i<m:
    i+=1
    i=str(i)
    s.append(l.count(i))
    i=int(i)
print(s.count(m))

n,m=map(int,input().split())
l=[]
for i in range(n):
    a=list(map(str,input().split()))
    v=int(a[0])
    a.pop(0)
    for i in range(v):
        l.append(a[i])
s=[]
i=0
while i<m:
    i+=1
    i=str(i)
    s.append(l.count(i))
    i=int(i)
print(s.count(n))

Verdicts: Wrong Answer

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

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

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

Verdicts: Wrong Answer

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

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

Verdicts: Runtime Error

Accepted
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())
A=[]*N
for i in ragne(N):
  A[i]=list(map(int,input().split()))

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

Verdicts: Runtime Error

Accepted
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())
C = [0] * (M+1)
for i in range(N):
    K = list(map(int, input().split()))
    for k in range(len(k)):
        C[K[k]] += 1
count = 0

for c in C:
    if c == N:
        count += 1

print(count)

N,M = map(int,input().split())
C = [0] * (M+1)
for i in range(N):
    K = list(map(int, input().split()))
    for k in range(len(K)):
        if k != 0:
            C[K[k]] += 1
count = 0

for c in C:
    if c == N:
        count += 1

print(count)

Verdicts: Runtime Error

Accepted
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):
from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
l = []
for i in range(N):
    l.append(stdin.readline().rstrip().split())
k = l[0]
for i in range(N):
    k = k&l[i]
print(len(k))

from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
l = []
m = []
for i in range(N):
    l.append(stdin.readline().rstrip().split())
    l[i].pop(0)
k = l[N-1]
for i in range(N-1):
    k = set(k)&set(l[i])
print(len(k))

Verdicts: Runtime Error

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

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

Verdicts: Wrong Answer

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

n,m = map(int,input().split())
food = [0 for i in range(m+1)]
for i in range(n):
    a = input().split()
    for j in range(1,int(a[0])):
        food[int(a[j])] += 1
count = 0
for i in food:
    if i = n:
        count += 1
print(count)

n,m = map(int,input().split())
food = [0 for i in range(m+1)]
for i in range(n):
    a = input().split()
    for j in range(0,int(a[0])):
        food[int(a[j])] += 1
count = 0
for i in food:
    if i = n:
        count += 1
print(count)

n,m = map(int,input().split())
food = [0 for i in range(m)]
for i in range(n):
    k = int(input())
    for j in range(k):
        food[int(input())] = 1
print(food.index(0))

n,m = map(int,input().split())
food = [0 for i in range(m+1)]
for i in range(n):
    a = input().split()
    for j in range(1,int(a[0])+1):
        food[int(a[j])] += 1
count = 0
for i in food:
    if i == n:
        count += 1
print(count)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

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

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

n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
for i in a:
    i.pop(0)
for i in range(n-1):
    a[i+1] = set(a[i]) & set(a[i+1])
print(len(a[n-1]))

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

Verdicts: Wrong Answer

Runtime Error

Accepted
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())
a=[list(map(int,input().split())) for i in range(n)]
y=0
if n!=1:
    for i in range(m):
        x=0
        for j in range(n):
            print(a[j][1:a[j][0]+1])
            if i+1 in a[j][1:a[j][0]+1]:
                x+=1
                print(x)
            else:
                x+=0
                print(x)
        if x==n:
            y+=1
    print(y)
else:
    for i in range(2,a[0][0]+1):
        if a[0][1]!=a[0][i]:
            y+=1
    print(y+1)

n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
y=0
if n!=1:
    for i in range(m):
        x=0
        for j in range(n):
            if i+1 in a[j][1:a[j][0]+1]:
                x+=1
            else:
                x+=0
        if x==n:
            y+=1
    print(y)
else:
    for i in range(2,a[0][0]+1):
        if a[0][1]!=a[0][i]:
            y+=1
    print(y+1)

Verdicts: Wrong Answer

Accepted
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())  
list1 = [0] * n

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

ans = 0
print(list1)

for i in range(m):
    check = 0
    for j in range(n):
        if not i+1 in list1[j]:
            check =1
            break
    
    if check == 0:
        ans += 1


print(ans)

n,m=map(int, input().split())  
list1 = [0] * n

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

ans = 0

for i in range(m):
    check = 0
    for j in range(n):
        if not i+1 in list1[j]:
            check =1
            break
    
    if check == 0:
        ans += 1


print(ans)

Verdicts: Wrong Answer

Accepted
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())
k=[]*n
a=[]*n
s=set(range(1,M+1))
for i in range(n):
    tmp=list(map(int, input().split()))
    k[i]=tmp[0]
    a[i]=tmp[1:]
    s= s & set(a[i])

print(len(s))




n,m= map(int, input().split())
k=[]*n
a=[]*n
s=set(range(1,M+1))
for i in range(n):
    tmp=list(map(int, input().split()))
    k[i]=tmp[0]
    a[i]=tmp[0:]
    s= s & set(a[i])

print(len(s))




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

print(len(s))


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

print(len(s))


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
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):
# ABC118B - Foods Loved by Everyone
n, m = list(map(int, input().rstrip().split()))
lst = [list(map(int, input().rstrip().split())) for _ in range(n)]
data = [0] * m
count = 0
for i in range(n):
    for j in range(m):
        if j in lst[i]:
            data[j] += 1

for k in range(m):
    if data[k] == n:
        count += 1
        
print(count)


# ABC118B - Foods Loved by Everyone
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    cnt = defaultdict(int)
    for _ in range(N):
        _, *A = map(int, input().split())
        for a in A:
            cnt[a] += 1
    ans = sum(i == N for i in cnt.values())


if __name__ == "__main__":
    main()

# ABC118B - Foods Loved by Everyone
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    cnt = defaultdict(int)
    for _ in range(N):
        _, *A = map(int, input().split())
        for a in A:
            cnt[a] += 1
    ans = sum(i == M for i in cnt.values())
    print(ans)


if __name__ == "__main__":
    main()

# ABC118B - Foods Loved by Everyone
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    cnt = defaultdict(int)
    for _ in range(N):
        _, *A = map(int, input().split())
        for a in A:
            cnt[a] += 1
    ans = sum(i == N for i in cnt.values())
    print(ans)


if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
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())
all_dish = []

for n in range(N):
    K_n_list = list(map(int, input().split()))
    del K_n_list[0]
    all_dish = [K_n_list_num for K_n_list_num in K_n_list]

#   for K_n_list_num in K_n_list:


prefer_dish = []
dish_kind = list(set(all_dish))
#prefer_dish = [dish_kind_num for dish_kind_num in dish_kind if all_dish.count(dish_kind_num) == N]
for dish_kind_num in dish_kind:
    if all_dish.count(dish_kind_num) == N:
        prefer_dish.append(dish_kind_num)

print(len(prefer_dish))

N, M = map(int, input().split())
all_dish = []

for n in range(N):
    K_n_list = list(map(int, input().split()))
    del K_n_list[0]
#    all_dish = [K_n_list_num for K_n_list_num in K_n_list]

   for K_n_list_num in K_n_list:
       all_dish.append(K_n_list_num)

prefer_dish = []
dish_kind = list(set(all_dish))
prefer_dish = [dish_kind_num for dish_kind_num in dish_kind if all_dish.count(dish_kind_num) == N]

#    if all_dish.count(dish_kind_num) == N:
#        prefer_dish.append(dish_kind_num)

print(len(prefer_dish))

N, M = map(int, input().split())
all_dish = []

for n in range(N):
    K_n_list = list(map(int, input().split()))
    del K_n_list[0]
    all_dish = [K_n_list_num for K_n_list_num in K_n_list]

prefer_dish = []
dish_kind = list(set(all_dish))
prefer_dish = [dish_kind_num for dish_kind_num in dish_kind if all_dish.count(dish_kind_num) == N]

print(len(prefer_dish))

N, M = map(int, input().split())
all_dish = []

for n in range(N):
    K_n_list = list(map(int, input().split()))
    del K_n_list[0]
    all_dish = [K_n_list_num for K_n_list_num in K_n_list]

#    for K_n_list_num in K_n_list:


prefer_dish = []
dish_kind = list(set(all_dish))
prefer_dish = [dish_kind_num for dish_kind_num in dish_kind if all_dish.count(dish_kind_num) == N]

print(len(prefer_dish))

ii=lambda:int(input())
miis=lambda:map(int,input().split())
lmiis=lambda:list(map(int,input().split()))

n,m=miis()

k=lmiis()
st=set(k[1:])

for i in range(n-1):
  ki=lmiis()
  st=st&set(ki[1:])

print(len(st))

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
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):
a = list(map(int, input().split()))
likefood = []
result = 0

for i in range(a[0]):
    b = list(map(int, input().split()))
    for k in range(b[0]):
        likefood.append(k)

for i in range(a[1]):
    if likefood.count(i) == a[0]:
        result += 1

print(result)

a = list(map(int, input().split()))
likefood = []
result = 0

for i in range(a[0]):
    b = list(map(int, input().split()))
    for k in range(b[0]):
        likefood.append(k+1)

for i in range(a[1]):
    if likefood.count(i+1) == a[0]:
        result += 1

print(result)

a = list(map(int, input().split()))
likefood = []
result = 0

for i in range(a[0]):
    b = list(map(int, input().split()))
    for k in range(b[0]):
        likefood.append(b[k+1])

for i in range(a[1]):
    if likefood.count(i+1) == a[0]:
        result += 1

print(result)

Verdicts: Wrong Answer

Wrong Answer

Accepted
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())
el = {}
for i in range(N):
    P = list(map(int, input().split())).pop(0)
    if i == 0: el = set(P)
    el = el & set(P)
print(len(el))

N,M = map(int, input().split())
el = {}
for i in range(N):
    P = list(map(int, input().split()))
    K = P.pop(0)
    if i == 0: el = set(P)
    el = el & set(P)
print(len(el))

Verdicts: Runtime Error

Accepted
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())
likes = set([])
for i in range(n):
  like = list(input().split())
  like.pop(0)
  likes = likes & set(like)
print(len(likes))

n,m = map(int,input().split())
likes = set(list(input().split())[1:])
for i in range(n-1):
  like = list(input().split()[1:])
  likes = likes & set(like)
print(len(likes))

Verdicts: Wrong Answer

Accepted
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())
m= [ 0 for in range(M)]
for i in range(N):
  A = list(map(int, input().split()))
  for j in range(A[0]):
    m[A[j+1]-1]+=1
ans=0
for i in range(M):
  if m[i] == N:
    ans += 1
print(ans)
    

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

Verdicts: Runtime Error

Accepted
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 = [[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)

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):
        listA[i].pop(0)
        if a in listA[i]:
            ans += 1


print(ans)

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)

Verdicts: Wrong Answer

Runtime Error

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


n,m=map(int,input().split())
ans=[0]*m
for i in range(n):
  x=[int,input().split()]
  for j in range(1,x[0]+1):
    ans[x[j]-1]+=1
  
print(ans.count(n)) 
    

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



Verdicts: Runtime Error

Runtime Error

Accepted
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 = list(map(int,input().split()))
lst = list(map(int,input().split()))
for i in range(N-1):
    k = list(map(int,input().split()))
    for j in k[1:]:
        if j in lst:
            continue
        else:
            lst.remove(j)
print(len(lst))

N,M = [int(x) for x in input().split()]
k = [0] * (M+1)
for i in range(N):
    a = [int(x) for i in input().split()]
    del a[0]
    for j in a:
        k[j] += 1
print(k.count(N))

n,m = map(int, input().split())
ans = list(input().split())
ans = set(ans[1:])
for i in range(n-1):
    b = list(input().split())
    b = set(b[1:])
    ans = ans & b
print(len(ans))

Verdicts: Runtime Error

Runtime Error

Accepted