TnT/Multi_CodeNet4Repair huggingface dataset:
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):
import numpy as np
N, M =map(int,input().split())
search = np.zeros(M+1)
for i in range(N):
    K = list(map(int,input().split()))
    for j in range(1,K[0]+1):
        search[K[j]]+=1
place = np.where(search==N)
print(search)
print(place)
print(len(place[0]))

import numpy as np
N, M =map(int,input().split())
search = np.zeros(M+1)
for i in range(N):
    K = list(map(int,input().split()))
    for j in range(1,K[0]+1):
        search[K[j]]+=1
place = np.where(search==N)
print(len(place[0]))

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())
kind = [0]
for res in range (0,M):
    kind.append(0)
for x in range (0,N):
    like = map(int,input().split())
    like = list(like)
    for i in range (0,len(like)):
        kind[like[i]] += 1
print(kind.count(N))


N,M = map(int,input().split())
K = [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,0,0]

for person in range(0,N):
    L = list(map(int,input().split()))
    for kind in range(1,L[0]+1):
        K[L[kind]] += 1
print(K.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(" "))
data = []
for i in range(N):
  A = list(map(int, input().split(" ")))
  A_ = A[1:].sort()
  data.append(A_)
  
counter = 0  
for m in range(M):
  flag = 1
  for d in data:
    if m in d:
      flag *= 1
    else:
      flag *= 0
  if flag == 1:
    counter += 1

print(counter)
      
    

N, M = map(int, input().split(" "))
data = []
for i in range(N):
  A = list(map(int, input().split(" ")))
  A_ = sorted(A[1:])
  data.append(A_)
  
counter = 0  
for m in range(M):
  flag = 1
  for d in data:
    if m+1 in d:
      flag *= 1
    else:
      flag *= 0
  if flag == 1:
    counter += 1

print(counter)
      

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


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

    print(len(originalList))










if __name__== "__main__":
    main() 



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

    print(len(originalList))


if __name__== "__main__":
    main() 

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 = [int(nm) for nm in input().split()]
for n in range(N):
  KA = [int(ka) for ka in input().split()]
  for ka in range(len(KA)-1):
    L.append(KA[ka+1])
like = 0
for m in range(M):
  if L.count(m+1) == N:
    like += 1
print(like)

N, M = [int(nm) for nm in input().split()]
L = []
for n in range(N):
  KA = [int(ka) for ka in input().split()]
  for ka in range(len(KA)-1):
    L.append(KA[ka+1])
like = 0
for m in range(M):
  if L.count(m+1) == N:
    like += 1
print(like)

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

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]  
    print(td)
    
    while j <= m: 
        
        if j in td: 
            j = int(j) 
            print(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()
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()
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)


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

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)

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::]
        for j in range(0,len(liketmp)-1):
            if liketmp[j] not in like:
                if ans>0:
                    ans-=1
                    if ans==0:
                        break

        for k in range(0,len(like)):
             if like[k] not in liketmp:
                 if ans>0:
                     ans-=1
                     if ans==0:
                         break

print(ans)


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::]
        for k in range(0,len(like)):
             if like[k] not in liketmp:
                 if ans>0:
                     ans-=1
                     del like[k]
                     if ans==0:
                         break

print(ans)


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)


Verdicts: Wrong Answer

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 = input().split(" ")
S = set(str(i) for i in range(1, int(M)+1))
print(S)

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

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

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())
r = int32(-1)
for i in range(M):
  A = list(map(int,input().split()))
  A.pop(0)
  c = 0
  for a in A:
    c |= (1 << (a-1))
  d &= c

ans = sum([(d>>n)&1 for n in range(n)])
print(ans)

inpl = lambda: list(map(int,input().split()))
N, M = inpl()
fav = [1]*M
for _ in range(N):
    A = inpl()[1:]
    for m in range(M):
        if m+1 in A:
            pass
        else:
            fav[m] = 0
print(sum(fav))

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

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

arr=[]
for _ in range(n):
  k,*a=list(map(int,input().split()))
  arr.extend(a)
  
c = collections.Counter(a)

cnt=0
for c_ in c.most_common():
  if n == c_[1]:
    cnt+=1
print(cnt)

