Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
k, x = int(input().split())
if 500*k >= x:
    print('Yes')
else:
    print('No')

Fixed submission:
k, x = map(int,input().split())
if 500*k >= x:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
A. B = map(int,input().split())
if A <= B*2:
    print(0)
else:
    print(A-2*B)

Fixed submission:
A, B = map(int,input().split())
if A <= B*2:
    print(0)
else:
    print(A-2*B)
Buggy python submission (verdict: Runtime Error):
s = input()
print(s.replace(7,8))

Fixed submission:
s = input()
print('2018' + s[4:])
Buggy python submission (verdict: Time Limit Exceeded):
N, Y = map(int,input().split())
x, y, z = -1, -1, -1
for i in range(N+1):
    for j in range(0,N-i+1):
        for k in range(0,N-i-j+1):
            if 10000*i + 5000*j + 1000*k == Y and i + j + k == N:
                x, y, z = i, j, k
                break
print(x,y,z)                


Fixed submission:
N, Y = map(int,input().split())
x, y, z = -1, -1, -1
k = 0
for i in range(N+1):
    for j in range(0,N-i+1):
        k = N - i - j
        if 10000*i + 5000*j + 1000*k == Y and 0 <= k <= 2000:
            x, y, z = i, j, k
            break
print(x, y, z)
Buggy python submission (verdict: Runtime Error):
a = int(input())
print(2*a*pi)

Fixed submission:
a = int(input())
print(2*a*3.14)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = str(input())
 
if (a/2)%2==1:
  print('No')
elif: b[0:int(a/2)]==b[int(a/2):]:
    print('Yes')
else:
  print('No')

Fixed submission:
a = int(input())
b = str(input())
 
if (a%2)==1:
  print('No')
elif b[0:int(a/2)]==b[int(a/2):]:
    print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = str(input())

if (a/2)%2==1:
  print('No')
elif:
  if b[0:int(a/2)]==b[int(a/2):]:
    print('Yes')
  else:
    print('No')

Fixed submission:
a = int(input())
b = str(input())
 
if (a%2)==1:
  print('No')
elif b[0:int(a/2)]==b[int(a/2):]:
    print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a = input()

print(a+pow(a,2)+pow(a,3))


Fixed submission:

a = int(input())

print(a+pow(a,2)+pow(a,3))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in a:
    ans *= i
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)


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

if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 1000000000000000000:
            print(-1)
            exit()
    if ans > 1000000000000000000:
        print(-1)
    else:
        print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  ans+=a[i]*sum(a)
s=0
for i in range(n):
  s+=a[i]*a[i]

ans=(ans-s)//2
ans=ans%(10**9+7)



print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
t=sum(a)
s=0
for i in range(n):
  s+=a[i]*a[i]

ans=(t*t-s)//2
ans=ans%(10**9+7)



print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  for j in range(i+1,n):
    ans+=((a[i]*a[j])%(10**9+7))
ans=ans%(10**9+7)

print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
t=sum(a)
s=0
for i in range(n):
  s+=a[i]*a[i]

ans=(t*t-s)//2
ans=ans%(10**9+7)



print(ans)
Buggy python submission (verdict: Runtime Error):
N,X,T=map(int,input().split())
if N%X=0:
  print((N/X)*T)
