Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03599 (python)

Fixed submission:
A,B,C,D,E,F = (int(T) for T in input().split())
SugM = 0
WatM = 100*A
for TA in range(0,(F//100)+1):
    for TB in range(0,(F//100)+1):
        if TA==TB==0:
            continue
        else:
            Water = TA*100*A+TB*100*B
            RestW = F-Water
            if RestW>=0:
                for TC in range(0,RestW+1):
                    for TD in range(0,RestW+1):
                        Suger = TC*C+TD*D
                        RestS = RestW-Suger
                        if RestS>=0 and Water>=(100*Suger)/E:
                            if Suger/(Suger+Water)>SugM/(SugM+WatM):
                                SugM = Suger
                                WatM = Water
                        else:
                            break
            else:
                break
print('{} {}'.format(WatM+SugM,SugM))

Buggy submission (verdict: Runtime Error):
from math import gcd
A,B,C,D,E,F = (int(T) for T in input().split())
SugerMax = 0
for TC in range(0,D//gcd(C,D)):
    RestC = F-C*TC
    for TD in range(0,(RestC//D)+1):
        RestD = RestC-D*TD
        Suger = C*TC+D*TD
        if RestD>=0:
            NeedMin = (100*Suger)/E
            for TA in range(0,B//gcd(A,B)):
                for TB in range(0,(F//100)+1):
                    Water = A*TA*100+B*TB*100
                    if Water<=RestD:
                        if NeedMin<=Water and SugerMax<Suger:
                            SugerMax = Suger
                            WaterMax = Water
                    else:
                        break
        else:
            break
print('{} {}'.format(WaterMax+SugerMax,SugerMax))
Problem p03625 (python)

Fixed submission:
import collections
N = int(input())
A = sorted(collections.Counter(int(T) for T in input().split()).most_common(),reverse=True)
Flag = False
LS = 0
SS = 0
for T in range(0,len(A)):
    if LS==0 and A[T][1]>=4:
        Sq = A[T][0]**2
        Flag = True
        break
    if A[T][1]>=2:
        if LS==0:
            LS = A[T][0]
        else:
            SS = A[T][0]
            Sq = LS*SS
            Flag = True
            break
if Flag:
    print(Sq)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
Flag = False
LS = 0
SS = 0
for T in range(0,len(A)):
    if LS==0 and A[T][1]>=4:
        Sq = A[T][0]**2
        Flag = True
        break
    if A[T][1]>=2:
        if LS==0:
            LS = A[T][0]
        else:
            SS = A[T][0]
            Sq = LS*SS
            Flag = True
            break
if Flag:
    print(Sq)
else:
    print(0)
Problem p03943 (python)

Fixed submission:
a,b,c = (int(T) for T in input().split())
print(['No','Yes'][(a+b)==c or (b+c)==a or (c+a)==b])

Buggy submission (verdict: Runtime Error):
a,b,c = (int(T) for T in input().split())
print(['No','Yes'][(a+ab)==c or (b+c)==a or (c+a)==b])
Problem p03999 (python)

Fixed submission:
from itertools import product
S = input()
if len(S)==1:
    print(int(S))
else:
    Sum = 0
    for TR in product([0,1],repeat=(len(S)-1)):
        Op = ['+' if TO==1 else '' for TO in TR]+['']
        Sum += eval(''.join([TS+TO for TS,TO in zip(S,Op)]))
    print(Sum)

Buggy submission (verdict: Runtime Error):
from itertools import product
S = input()
if len(S)==1:
    print(int(S))
else:
    Sum = 0
    for TR in product([0,1],repeat=(len(S)-1)):
        Op = ['+' if TO==1 else '' for TO in TR]+['']
        Sum += eval(''.join([TS+TO for TS,TO in zip(S,Op)]))
print(Sum)
Problem p02573 (python)

Fixed submission:
import collections
n,m=map(int,input().split())
par=[i for i in range(n+1)]
def find(x):
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
for _ in range(m):
    a,b=map(int,input().split())
    A=find(a)
    B=find(b)
    par[max(A,B)]=par[min(A,B)]
l=[]
for i in range(1,n+1):
    l.append(find(i))
l=collections.Counter(l)
print(max(l.values()))

Buggy submission (verdict: Runtime Error):
import collections
n,m=map(int,input().split())
par=[i for i in range(n+1)]
def find(x):
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
for _ in range(m):
    a,b=map(int,input().split())
    A=find(a)
    B=find(b)
    par[max(A,B)]=par[min(A,B)]
l=[]
for i in range(1,n+1):
    l.append(find(i))
l=collections.Counter(l)
print(max(l.values()))

Buggy submission (verdict: Runtime Error):
import collections
n,m=map(int,input().split())
par=[i for i in range(n+1)]
def find(x):
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
for _ in range(m):
    a,b=map(int,input().split())
    A=find(a)
    B=find(b)
    par[max(A,B)]=par[min(A,B)]
l=[]
for i in range(1,n+1):
    l.append(find(i))
l=collections.Counter(l)
print(max(l.values()))
Problem p02601 (python)

Fixed submission:
a,b,c=map(int,input().split())
k=int(input())
if a<b:
    if b<c:
        print('Yes')
    else:
        count=0
        while b>=c:
            c*=2
            count+=1
        if count<=k:
            print('Yes')
        else:
            print('No')
else:
    count=0
    while a>=b:
        b*=2
        count+=1
    while b>=c:
        c*=2
        count+=1
    if count<=k:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().slit())
k=int(input())
if a<b:
    if b<c:
        print('Yes')
    else:
        count=0
        while b>=c:
            b*=2
            count+=1
        if count<=k:
            print('Yes')
        else:
            print('No')
else:
    count=0
    while a>=b:
        b*=2
        count+=1
    while b>=c:
        c*=2
        count+=1
    if count<=k:
        print('Yes')
    else:
        print('No')
Problem p02642 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
counter=[0]*(10**6+1)
l=sorted(l)
for i in l:
    counter[i]+=1
    if counter[i]<2:
        for j in range(2*i,10**6+1,i):
            counter[j]+=2
print(counter.count(1))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
count=n
l=sorted(l)
newl=[]
for i  in l:
    flag=True
    for j in newl:
        if i%j==0:
            flag=False
            count-=1
            break
    if flag==True:
        newl.append(i)
if l[0]==l[1]:
        count-=1
print(count)
Problem p02658 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
num=1
if l.count(0)!=0:
    print(0)
else:
    flag=True
    for i in l:
        if num>10**18:
            print(-1)
            flag=False
            break
        else:
            num*=i
    if flag==True:
        if num>10**18:
            print(-1)
        else:
            print(num)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
if l.count(0)!=0:
  print(0)
else:
  num=1
  for i in l:
    if num>10**18:
      break
    else:
      num*=i
if num>=10**18:
  print(-1)
else:
  print(num)
Problem p02678 (python)

Fixed submission:
n,m=map(int,input().split())
route=[[] for _ in range(n+1)]
for _ in range(m):
    a,b=map(int,input().split())
    route[a].append(b)
    route[b].append(a)
from collections import deque
q=deque()
q.append(1)
sigh=[0]*(n+1)
depth=[0]*(n+1)
depth[1]=0
while q:
    a=q.popleft()
    for i in route[a]:
        if depth[i]==0 or depth[i]>depth[a]+1:
            if i!=1:
                depth[i]=depth[a]+1
                q.append(i)
                sigh[i]=a
print('Yes')
for i in range(2,n+1):
    print(sigh[i])

Buggy submission (verdict: Runtime Error):
import queue
n,m=map(int,input().split())
A=[]
B=[]
c=[0]*(n+1)
for _ in range(m):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
q=queue.Queue()
q.put(1)
count=n-1
while not q.empty() and count>0:
    aa=q.get()
    for i in range(m):
        print(aa)
        print(c)
        if A[i]==aa:
            if c[B[i]]==0:
                c[B[i]]=aa
                count-=1
                q.put(B[i])
                B[i]=-1
        elif B[i]==aa:
            if c[A[i]]==0:
                c[A[i]]=aa
                count-=1
                q.put(A[i])
                A[i]=-1
print('Yes')
for i in range(2,n+1):
    print(c[i])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
c=[0]*(n+1)
l=[1]
count=n
while count>0:
    for _ in range(m):
        a,b=map(int,input().split())
        if l.count(a)!=0 and l.count(b)==0:
            l.append(b)
            c[b]==a
            count-=1
        elif l.count(b)!=0 and l.count(a)==0:
            l.append(a)
            c[a]==b
            count-=1
print('Yes')
for i in range(1,n+1):
    print(c[i])
Problem p02714 (python)

Fixed submission:
n=int(input())
l=input()
a=l.count('R')
b=l.count('G')
c=l.count('B')
d=a*b*c
i=0
count=0
lis=list(l)
while i<=n-3:
    j=i+1
    while i+2*(j-i)<=n-1:
        if lis[i]!=lis[j] and lis[j]!=lis[i+2*(j-i)] and lis[i]!=lis[i+2*(j-i)]:
            count+=1
            j+=1
        else:
            j+=1
    i+=1
print(d-count)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(str,input()))
i=0
while 0<=i and i<=n-3:
    
    if l[i]=='R':
        j=i+1
        while i+1<=j and j<=n-2:
            if l[j]=='R':
                j+=1
            else:
                k=j+1
                while j+1<=k and k<=n-1 and k-j!=j-i:
                    if l[k]!=l[j]:
                        count+=1
                        k+=1
                    else:
                        k+=1
                j+=1
        i+=1
    if l[i]=='G':
        j=i+1
        while i+1<=j and j<=n-2:
            if l[j]=='G':
                j+=1
            else:
                k=j+1
                while j+1<=k and k<=n-1 and k-j!=j-i:
                    if l[k]!=l[j]:
                        count+=1
                        k+=1
                    else:
                        k+=1
                j+=1
        i+=1
    if l[i]=='B':
        j=i+1
        while i+1<=j and j<=n-2:
            if l[j]=='B':
                j+=1
            else:
                k=j+1
                while j+1<=k and k<=n-1 and k-j!=j-i:
                    if l[k]!=l[j]:
                        count+=1
                        k+=1
                    else:
                        k+=1
                j+=1
        i+=1
print(count)

Buggy submission (verdict: Runtime Error):
count=0

n=int(input())
l=list(map(str,input()))
for i in range(n-3):
    if list[0]=='R':
        j=i+1
        while i+1<=j and j<=n-1:
            if l[j]=='R':
                j+=1
            else:
                k=j+1
                while j+1<=k and k<=n and k-j!=j-i:
                    if l[k]!=l[j]:
                        count+=1
                    else:
                        k+=1
                j+=1
            i+=1
    if list[0]=='G':
        j=i+1
        while i+1<=j and j<=n-1:
            if l[j]=='G':
                j+=1
            else:
                k+=1
                while j+1<=k and k<=n and k-j!=j-i:
                    if l[k]!=l[j]:
                        count+=1
                    else:
                        k+=1
                j+=1
            i+=1    
    if list[0]=='B':
        j+=1
        while i+1<=j and j<=n-1:
            if l[j]=='B':
                j+=1
            else:
                k+=1
                while j+1<=k and k<=n and k-j!=j-i:
                    if l[k]!=l[j]:
                        count+=1
                    else:
                        k+=1
                j+=1
            i+=1
print(count)
Problem p02741 (python)

Fixed submission:
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(l[k-1])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if 4*a*b<(c-a-b)**2 and c-a-b>=0:
    print('Yes')
else:
    print('No')
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
l=[0]*(n+1)
miss=[0]*(n+1)
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if l[p]==0:
        if s=='AC':
            l[p]+=1
        else:
            miss[p]+=1
for i in range(1,n+1):
    if l[i]==0 and miss[i]!=0:
        miss[i]=0
a=l.count(1)
b=sum(miss)
print(a,b)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[0]*(n+1)
miss=[0]*(n+1)
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if l[p]==0:
        if s=='AC':
            l[p]+=1
        else:
            miss[p]+=1
for i in range(m):
    if l[i]==0 and miss[i]!=0:
        miss[i]=0
a=l.count(1)
b=sum(miss)
print(a,b)
Problem p02854 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
count=0
suml=sum(l)
i=0
while count<suml/2:
    count+=l[i]
    i+=1
k=suml/2
a=l[i-1]
if count==k:
    print(0)
else:
    print(int(2*(min(count-k,a-count+k))))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
count=0
suml=sum(l)
i=0
while count<suml/2:
    count+=l[i]
    i+=1
k=suml/2
a=l[i]
if count==k:
    print(0)
else:
    print(int(2*(min(count-k,a-count+k))))
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
length=0
i=0
while length<=x and i<=n-1:
    length+=l[i]
    i+=1
if length<=x:
    print(n+1)
else:
    print(i)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
length=0
i=0
while length<=x:
    length+=l[i]
    i+=1
print(i)
Problem p03086 (python)

Fixed submission:
s=list(map(str,input()))
l=[[]]
count=0
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        l[count].append(i)
    else:
        count+=1
        l.append([])
maxl=0
for j in l:
    if len(j)>maxl:
        maxl=len(j)
print(maxl)

Buggy submission (verdict: Runtime Error):
n=int(input())
count=0
for i in range(1,n+1):
    if i%2==1:
        yakusuu=0
        for j in range(1,int((i**0.5)//1)+1):
            if i%j==0:
                if j**2==i:
                    yakusuu+=1
                else:
                    yakusuu+=2
        if yakusuu==8:
            count+=1
print(count)
Problem p03487 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
count=0
lcount=[0]*(10**5+1)
for i in l:
    if i>10**5:
        count+=1
    else:
        lcount[i]+=1
        if lcount[i]>i:
            count+=1
for j in l:
    if j<=10**5 and lcount[j]<j:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
lcount=[0]*10**9
count=0
for i in l:
    lcount[i]+=1
    if lcount[i]>i:
        count+=1
for j in l:
    if lcount[j]<j:
        count+=1
print(count)
Problem p03827 (python)

Fixed submission:
n=int(input())
l=list(map(str,input()))
count=0
lis=[0]
for i in range(n):
    if  l[i]=='D':
        lis.append(count-1)
        count-=1
    else:
        lis.append(count+1)
        count+=1
print(max(lis))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(str,input().split()))
lis=[0]
count=0
for i in range(n):
  if l[i]='D':
    lis.append(count-1)
    count-=1
  else:
    lis.append(count+1)
    count+=1
print(max(lis))
Problem p03910 (python)

Fixed submission:
n=int(input())
i=1
num=0
suml=[0]
while num<=10**7+1000:
    num+=i
    suml.append(num)
    i+=1

j=1
while n>suml[j]:
    j+=1
k=suml[j]-n
for ii in range(1,j+1):
    if ii!=k:
        print(ii)

Buggy submission (verdict: Runtime Error):
n=int(input())
i=1
num=0
suml=[0]
while num<=10**2:
    num+=i
    suml.append(num)
    i+=1

j=1
while n>suml[j]:
    j+=1
k=suml[j]-n
for ii in range(1,j+1):
    if ii!=k:
        print(ii)
Problem p02609 (python)

Fixed submission:
n=int(input())
x=input()
val=int(x,2)

cnt=x.count("1")
p_cnt=cnt+1
m_cnt=cnt-1
p_amari,m_amari=0,0

p_amari=val%(cnt+1)
if cnt-1!=0:
  m_amari=val%(cnt-1)
else:
  m_amari=0

for i in range(n):
  ans=0
  if x[i]=="0":
    amari=p_amari+pow(2,n-i-1,p_cnt)
    amari%=p_cnt
  elif x[i]=="1":
    if cnt-1==0:
      print(0)
      continue
    amari=m_amari-pow(2,n-i-1,m_cnt)
    amari%=m_cnt
  ans+=1
  while amari!=0:
    amari%=bin(amari).count("1")
    ans+=1
  print(ans)

Buggy submission (verdict: Runtime Error):
def divbin(s,res):
  if int(s,2)==0:
    v=res
    return v
  # ss=int(s)
  val=int(s,2)
  count=bin(val).count("1")
  val%=count
  # t_str=bin(str(count))
  t_str=bin(val)
  t_str=t_str.replace("0b","")
  res+=1
  return divbin(t_str,res)

from copy import deepcopy
n=int(input())
x=input()

# c=str(bin(n))
# c=c.replace("0b","")
s=x
vv=int(s,2)
p=int(x)
cnt=bin(p).count("1")
x=list(x)
# print(cnt)
for i in range(len(x)):
  tmp=cnt
  ts=""
  vv-=2**(i-1)
  if x[i]=="1":
    vv-=2**(i-1)
  else:
    vv+=2**(i-1)
  # ans=0
  # global ans
  ts=bin(vv)
  ts=ts.replace("0b","")
  ans=0
  ans=divbin(ts,ans)
  print(ans)

Buggy submission (verdict: Runtime Error):
def divbin(s,res):
  if int(s,2)==0:
    v=res
    return v
  # ss=int(s)
  val=int(s,2)
  count=bin(val).count("1")
  val%=count
  # t_str=bin(str(count))
  t_str=bin(val)
  t_str=t_str.replace("0b","")
  res+=1
  return divbin(t_str,res)

from copy import deepcopy
n=int(input())
x=input()

# c=str(bin(n))
# c=c.replace("0b","")
s=x
vv=int(s,2)
p=int(x)
cnt=bin(p).count("1")
x=list(x)
# print(cnt)
for i in range(len(x)):
  tmp=cnt
  ts=""
  vv-=2**(i-1)
  if x[i]=="1":
    vv-=2**(i-1)
  else:
    vv+=2**(i-1)
  # ans=0
  # global ans
  ts=bin(vv)
  ts=ts.replace("0b","")
  ans=0
  ans=divbin(ts,ans)
  print(ans)
Problem p02642 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
from collections import Counter
c=Counter(a)
f=[1]*(10**6+1)
ans=0
for ai in a:  
  if c[ai]==1 and f[ai]==1:ans+=1
  if f[ai]==1:
    for i in range(ai,10**6+1,ai):
      f[i]=0
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
f=[1]*(2*10**5+10)
from collections import Counter
c=Counter(a)
ans=0
for ai in a:
  if c[ai]==1 and f[ai]==1:ans+=1
  for i in range(ai,2*10**5,ai):
    f[i]=0
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
f=[1]*(2*10**5+1)
from collections import Counter
c=Counter(a)
ans=0
for ai in a:
  if c[ai]==1 and f[ai]==1:ans+=1
  for i in range(ai,2*10**5,ai):
    f[i]=0
print(ans)
Problem p02684 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[]
o=(n+1)*[-1]
cycle,l=1,0
v=1
while o[v]==-1:
  o[v]=len(visited)
  visited.append(v)
  v=a[v-1]
cycle=len(visited)-o[v]
l=o[v]
if k<l:
  print(visited[k])
else:
  k-=l
  k%=cycle
  print(visited[l+k])

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

d = 60
dp = [[-1]*N for _ in range(d+1)]
for i in range(n):
    dp[0][i] = a[i]-1

for i in range(d):
    for j in range(n):
        dp[i+1] = dp[i][dp[i][j]]

ans = 0

for i in range(d):
    if K & (1<<i):
        ans = dp[i][ans]

print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
from collections import Counter
c=Counter()
c[1]+=1

cycle_num=-1
i=0
cnt=0
b=[]
while cnt<2*10**5+1:
  c[a[i]]+=1
  b.append(a[i])
  if c[a[i]]>1 or a[i]==1:
    cycle_num=a[i]
    break
  i=a[i]-1
  cnt+=1
# print(b)
# print(cycle_num)
cycle=[]
b=[1]+b
for i,bb in enumerate(b):
  if bb==cycle_num:
    cycle=b[i:]
    break
  else:
    if i!=0:
      k-=1
    if k==0:
      print(bb)
      exit(0)
# print(cycle)
# syuuki=len(cycle)-1
syuuki=len(cycle)
print(cycle[(k%syuuki)+1])
Problem p02761 (python)

Fixed submission:
# ABC 157 C
n,m=map(int,input().split())
C=[list(map(int,input().split())) for i in range(m)]

for i in range(1000):
    S=str(i)

    if len(S)==n:
        for s,c in C:
            s-=1
            if S[s]==str(c):
                True
            else:
                break
        else:
            print(i)
            exit()

print(-1)

Buggy submission (verdict: Runtime Error):
# ABC 157 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nms = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n,m=nm()
l=[0]*3
check=[0]*3
for i in range(m):
    s,c=map(int,input().split())
    s-=1
    if l[s]!=c:
        check[s]+=1
    l[s]=c
# print(l)
ans=''
if sum(l)==0:
    ans='0'
    if n==1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

for cc in check:
    if cc>1:
        print(-1)
        exit()

is_zero=True

for ll in l:
    if ll==0 and is_zero==True:
        continue
    else:
        is_zero=False
        ans+=str(ll)

# print(ans)
ans2=''
for i in range(n):
    ans2+=ans[i]
print(ans2)
Problem p02797 (python)

Fixed submission:
# C - Subarray Sum
n,k,s=map(int,input().split())
a=[]
a+=[s]*k
if s!=10**9:
    a+=[s+1]*(n-k)
else:
    a+=[1]*(n-k)
print(*a)

Buggy submission (verdict: Runtime Error):
# C - Subarray Sum
n,k,s=map(int,input().split())
a=k*s+(n-k)*(s+1)
print(*a)
Problem p02814 (python)

Fixed submission:
# ABC150 D
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from fractions import gcd
from math import ceil
def lcm(x, y):
    return (x * y) // gcd(x, y)
n,m=nm()
a=nl()
ans=0
a=[x//2 for x in a] 

lcm_v=a[0]
for i in range(n):
    lcm_v=lcm(lcm_v,a[i])
ok_flg=[(lcm_v//i)%2==1 for i in a]
if all(ok_flg):
    ans=((m//lcm_v)+1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd, ceil


def lcm(a, b):
    return (a*b)//gcd(a, b)


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

for i in range(n):
    a[i] = a[i]//2

lcm_v = a[0]
for i in range(1, n):
    lcm_v = lcm(lcm_v, a[i])

ok = True
for aa in a:
    if (lcm_v//aa) % 2 != 1:
        ok = False
        break

if ok:
    ans = ((m//lcm_v)+1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC150 D
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from fractions import gcd
from math import ceil
def lcm(x, y):
    return (x * y) // gcd(x, y)
n,m=nm()
a=nl()
ans=0
a=[x//2 for x in a] 

lcm_v=a[0]
for i in range(n):
    lcm_v=lcm(lcm_v,a[i])
ok_flg=[(lcm_v//i)%2==1 for i in a]
if all(ok_flg):
    ans=((m//lcm)+1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
# ABC150 D
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
from fractions import gcd
def lcm(x, y):
    """
    xとyの最小公倍数を求める。

    Parameters
    ----------
    x,y : int
        自然数

    Returns
    -------
        最小公倍数：int

    """
    return (x * y) // gcd(x, y)
n,m=nm()
a=nl()
b=[]
lc=[]

# for i in range(n):
#     b.append(a[i]//2)
# print(a)
for i in range(n):
    a[i]//=2
# print(a)
t=0
for i in range(n-1):
    if i==0:
        t=lcm(a[i],a[i+1])
        lc.append(t)
    elif i!=0:
        t=lcm(lc[i-1],a[i+1])
        # t=min(lc[i-1],t)
        lc.append(t)
# print(lc)
# print(max(a))
# ans=(m-max(a)//max(lc))//2
ans=0
ans=(m+max(a))//max(lc)
if ans%2==1:
    ans//=2
    ans+=1
else:
    ans//=2
print(ans)