import collections
n,m=list(map(int,input().split()))

arr=[]
for _ in range(n):
  k,*a=list(map(int,input().split()))
  arr.extend(a)

c = collections.Counter(arr)

cnt=0
for c_ in c.most_common():
  if n == c_[1]:
    cnt+=1
print(cnt)

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

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

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

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

print(res)



n, m = [int(i) for i in input().split(" ")]

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

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

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

print(res)


import numpy as np
n, m = [int(i) for i in input().split(" ")]

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

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

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

print(res)


n, m = [int(i) for i in input().split(" ")]

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

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

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

print(res)


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

N,M = map(int,input().split())
member = dict()
for i in range(1,N+1,1):
    j=int(input())
    member[i] = set(int(input()) for _ in range(j))
if(N==1):
    print(member(1))
    sys.exit(0)

match_set=member[1]
for i in range(2,N+1,1):
    match_set = match_set & member[i]

print(match_set.length)
        


import sys

N,M = map(int,input().split())
member = dict()
for i in range(1,N+1,1):
    ilist = list(map(int,input().split()))
    ilist.pop(0)
    member[i]=set(ilist)

match_set=member[1]

for i in range(2,N+1,1):
    match_set = match_set & member[i]

print(len(match_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):
N,M = map(int,input().split())
ans = []
for i in range(N):
    KA = list(map(int,input().split()))
    for j in range(1,len(KA)):
        ans[[KA[j]-1]] += 1
print(ans.count(N))

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

N,M = map(int,input().split())
ans = [0]*M
for i in range(N):
    KA = list(map(int,input().split()))
    for j in range(1,len(KA)):
        ans[KA[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 = map(int,input().split())
ans = [0 for _ in range(M)]
for _ in range(N):
  like = list(map(int,input().split()))
  for i in like:
    ans[i-1] += 1
print(ans.count(N))

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

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

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())
lists=[list(map(int,input().split())) for x in range(n)]
ans=[0]*m
for x in range(n):
  k=lists[x][0]
  for t in range(k):
    ans[lists[x][t+1]-1]+=1
count=0
for y in range(m):
  if ans[x]==n:
    count+=1
print(count)

n,m=map(int,,input().split())
ans=[0]*m
l=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
  k=l[i][0]
  for j in (1,k+1):
    ans[l[i][j]-1]+=1
cnt=0
for aa in ans:
  if aa==n:
    cnt+=1
print(cnt)

n,m=map(int,input().split())
ans=[0]*m
l=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
  k=l[i][0]
  for j in range(1,k+1):
    ans[l[i][j]-1]+=1
cnt=0
for aa in ans:
  if aa==n:
    cnt+=1
print(cnt)

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 = map(int,input())
sum = {}
ans = 0

for i in range(n):
  k = list(map(int,input().split()))
  for j in range(1,k[0] + 1):
    if k[j] not in sum:
      sum[k[j]] = 1
    else:
      sum[k[j]] += 1
for l in sum:
  if sum[l] == n:
    ans += 1
print(ans)

n,m = map(int,input().split())
sum = {}
ans = 0

for i in range(n):
  k = list(map(int,input().split()))
  for j in range(1,k[0] + 1):
    if k[j] not in sum:
      sum[k[j]] = 1
    else:
      sum[k[j]] += 1
for l in sum:
  if sum[l] == 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())

t1=list(map(int,input().split()))
ans=set(t1[1:])
for _ in range(n-1):
    t2=list(map(int,input().split()))
    ans &= set(t2[1:])

print(ans)

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

t1=list(map(int,input().split()))
ans=set(t1[1:])
for _ in range(n-1):
    t2=list(map(int,input().split()))
    ans &= set(t2[1:])

print(len(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=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(a) if x == max(tmp)]
print(len(maxIndex)

n,m=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(t) if x == max(t)]
print(len(maxIndex)

import numpy as np

n,m=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(t) if x == n]
print(len(maxIndex))

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=map(int,input().split())
checks=[0 for i in range(m)]
print(len(checks))
for i in range(n):
  l=list(map(int,input().split()))
  for j in range(1,len(l)):
    checks[l[j]-1]+=1
ans=checks.count(n)
print(ans)

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

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

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):
import itertools
n,m=map(int,input().split())
s=list(input().split() for i in range(n))
l=[]
c=0
for j in range(n):
    l.append(s[j][1:])
l=list(itertools.chain.from_iterable(l))    

for i in range(1,m+1):
    if l.count('i')==n:
        c+=1
print(c)        
        

import itertools
n,m=map(int,input().split())
s=list(input().split() for i in range(n))
l=[]
c=0
for j in range(n):
    l.append(s[j][1:])
l=list(itertools.chain.from_iterable(l))    

for i in range(1,m+1):
    if l.count(str(i))==n:
        c+=1
print(c)        
        

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

pref = [0] * (m+1)
for i in range(n):
    ka = list(map(int,input().split()))
    for j in range(1,ka[0]):
        pref[ka[j]]+=1

ans = 0
for p in pref:
    if p == n:
        ans += 1

print(ans)


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

pref = [0] * (m+1)
for i in range(n):
    ka = list(map(int,input().split()))
    for j in range(1,ka[0]):
        pref[ka[j]]+=1


print(sum([1 for k in pref if k == n]))


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

pref = [0] * m
for i in range(n):
    k, *a = map(int,input().split())
    for j in range(k):
        pref[a[j]-1] += 1


print(sum([1 for k in pref if k == n]))


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())
a= [list(map(int,input().split())) for i in range(n)]
for i in range(n):
    del a[i][0]