else:
  print((N//X+1)*T)

Fixed submission:
N,X,T=map(int,input().split())
if N%X==0:
  print((N//X)*T)
else:
  print((N//X+1)*T)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
 
l.sort()
ans = 0
 
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k] :
                    ans += 1
 
print(ans)

Fixed submission:
ss=str(input())
a=int(ss.count("R"))

if ss=="RSR":
  a=1

print(a)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[j]+l[i]>l[k]:
         ans+=1

print(ans)

Fixed submission:
ss=str(input())
a=int(ss.count("R"))

if ss=="RSR":
  a=1

print(a)

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[j]+l[i]>l[k]:
        ans+=1

print(ans)

Fixed submission:
ss=str(input())
a=int(ss.count("R"))

if ss=="RSR":
  a=1

print(a)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[j]+l[i]>l[k]:
        ans+=1

print(ans)

Fixed submission:
ss=str(input())
a=int(ss.count("R"))

if ss=="RSR":
  a=1

print(a)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(k+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[i]+l[j]>l[k]:
        ans+=1

print(ans)

Fixed submission:
ss=str(input())
a=int(ss.count("R"))

if ss=="RSR":
  a=1

print(a)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(k+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[i]+l[j]>l[k];
        ans+=1

print(ans)

Fixed submission:
n=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if L[i]!=L[j]!=L[k]:
        if L[j]+L[i]>L[k]:
         ans+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x,k,d=map(int,input().split())
for i in range(k):
  if abs(x+d)>=abs(x-d):
    x-=d
  else:
    x+=d

print(abs(x))

Fixed submission:
x,k,d=map(int,input().split())
x=abs(x)
if k*d<=x:
  print(x-d*k)
elif (k-x//d)%2==0:
  print(x%d)
else:
  print(d-x%d)
Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
cnt=0
for i in range(n):
  x,y=map(int,input().split())
  if x*x+y*y<=d*d:
    cnt+=1
  else:
    continue
print(cnt)


Fixed submission:
x=int(input())
if x>=30:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
cnt=0
for i in range(n):
  x,y=map(int,input().split())
  if x*x+y+y<=d*d:
    cnt+=1
  else:
    continue
print(cnt)


Fixed submission:
x=int(input())
if x>=30:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
cnt=0
for i in range(n):
  x,y=map(int,input().split())
  if x*x+y+y<=d*2:
    cnt+=1
  else:
    continue
print(cnt)


Fixed submission:
x=int(input())
if x>=30:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
 
# Aに0が含まれていたら、積も0とする
# Aに0が含まれていなければ、順に積を取り、10^18を超えたら終了する
ans = 0
if 0 not in A:
  ans = 1
  for a in A:
    ans *= a
    if ans > 10**18:
      ans = '-1'
      break
 
print(ans)

Fixed submission:
a,b=map(int,input().split())
print(a*b)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split())

ans=0
if 0 not in A:
  ans=1
  for a in A:
    ans*=a
    if ans>10**18:
      ans='-1'
      break

print(ans)

Fixed submission:
a,b=map(int,input().split())
print(a*b)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
 
if 0 in A:
    print(0)
    exit(0)
    
ans = 1 
for i in A:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit(0)
        
print(ans)

Fixed submission:
a,b=map(int,input().split())
print(a*b)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split())
if 0 in A:
  print(0)
  exit(0)

ans=1
for i in A:
  ans*=i
  if ans>10**18:
    print(-1)
    exit(0)

print(ans)


Fixed submission:
a,b=map(int,input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
=int(input())
A=list(map(int,input().split()))
x=1
flag=0
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    flag=1
    exit()
  else:
    continue

if flag==0:
  print(x)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
x=1
flag=1
for i in range(n):
  if A[i]==0:
    print(0)
    exit()
  else:
    x*=A[i]

if x>10**18:
  flag=0
  

if flag==1:
  print(x)
else:
  print("-1")

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=list(map(int,input().split()))
x=1
flag=1
for i in range(n):
  x*=A[i]

if x>10**18:
  flag=0
  

if flag==1:
  print(x)
else:
  print("-1")

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

print(x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split())
ans=1
for i in A:
  ans*=i
  if ans>10**18:
   print(-1)
   exit()

print(ans)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

print(x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split())
ans=1
for i in A:
  ans*=i
  if ans>10**18:
  print(-1)
  exit()

print(ans)


Fixed submission:
n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

print(x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split())
a=1
for i in range(n):
  a*=A[i]
  if a>10**18
  print(-1)
  exit()

print(a)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

print(x)

Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=1
for i in range(n):
  x=int(input())
  ans*=x

if ans<=10**18:
  print(ans)
else:
  print(-1)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
x=1
A.sort()
if 0 in A:
  print(0)
  exit()

for i in range(n):
  x*=A[n-i-1]
  if x>10**18:
    print(-1)
    exit()
  else:
    continue

print(x)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(int(a*b))

Fixed submission:
a,b=map(str,input().split())
import math
a=int(a)
B=int(b[0]+b[2]+b[3])
print(int(a*B//100))
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
num = []

for i in range(k):
  d = int(input())
  num += list(map(int, input().split()))

Q = list(set(num))
print(n-len(Q))


Fixed submission:
S=input()
if S=="ABC":
  print("ARC")
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
num=[]

for i in range(k):
  d=int(input())
  num+=list(map(int,input().split()))

Q=list( set (num))
print(n-len(Q))

Fixed submission:
S=input()
if S=="ABC":
  print("ARC")
else:
  print("ABC")

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
num=[]

for i in range(k):
  d=int(input())
  num+=list(map(int,input().split()))

Q=list(set(num))
print(n-len(Q))


Fixed submission:
S=input()
if S=="ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d=map(int,input().split())
while True:
  c-=b
  if c<=0:
    print('Yes')
  a-=d
  if a<=0:
    print('No')

Fixed submission:
a,b,c,d=map(int,input().split())
while True:
  c-=b
  if c<=0:
    print('Yes')
    break
  a-=d
  if a<=0:
    print('No')
    break
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  print(a.count(i+1))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
buka=[0]*n
for i in a:
  buka[i-1]+=1

for b in buka:
  print(b)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
i=1
while True:
  if n-i*k<=0:
    m=min((i*k-n),(n-(i-1)*k))
    print(m)
    break
  i+=1

Fixed submission:
n,k=map(int,input().split())
s=n//k
m=min((n-s*k),((s+1)*k-n))
print(m)
Buggy python submission (verdict: Runtime Error):
s=list[input()]
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")

Fixed submission:
s=list(input())
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s=input()
if a[0]==a[1]==a[2]:
  print("No")
else:
  print("Yes")

Fixed submission:
a=list(input())
if a[0]==a[1]==a[2]:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
s=list(input())
if s="AAA" or "BBB":
  print("No")
else:
  print("Yes")


Fixed submission:
a=list(input())
if a[0]==a[1]==a[2]:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
ans=0
while n>k:
  n//=k
  ans+=1

print(ans+1)

Fixed submission:
n,r=map(int,input().split())
if n>=10:
  print(r)
else:
  print(r+100*(10-n))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
flag=0
for i in range(n):
  if a.count(a[i])!=1:
    flag=1
if flag==0:
  print("YES")
else:
  print("NO")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
m=len(a)
a=set(a)
n=len(a)
if m==n:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
s,t=str(input())
a=t+s
print(a)

Fixed submission:
s,t=map(str,input().split())
a=t+s
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
  if a!=0:
    a-=1
  elif b!=0:
    b-=1
  else:
    break
print(a,b)

Fixed submission:
a,b,k=map(int,input().split())
if a>=k:
  print(a-k,b)
elif a+b>=k:
  print(0,a+b-k)
else:
  print(0,0)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
  if a!=0:
    a-=1
  elif b!=0:
    b-=1
  else:
    continue
print(a,b)

Fixed submission:
a,b,k=map(int,input().split())
if a>=k:
  print(a-k,b)
elif a+b>=k:
  print(0,a+b-k)
else:
  print(0,0)
Buggy python submission (verdict: Runtime Error):
A=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
n=int(input())
s=str(input())
x=n%26
for i in range(len(A)):
  for j in range(25):
    if s[i]==A[j]:
      if j+x<=25:
        s[i]=A[j+x]
        break
      else:
        s[i]=A[j+x-26]
        break

print(s)

Fixed submission:
A=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
n=int(input())
s=str(input())
t=""
for i in range(len(s)):
  for j in range(26):
    if s[i]==A[j]:
      if j+n<=25:
        t+=A[j+n]
        break
      else:
        t+=A[j+n-26]
        break

print(t)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
  x=a[i]
  b[x-1]=i+1
c=" ".join(b)
print(c)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
  x=a[i]
  b[x-1]=i+1

print(*b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
 
ans = sum(B)
for i in range(len(A)-1):
    if A[i] + 1 == A[i+1]:
        ans += C[A[i]-1]
 
print(ans)

Fixed submission:
n=int(input())
print(n**3)

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
d=sum(B)
for i in range(n-1):
  if A[i+1]-A[i]==1:
    d+=C[A[i]-1]
print(d)

Fixed submission:
n=int(input())
print(n**3)

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
d=sum(B)
for i in range(n-1):
  if A[i+1]-A[i]==1:
    d+=B[A[i]-1]
print(d)

Fixed submission:
n=int(input())
print(n**3)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
d=sum(B)
for i in range(n-1):
  if A[i+1]-A[i]==1:
    d+=B[A[i-1]]
print(d)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
d=sum(B)
for i in range(n-1):
  if A[i+1]-A[i]==1:
    d+=C[A[i]-1]
print(d)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
s=0
for i in range(n):
  s+=1/A[i]
print(1/s)
  

Fixed submission:
a=int(input())
s=input()
if a>=3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
c=0
m=100000
for i in range(1,n+1):
  c+=l+i-1
  m=min(m,abs(l+i-1))
if l<0 and a-n<=0:
  print(c+d)
else:
  print(c-d)

Fixed submission:
n,l=map(int,input().split())
c=0
m=100000
for i in range(1,n+1):
  c+=l+i-1
  m=min(m,abs(l+i-1))
if l<0 and l-n<=0:
  print(c+m)
else:
  print(c-m)
Buggy python submission (verdict: Runtime Error):
r,d,x=map(int,input().split())

for i inrange(1,11):
  x=r*x-d
  print(x)

Fixed submission:
r,d,x=map(int,input().split())

for i in range(1,11):
  x=r*x-d
  print(x)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=str(input())
if s[k-1]=="A":
  s[k-1]=="a"
elif s[k-1]=="B":
  s[k-1]=="b"
else:
  s[k-1]="c"
print(s)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print(''.join(s))
Buggy python submission (verdict: Runtime Error):
n=int(input())
H=list(map(int,input()))
ans=0
m=-1000
for i in range(n):
  if m<=H[i]:
    m=H[i]
    ans+=1
print(ans)


Fixed submission:
n=int(input())
H=list(map(int,input().split()))
ans=0
m=-1000
for i in range(n):
  if m<=H[i]:
    m=H[i]
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
p=[]
for i in range(a):
  if a%i==0 and b%i==0:
    p.append(i)

n=len(p)
print(p[n-k])

Fixed submission:
a,b,k=map(int,input().split())
p=[]
for i in range(1,a+1):
  if a%i==0 and b%i==0:
    p.append(i)

n=len(p)
print(p[n-k])
Buggy python submission (verdict: Runtime Error):
n=int(input())
sum=0
for j in range(n):
  i,c=input().split()
  if c=="BTC":
    sum+=float(i)*380000
  else:
    sum+=int(i)
print(sum)

Fixed submission:
s=input()
if s<="2019/04/30":
  print("Heisei")
else:
  print("TBD")
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
  x,u=map(str,input().split())
  x=int(x)
  if u=="BTC":
    x*=380000
  ans+=x
print(ans)

Fixed submission:
n=int(input())
sum=0
for j in range(n):
  i,c=input().split()
  if c=="BTC":
    sum+=float(i)*380000
  else:
    sum+=int(i)
print(sum)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
foods=[0]*M

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

cnt=0
for j in foods:
  if j==N:
    cnt+=1

print(cnt)

Fixed submission:
N,M = map(int,input().split())
foods = [0]*M
 
for i in range(N):
  KA = list(map(int,input().split()))
  
  for a in KA[1:]:
    foods[a-1] += 1
  
cnt = 0
for j in foods:
  if j == N:
    cnt += 1
    
print(cnt)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
foods=[0]*M

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

cnt=0
for j in foods:
  if j==N:
    cnt+=1

print(cnt)



Fixed submission:
N,M = map(int,input().split())
foods = [0]*M
 
for i in range(N):
  KA = list(map(int,input().split()))
  
  for a in KA[1:]:
    foods[a-1] += 1
  
cnt = 0
for j in foods:
  if j == N:
    cnt += 1
    
print(cnt)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
foods=[0]*M

for i in range(N):
  KA=list(map(int,input().split())


  for a in KA[1:]:
    foods[a-1]+=1

cnt=0
for j in foods:
  if j==N:
    cnt+=1

print(cnt)


Fixed submission:
N,M = map(int,input().split())
foods = [0]*M
 
for i in range(N):
  KA = list(map(int,input().split()))
  
  for a in KA[1:]:
    foods[a-1] += 1
  
cnt = 0
for j in foods:
  if j == N:
    cnt += 1
    
print(cnt)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
foods=[0]*M

for i in range(N):
  KA=list(map(int,input().split())


for a in KA[1:]:
  foods[a-1]+=1

cnt=0
for j in foods:
  if j==N:
    cnt+=1

print(cnt)


Fixed submission:
N,M = map(int,input().split())
foods = [0]*M
 
for i in range(N):
  KA = list(map(int,input().split()))
  
  for a in KA[1:]:
    foods[a-1] += 1
  
cnt = 0
for j in foods:
  if j == N:
    cnt += 1
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  p=int(input())
  a.append(p)

a.sort()
s=p[n-1]//2
print(sum(a)-s)

Fixed submission:
n=int(input())
a=[]
for i in range(n):
  p=int(input())
  a.append(p)

a.sort()
s=a[n-1]//2
print(sum(a)-s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
alist  = list(map(int,input().split()))
list1 = alist[1::2]
list2 = alist[0::2]
from collections import Counter
dic1 = Counter(list1).most_common()
dic2 = Counter(list2).most_common()

if dic1[0][0]!=dic2[0][0]:
  print(n - dic1[0][1] - dic2[0][1]+1)
else:
  print(min(n - dic1[0][1] - dic2[1][1]+1, n -dic1[1][1] - dic2[0][1]+1))

Fixed submission:
a=input()
print(a.replace("1","x").replace("9","1").replace("x","9"))

Buggy python submission (verdict: Runtime Error):
a=input()
print(a,replace("1","x").replace("9","1").replace("x","9"))

Fixed submission:
a=input()
print(a.replace("1","x").replace("9","1").replace("x","9"))
Buggy python submission (verdict: Runtime Error):
n = int(input())
alist  = list(map(int,input().split()))
list1 = alist[1::2]
list2 = alist[0::2]
from collections import Counter
dic1 = Counter(list1).most_common()
dic2 = Counter(list2).most_common()

if dic1[0][0]!=dic2[0][0]:
  print(n - dic1[0][1] - dic2[0][1]+1)
else:
  print(min(n - dic1[0][1] - dic2[1][1]+1, n -dic1[1][1] - dic2[0][1]+1))

Fixed submission:
n = int(input())
alist  = list(map(int,input().split()))
list1 = alist[1::2]
list2 = alist[0::2]
from collections import Counter
dic1 = Counter(list1).most_common()
dic2 = Counter(list2).most_common()
dic1.append([0,0])
dic2.append([0,0])
if dic1[0][0]!=dic2[0][0]:
  print(n - dic1[0][1] - dic2[0][1])
else:
  print(min(n - dic1[0][1] - dic2[1][1], n -dic1[1][1] - dic2[0][1]))