print(a)
v=[]

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

  
print(x)

n=int(input())
s=[int(input()) for i in range(n)]
 
print(sum(s)-max(s)//2)

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

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

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

  
print(x)

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

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)

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):
X,Y = map(int,input().split())
A = list(map(int,input().split()))
A = set(A[1:])
for i in range(X-1):
    A = list(map(int,input().split()))
    B = B & set(A[1:])
print(len(B))

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



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())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))
#print(data)
counter2 = 0
for i in range(1, M + 1):
    counter1 = 0
    for ans in data:
        num = ans[0]
        if i in ans[1 : num + 1]:
            counter1 += 1
            print("{} {}".format(i, counter1))
        else:
            counter1 = 0
            break
    if counter1 == N:
        counter2 += 1
print(counter2)

N, M = map(int, input().split())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))
#print(data)
counter1 = 0
counter2 = 0
for i in range(1, M + 1):
    for ans in data:
        num = ans[0]
        
        if i in ans[1 : num + 1]:
            counter1 += 1
        else:
            counter1 = 0
            break
    if counter1 == N:
        print(i)
        counter2 += 1
print(counter2)

data = []
for i in range(N):
    data.append(list(map(int, input().split())))
#print(data)
counter1 = 0
counter2 = 0
for i in range(1, M + 1):
    for ans in data:
        num = ans[0]
        
        if i in ans[1 : num + 1]:
            counter1 += 1
        else:
            counter1 = 0
            break
    if counter1 == N:
        print(i)
        counter2 += 1
print(counter2)


N, M = map(int, input().split())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))
#print(data)
counter2 = 0
for i in range(1, M + 1):
    counter1 = 0
    for ans in data:
        num = ans[0]
        if i in ans[1 : num + 1]:
            counter1 += 1
        else:
            counter1 = 0
            break
    if counter1 == N:
        counter2 += 1
print(counter2)

Verdicts: Wrong Answer

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):
from sys import stdin, exit
from math import factorial
input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())
si = lambda: input().strip('\n')
ssi = lambda: input().strip('\n').split()

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

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

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

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

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

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())
s=0
a = [list(input().split())for i in range(N)]
for i in range(N):
    del a[i][0]
b=set(a)
print(len(b))

N,M=map(int,input().split())
s=0
a = [list(input().split())for i in range(N)]
for i in range(N):
    del a[i][0]
    a[i]=set(a[i])
c=a[0]
for i in range(N):
    c=c&a[i]
print(len(c))


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

N, M = map(int, input().split())
K = []
A = []
for n in range(N):
    INPUT = list(map(int, input().split()))
    K.append(INPUT[0])
    A.append(INPUT[1:])
intersection=set(A[0])
for a in A:
    intersection=intersection&set(a)
print(len(intersection))

Verdicts: Wrong Answer

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
# -*- coding: utf-8 -*-

import sys
import math

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        for line in sys.stdin:
            lines.append(line)
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    
    nm = lines[0].split(" ")
    n = int(nm[0])

    rows = []
    for i in range(1, 2):
        rows.append([int(e) for e in lines[i].split(" ")])

    return (n, rows[0])

def solve(n, monsters):

    g = monsters[0]
    for i in range(1, n):
        g = math.gcd(g, monsters[i])


    return g

def main():

    n, m, rows = parse_input()
    print("%d" % solve(n, m, rows))

if __name__ == '__main__':

    main()


# -*- coding: utf-8 -*-

import sys

def gcd(a, b):

    c = min(a, b)
    d = max(a, b)
    r = 0    
    while True:
        r = d % c
        if r == 0:
            break
        d = c
        c = r

    return c

def parse_input(lines_as_string = None):

    lines = []
    if lines_as_string is None:
        for line in sys.stdin:
            lines.append(line)
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    
    nm = lines[0].split(" ")
    n = int(nm[0])

    rows = []
    for i in range(1, 2):
        rows.append([int(e) for e in lines[i].split(" ")])

    return (n, rows[0])

def solve(n, monsters):

    g = monsters[0]
    for i in range(1, n):
        g = gcd(g, monsters[i])


    return g

def main():

    print("%d" % solve(*parse_input()))

if __name__ == '__main__':

    main()


Verdicts: Runtime Error

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

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

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

print(x[1])


Verdicts: Runtime Error

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
number=int(input())
hitpoint=list(map(int,input().split()))
xyz=[]
png=[]
m=min(hitpoint)
for i in range(len(hitpoint)):
    xyz.append(hitpoint[i]%2)
if hitpoint.count(hitpoint[0])==len(hitpoint):
    print(hitpoint[0])
elif hitpoint[len(hitpoint)]%m==0:
    for i in range(len(hitpoint)):
        png.append(hitpoint[i]%m)
    if png.count(0)==len(png):
        print(min(hitpoint))
    else:
        if hitpoint.count(1)!=0:
            print(1)
        elif xyz.count(0)!=len(xyz):
            print(1)
        elif xyz.count(1)==len(xyz):
            print(1)
        else:
            print(2)
elif hitpoint.count(1)!=0:
    print(1)
elif xyz.count(0)!=len(xyz):
    print(1)
elif xyz.count(1)==len(xyz):
    print(1)
else:
    print(2)

number=int(input())
hitpoint=list(map(int,input().split()))
xyz=[]
png=[]
m=min(hitpoint)
for i in range(len(hitpoint)):
    xyz.append(hitpoint[i]%2)
if hitpoint.count(hitpoint[0])==len(hitpoint):
    print(hitpoint[0])
elif hitpoint[len(hitpoint)]%m==0:
    for i in range(len(hitpoint)):
        png.append(hitpoint[i]%m)
    if png.count(0)==len(png):
        print(min(hitpoint))
elif hitpoint.count(1)!=0:
    print(1)
elif xyz.count(0)!=len(xyz):
    print(1)
elif xyz.count(1)==len(xyz):
    print(1)
else:
    print(2)

n=int(input())
def gcd(x,y):
  if y==0:
    return x
  else:
    return gcd(y,x%y)
a=list(map(int,input().split()))
stack=a.pop()
for i in a:
  stack=gcd(i,stack)
print(stack)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
N = int(input())
monsters = list(map(int, input().split()))
def gcd(a, b):
	if b > 0 :
      return gcd(b , a % b)
    else :
      return x
if len(monster) == 1 :
	print(monster[0])
else :
    mon = gcd(monster[0], monster[1])
    if len(monster) >= 2
    for i in range(2 , N) :
      mon = gcd(mon, monster[i])
print(mon)
    
    
    
     


N = int(input())
monster = list(map(int, input().split()))
def gcd(a, b):
	if b > 0 :
		return gcd(b, a % b)
	else:
		return a
if len(monster) == 1 :
	print(monster[0])
else:
	mon = gcd(monster[0], monster[1])
	if len(monster) != 2 :
		for i in range(2, N) :
			mon = gcd(mon, monster[i])
print(mon)

Verdicts: Runtime Error

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
while True:
	print(A)
	min_a = A.min()
	new_A = np.where(A%min_a==0,min_a,A%min_a)
	A = new_A
	if (np.all(A == A[0])):
		break
print(A.min())


import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
while True:
	min_a = A.min()
	new_A = np.where(A%min_a==0,min_a,A%min_a)
	A = new_A
	if (np.all(A == A[0])):
		break
print(A.min())


Verdicts: Wrong Answer

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
from fractions import gcd


def main():
    n = int(input())
    As = list(map(int, input().split()))
    print(n)
    print(As)
    ans = gcd(As[0], As[1])
    for i in range(2, n):
        ans = gcd(ans, As[i])
    print(ans)


if __name__ == "__main__":
    main()


import math


def main():
    n = int(input())
    As = sorted(list(map(int, input().split())))

    ans = math.gcd(As[0], As[1])
    for i in range(2, n):
        ans = math.gcd(ans, As[i])
    print(ans)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
n = int(input()) 
a = [int(i) for i in input().split() ]

a = list(set(a))
a.sort()
while len(a) > 1:
    while (a[0] < a[1]):
        a[1] -= a[0]
    a = list(set(a))
    a.sort()
    if a[0] == 1:
        break
    if len(a) == 2:
        a[0] = a[1]%a[0]
        break
print(a[0])

n = int(input()) 
a = [int(i) for i in input().split() ]

a = list(set(a))
a.sort()
while len(a) > 1:
    while (a[0] < a[1]):
        a[1] %= a[0]
    x = a[1]
    a[1] = a[0]
    a[0] = x
    if a[0] == 0:
        a.pop(0)
    if a[0] == 1:
        break
print(a[0])

Verdicts: Wrong Answer

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
N = int(input())
list_A = list(map(int,input().split()))
for _ in range(100):
    min_A = min(list_A)
    list_A.remove(min_A)
    l = np.array([list_A]) % min_A
    lr = list(l.ravel())
    lr.append(min_A)
    list_A = [x for x in lr if x != 0]
    if len(list_A) <= 1:
        break
print(list_A[0])

import numpy as np
N = int(input())
list_A = list(map(int,input().split()))
for _ in range(100):
    min_A = min(list_A)
    list_A.remove(min_A)
    l = np.array([list_A]) % min_A
    lr = list(l.ravel())
    lr.append(min_A)
    list_A = [x for x in lr if x != 0]
    if len(list_A) <= 1:
        break
print(list_A[0])

Verdicts: Runtime Error

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
n = int(input())
lst_a = list(map(int, input().split()))

def gcd(a, b):
    if b==0:
        return a
    else:
        gcd(b, a%b)

ans = lst_a[0]
for a in lst_a:
    
    ans = gcd(ans, a)

print(ans)

n = int(input())
lst_a = list(map(int, input().split()))

def gcd(a, b):
    if b==0:
        return a
    else:
        return gcd(b, a%b)

ans = lst_a[0]
for a in lst_a:
    
    ans = gcd(ans, a)

print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N monsters, numbered 1, 2, ..., N.  Initially, the health of Monster i is A_i.  Below, a monster with at least 1 health is called alive.  Until there is only one alive monster, the following is repeated:    * A random alive monster attacks another random alive monster.   * As a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.  Find the minimum possible final health of the last monster alive.

Submission attempts (in order):
n = int(input())
2.b = list(map(int,input().split()))
3.b.sort()
4.     
5.d = b[0] + 0
6. 
7.while len(b) > 1 :
8.    for i in range(1,len(b)) :
9.        b[i] = b[i] % b[0]
10.    if b.count(0) == len(b)-1 :
11.        d = b[0]
12.        break
13.    else :
14.        b.sort()
15.        for j in range(b.count(0)) :
16.            b.remove(0)
17.print(d)


def gcd(a,b):
    if(a%b==0):
        return b
    else:
        return gcd(b,a%b)
N = int(input())
s = [int(x) for x in input().split()]
tmp = s[0]
for i in s[1:]:
    tmp = gcd(tmp,i)
print(tmp)

Verdicts: Runtime Error

Accepted