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

Fixed submission:
import networkx as nx

N,M = map(int,input().split())
G = nx.Graph()
for i in range(M):
    A,B = map(int,input().split())
    G.add_edge(A,B)
print("Yes")
pre = nx.predecessor(G,1)
for i in range(2,N+1):
    print(pre[i][0])

Buggy submission (verdict: Runtime Error):
import networkx as nx

N,M = map(int,input().split())
G = nx.Graph()
for i in range(M):
    A,B = map(int,input().split())
    G.add_edge(A,B)
print("Yes")
pre = nx.predecessor(G,1)
for i in range(2,N+1):
    print(pre[i][0])
Problem p02720 (python)

Fixed submission:
from collections import deque

def make_lunlun():
    lst = []
    que = deque([1,2,3,4,5,6,7,8,9])
    for i in range(100000):
        str_num = str(que.popleft())
        str_one = str_num[-1]
        a = str(int(str_one) - 1)
        b = str(int(str_one) + 1)
        #minus = int(str_num + a)
        same = int(str_num + str_one)
        #plus = int(str_num + b)
        if 0 < int(str_one) < 9:
            minus = int(str_num + a)
            plus = int(str_num + b)
            que.extend([minus,same,plus])
            lst.extend([minus,same,plus])
        elif int(str_one) == 0:
            plus = int(str_num + b)
            que.extend([same,plus])
            lst.extend([same,plus])
        else:
            minus = int(str_num + a)
            que.extend([minus,same])
            lst.extend([minus,same])
    print(lst[K - 10])    

K = int(input())
if K <= 12:
    print(K)
else:
    make_lunlun()

Buggy submission (verdict: Runtime Error):
from collections import deque

def make_lunlun():
    lst = []
    que = deque([1,2,3,4,5,6,7,8,9])
    for i in range(10):
        str_num = str(que.popleft())
        str_one = str_num[-1]
        a = str(int(str_one) - 1)
        b = str(int(str_one) + 1)
        #minus = int(str_num + a)
        same = int(str_num + str_one)
        #plus = int(str_num + b)
        if 0 < int(str_one) < 9:
            minus = int(str_num + a)
            plus = int(str_num + b)
            que.extend([minus,same,plus])
            lst.extend([minus,same,plus])
        elif int(str_one) == 0:
            plus = int(str_num + b)
            que.extend([same,plus])
            lst.extend([same,plus])
        else:
            minus = int(str_num + a)
            que.extend([minus,same])
            lst.extend([minus,same])
    print(lst[K - 10])    

K = int(input())
if K <= 12:
    print(K)
else:
    make_lunlun()
Problem p02730 (python)

Fixed submission:
S = [c for c in input()]
N = len(S) - 1
s1 = S[:(N-1)//2 + 1]
s2 = S[(N+3)//2:]

rs = list(reversed(S))
rs1 = list(reversed(s1))
rs2 = list(reversed(s2))
if S == rs and s1 == rs1 and s2 == rs2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from scipy.misc import comb
N,M = map(int,input().split())
even = comb(N,2)
odd = comb(M,2)
print(int(even) + int(odd))

Buggy submission (verdict: Runtime Error):
from scipy.misc import comb
N,M = map(int,input().split())
even = int(comb(N,2))
odd = int(comb(M,2))
print(even + odd)
Problem p02780 (python)

Fixed submission:
n,k,*p=map(int,open(0).read().split())
l=[]
l.append(sum(p[:k]))
for i in range(k,n):
    l.append(l[-1]+p[i]-p[i-k])
ind=l.index(max(l))
ans=0
for i in range(k):
    ans += (1+p[ind+i])/2
print(ans)

Buggy submission (verdict: Runtime Error):
n,k,*p=map(int,open(0).read().split())
p.sort()
p.reverse()
l=p[:k]
_sum=0
before=l[0]
rate=1
for i in range(len(l)):
    s=0
    if i!=0:
        if l[i]==before:
            rate*=2
        else:
            before=l[i]
            rate=1
        for j in range(1,l[i]+1):
            s+=j
        _sum+=s/l[i]/rate    
    else:
        for j in range(1,l[i]+1):
            s+=j
        _sum+=s/l[i]
print(_sum)

Buggy submission (verdict: Runtime Error):
n,k,*p=map(int,open(0).read().split())
p.sort()
p.reverse()
l=p[:k]
print(l)
_sum=0
before=l[0]
rate=1
for i in range(len(l)):
    s=0
    if i!=0:
        if l[i]==before:
            rate*=2
        else:
            before=l[i]
            rate=1
        for j in range(1,l[i]+1):
            s+=j
        _sum+=s/l[i]/rate          
    else:
        for j in range(1,l[i]+1):
            s+=j
        _sum+=s/l[i]
print(_sum)
Problem p02885 (python)

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

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operator import add

n = int(input())
l1 = [int(i) for i in input().split()]
print(reduce(add, [l1[a]*l1[b] for a in range(n-1) for b in range(a+1,n)]))
Problem p02958 (python)

Fixed submission:
n=int(input())
lst=list(map(int,input().split()))
cnt=0
for i in range(n):
  if lst[i]!=i+1:
    cnt+=1
print("YES" if cnt<=2 else "NO")

Buggy submission (verdict: Runtime Error):
n=int(input())
lst=list(map(int,input().split()))
cnt=0
for i in range(5):
  if lst[i]!=i+1:
    cnt+=1
print("YES" if cnt<=2 else "NO")
Problem p02969 (python)

Fixed submission:
print(3*int(input())**2)

Buggy submission (verdict: Runtime Error):
print(3*(int(input())**2)
Problem p02983 (python)

Fixed submission:
L,R=map(int,input().split())
_min=2018
if L==0:
  _min=0
else:  
  for l in range(L,L+2019):
    if l>R:
      break
    for r in range(l+1,l+2020):
      if r>R:
        break
      m=(l*r)%2019
      if _min>m:
        _min=m
print(_min)

Buggy submission (verdict: Runtime Error):
import itertools
L,R=map(int,input().split())
c=list(itertools.combinations(range(L,R+1),2))
_min=2018
for i in c:
  a=(i[0]*i[1])%2019
  if a<_min:
    _min=a
print(_min)
Problem p03060 (python)

Fixed submission:
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dif=[]
for i in range(n):
  if v[i]>c[i]:
    dif.append(v[i]-c[i])
print(sum(dif))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operator import add
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
print(reduce(add,[v[i]-c[i] for i in range(n) if v[i]>c[i]]))
Problem p03061 (python)

Fixed submission:
import fractions
#from functools import reduce
N,*a=map(int,open(0).read().split())
L=[]
L_base=a[0]
b=a[:]
b.reverse()
R=[]
R_base=b[0]
for i in range(N-1):
    L_base=fractions.gcd(L_base,a[i])
    L.append(L_base)
    R_base=fractions.gcd(R_base,b[i])
    R.append(R_base)
LR=[R[-1]]
for i in range(N-2):
    LR.append(fractions.gcd(L[i],R[-2-i]))
LR.append(L[-1])
print(max(LR))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N,*a=map(int,open(0).read().split())
_max=0
for i in a:
    b=a[:]
    b.remove(i)
    _max=max(_max,reduce(math.gcd,b))
print(_max)
Problem p03076 (python)

Fixed submission:
just=[]
left=[]
for i in range(5):
  a=int(input())
  if a%10 == 0:
    just.append(a)
  else:
    left.append(a)
_sum = sum(just)    
_min=10
index=-1
for i in range(len(left)):
  i1=left[i]%10
  if _min > i1:
    _min = i1
    index = i
for i in range(len(left)):
  if i == index:
    _sum += left[i]
  else:
    b=left[i]%10
    _sum += left[i] + (10-b)
print(_sum)

Buggy submission (verdict: Runtime Error):
import math

lst = []
min_1 = "129"
for i in range(5):
    s = input()
    lst.append(s)
    if s[-1] != "0" and s[-1] <= min_1[-1]:
        min_1 = s
lst.remove(min_1)
a = list(map(lambda x:math.ceil(int(x)/10)*10,lst))
print(sum(a) + int(min_1))

Buggy submission (verdict: Runtime Error):
import math

lst = []
min_1 = "9"
for i in range(5):
    s = input()
    lst.append(s)
    if s[-1] != "0" and s[-1] < min_1[-1]:
        min_1 = s
lst.remove(min_1)
a = list(map(lambda x:math.ceil(int(x)/10)*10,lst))
print(sum(a) + int(min_1))
Problem p03086 (python)

Fixed submission:
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G" or s[i]==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0  
print(max(l) if len(l)>1 else l[0])

Buggy submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
    if i==(len(s)-1):
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0
print(max(l) if len(l)>1 else l[0])

Buggy submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0
print(max(l) if len(l)>1 else l[0])

Buggy submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
  else:
    l.append(cnt)
    cnt=0
print(max(l) if len(l)>1 else l[0])

Buggy submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
  else:
    l.append(cnt)
    cnt=0
print(max(l))

Buggy submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G":
    cnt+=1
  else:
    l.append(cnt)
    cnt=0
print(max(l))
Problem p03194 (python)

Fixed submission:
def hoge(p):
    ret = {}
    pp = 2
    while pp * pp <= p:
        while p % pp == 0:
            ret[pp] = ret[pp]+1 if pp in ret else 1
            p //= pp
        pp += 1
    if p != 1: ret[p] = 1
    return ret

N,P=map(int,input().split())
if N==1:
    print(P)
elif P==1:
    print(1)
else:
    ans = 1
    ret = hoge(P)
    for p,e in ret.items():
        ans *= max(1, p**(e//N))
    print(ans)

Buggy submission (verdict: Runtime Error):
N,P=map(int,input().split())
if N==1:
    print(P)
elif P==1:
    print(1)
else:
    ans=0
    for i in range(2,10**12+1):
        p=pow(i,N)
        if p<=P and P%p==0:
            ans=i
        elif p>P:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
        
N,P = map(int,input().split())
d = sympy.factorint(P)
ans=1
a=1
for k,v in d.items():
    a = k*(v//N)
    if a:
        ans *= a
print(ans)
Problem p03524 (python)

Fixed submission:
from collections import Counter

S = [i for i in input()]
c = Counter(S)
if len(c) == 1:
    if len(S) == 1:
        print("YES")
    else:
        print("NO")
elif len(c) == 2:
    if len(S) == 2:
        print("YES")
    else:
        print("NO")
else:
    dif = c.most_common()[0][1] - c.most_common()[2][1]
    print("YES" if dif<=1 else "NO")

Buggy submission (verdict: Runtime Error):
from collections import Counter

c = Counter([*input()])
if len(c) <= 2:
    print("NO")
else:
    dif = c.most_common()[0][1] - c.most_common()[2][1]
    print("YES" if dif<=1 else "NO")
Problem p03545 (python)

Fixed submission:
import sys
a,b,c,d=[i for i in input()]
op=["+","-"]
for i in op:
  for j in op:
    for k in op:
      if eval(a+i+b+j+c+k+d)==7:
        print(a+i+b+j+c+k+d+"=7")
        sys.exit()

Buggy submission (verdict: Runtime Error):
S = input()
def saiki(i,s=S[0]):
    if i == 3:
        if eval(s) == 7:
            print(str(s) + "=7")
            exit()
    saiki(i+1,s+"+"+S[i+1])
    saiki(i+1,s+"-"+S[i+1])

saiki(0)
Problem p03574 (python)

Fixed submission:
h,w=map(int,input().split())
s=[]
for i in range(h):
  s.append([i for i in input()])
l=[["" for i in range(w)] for j in range(h)]
for hh in range(h):
  for ww in range(w):
    if s[hh][ww]=="#":
      l[hh][ww]="#"
    else:  
      cnt=0
      for hhh in [-1,0,1]:
        for www in [-1,0,1]:
          if 0<=hh+hhh<h and 0<=ww+www<w and s[hh+hhh][ww+www]=="#":
            cnt+=1
      l[hh][ww]=cnt
for i in l:
  for j in i:
    print(j,end="")
  print()

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
l=[""]*W
ll=[["" for i in range(W)] for j in range(H)] 
for i in range(H):
  l[i]=[i for i in input()] 
for h in range(H):
  for w in range(W):
    if l[h][w]=="#":
      ll[h][w]="#"
    else:  
      cnt=0
      for hh in [-1,0,1]:
        for ww in [-1,0,1]:
          if 0<=h+hh<H and 0<=w+ww<W:
            if l[h+hh][w+ww]=="#":
              cnt+=1
      ll[h][w]=str(cnt)   
for i in range(H):
  print("".join(ll[i]))
Problem p03651 (python)

Fixed submission:
import fractions
from functools import reduce
N,K,*A = map(int,open(0).read().split())
g = reduce(fractions.gcd,A)
print("POSSIBLE" if K % g == 0 and K <= max(A) else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

N,K,*A = map(int,open(0).read().split())
g = reduce(math.gcd,A)
print("POSSIBLE" if K % g == 0 else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import math

N,K,*A = map(int,open(0).read().split())
g = A[0]
for i in A:
   g = math.gcd(g,i)
print("POSSIBLE" if K % g == 0 and K <= max(A) else "IMPOSSIBLE")
Problem p02909 (python)

Fixed submission:
S = ["Sunny","Cloudy","Rainy"]
s = input()
for i in range(len(S)):
    if(i == len(S)-1):
        print(S[0])
        break
    if(S[i] == s):
        print(S[i+1])
        break

Buggy submission (verdict: Runtime Error):
S = ["Sunny","Cloudy","Rainy"]
s = input()
for i in range(len(S)):
    if(i == len(S)):
        print(S[0])
        break
    if(S[i] == s):
        print(S[i+1])
        break

Buggy submission (verdict: Runtime Error):
S = ["Sunny","Cloudy","Rainy"]
s = input()
p = 0
for i in range(len(S)):
    if(i == len(S)):
        print(S[0])
    if(S[i] == s):
        print(S[i+1])
        break
Problem p02911 (python)

Fixed submission:
A = list(map(int, input().split())) 
N = A[0]
K = A[1]
Q = A[2]
n = [K for _ in range(N)]
for i in range(N):
    n[i] -= Q
for _ in range(Q):
    ans = int(input()) - 1
    n[ans] += 1
for i in range(N):
    if(n[i] > 0):
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split())) 
N = A[0]
K = A[1]
Q = A[2]
n = [K for _ in range(N)]
for i in range(N):
    N[i] -= Q
for _ in range(Q):
    ans = int(input()) - 1
    N[ans] += 1
for i in range(N):
    if(n[i] > 0):
        print("Yes")
    else:
        print("No")
Problem p02639 (python)

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

b = A.index(0)
if 0 in A:
    print(b + 1)
    exit()

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

x = s.index(0)
print(x + 1)
Problem p02675 (python)

Fixed submission:
N = input()
 
if N[-1] == '3':
  print('bon')
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())

if N[-1] == 3:
  print('bon')
elif N[-1] == 0 or N[-1] == 1 or N[-1] == 6 or N[-1] == 8:
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = len(N)
 
if a == 2 and N[1] == 3:
  print('bon')
elif a == 2 and N[1] == 0 or N[1] == 1 or N[1] == 6 or N[1] == 8:
  print('hon')
elif a == 2 and N[1] == 2 or N[1] == 5 or N[1] == 7 or N[1] == 9:
  print('pon')
elif a == 3 and N[2] == 3:
  print('bon')
elif a == 3 and N[2] == 2 or N[2] == 5 or N[2] == 7 or N[2] == 9:
  print('pon')
elif elif a == 3 and N[2] == 0 or N[2] == 1 or N[2] == 6 or N[2] == 8:
  print('hon')
elif a == 1 and N[0] == 3:
  print('bon')
elif a == 1 and N[0] == 0 or N[0] == 1 or N[0] == 6 or N[0] == 8:
  print('hon')
else:
  print('pon')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = len(N)

if a == 2 and N[1] == 3:
  print('bon')
elif a == 2 and N[1] == 0 or N[1] == 1 or N[1] == 6 or N[1] == 8:
  print('hon')
elif a == 2 and N[1] == 2 or N[1] == 5 or N[1] == 7 or N[1] == 9:
  print('pon')
elif a == 3 and N[2] == 3:
  print('bon')
elif a == 3 and N[2] == 2 or N[2] == 5 or N[2] == 7 or N[2] == 9:
  print('pon')
elif elif a == 3 and N[2] == 0 or N[2] == 1 or N[2] == 6 or N[2] == 8:
  print('hon')
elif a == 1 and N[0] == 3:
  print('bon')
elif a == 1 and N[0] == 0 or N[0] == 1 or N[0] == 6 or N[0] == 8:
  print('hon')
elif a == 1 and N[0] == 2 or N[0] == 5 or N[0] == 7 or N[0] == 9:
  print('pon')

Buggy submission (verdict: Runtime Error):
N = int(input())

if N >= 100 && N[2] == 3:
  print('bon')
elif N >= 100 && N[2] == 1 or N[2] == 0 or N[2] == 6 or N[2] == 8:
  print('pon')
elif N >= 100 && N[2] == 2 or N[2] == 4 or N[2] == 5 or N[2] == 7 or N[2] == 9:
  print('hon')
elif N < 100 && N[1] == 3:
  print('bon')
elif N < 100 && N[1] == 1 or N[1] == 0 or N[1] == 6 or N[1] == 8:
  print('pon')
else:
  print('hon')
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
 
if s == t[:-1]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

if s = t[:-1]:
  print('Yes')
else:
  print('No')
Problem p02705 (python)

Fixed submission:
R = int(input())
print(2 * R * 3.14)

Buggy submission (verdict: Runtime Error):
import pi

r = int(input())

x = 2 * r * pi

print(x)

Buggy submission (verdict: Runtime Error):
#2pir

import math
math.pi

R = int(intput())
print(math.pi * 2 * R)
Problem p02717 (python)

Fixed submission:
x, y, z = map(int, input().split())
 
x, y, z = y, z, x
print(y, z, x)

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, input().split())
 
x, y, z = y, z, x
y, z, x = we
print(we)

Buggy submission (verdict: Runtime Error):
x, y, z = int(input().split)
print(int(z, x, y))

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, input().split())
x = a
y = b
z = c

print(int(c, a, b)

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, input().split())
print(int(z, x, y))

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, input().split())
x, y, z = a, b, c
print(int(b, c, a))

Buggy submission (verdict: Runtime Error):
x, y, z = map(int, input().split())
x, y, z = a, b, c
print(b, c, a)
Problem p02724 (python)

Fixed submission:
X = int(input())
 
a = X // 500
b = (X - a * 500) // 5
 
print(1000 * a + 5 * b)

Buggy submission (verdict: Runtime Error):
x = int(raw_intput())

1000ureshi = x / 500
5ureshi = (x % 500) / 5

ureshimi = 1000ureshi + 5ureshi

print(1000ureshi + 5ureshi)
Problem p02730 (python)

Fixed submission:
s = input()
d = len(s)//2
print("Yes" if s[:d] == s[d+1:] else "No")

Buggy submission (verdict: Runtime Error):
s = input()
d = len(s)//2
print("Yes" if s[:d] == s[d+1:] "No" else)

Buggy submission (verdict: Runtime Error):
s = input()
d = len(s)//2
print("Yes" if s[:d] == s[d+1:] "No" else)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)

if s[0:(n-1)/2] == s[(n+3)/2:]:
  print("Yes")
else:
  print("No")
Problem p02778 (python)

Fixed submission:
s = input()
print('x' * len(s))

Buggy submission (verdict: Runtime Error):
s = input()

a = x

print('a' * len(s))

Buggy submission (verdict: Runtime Error):
s = input()

a = x

print('x' * len(s))
Problem p02817 (python)

Fixed submission:
s, t = map(str, input().split())
 
x = t + s
print(x)

Buggy submission (verdict: Runtime Error):
s, t = map(input().split())

x = t + s
print(x)
Problem p02642 (python)

Fixed submission:

n = int(input())
a = list(map(int,input().split()))+[10**7]
a.sort()
l = [True]*(10**6+1)

ans=0
a.sort()
for i in range(n):
    if l[a[i]]:
        for j in range(a[i],10**6+1,a[i]):
            l[j]=False
        if a[i]!=a[i+1]:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
m = max(a)
l = [True]*max(a)

ans=0
a.sort()
if a[0]==a[1]:
    l[a[0]-1]=False
for i in a:
    if l[i-1]:
        ans+=1
        tmp = i
        while tmp<=m:
            l[tmp-1] = False
            tmp+=i
    #print(l)
    #print(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
l = [False]*n
if a[0]==a[1]:
    l[0]=True

a.sort()
#print(a)
for i in range(n-1):
    for j in range(i+1,n):
        if l[j]:
            continue
        if a[j]%a[i]==0:
            l[j]=True
    #print(l)
print(l.count(False))
Problem p02814 (python)

Fixed submission:
import fractions
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import functools

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def lcm_base(x,y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

n,m = LI()
a = [int(i)//2 for i in LI()]

def num_of_2(x):
    c = 0
    while x%2==0:
        c+=1
        x//=2
    return c

a0 = num_of_2(a[0])
if any([num_of_2(i) != a0 for i in a]):
    print(0)
else:
    def lcm(x,y):
        return x//fractions.gcd(x,y)*y

    c = 1
    for i in a:
        c = lcm(c,i)
        if c>=inf:
            break
    
    ans = m//c
    print((ans+1)//2)

Buggy submission (verdict: Runtime Error):
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys
import functools

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def lcm_base(x,y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

n,m = LI()
a = LI()

lcm = lcm_list(a)
print((m//(lcm//2))-(m//lcm))
Problem p02850 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append([b,i])

ans = [None]*(n-1)
def rec(cur,color):

    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1
rec(0, 0)
print(max(ans))
print(*ans, sep="\n")

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(10**6)
n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append([b,i])

ans = [None]*(n-1)
def rec(cur,color):

    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1
rec(0, 0)
print(max(ans))
print(*ans, sep="\n")

Buggy submission (verdict: Runtime Error):
n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append([b,i])

ans = [None]*(n-1)
def rec(cur,color):

    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1
rec(0, 0)
print(max(ans))
print(*ans, sep="\n")
Problem p02854 (python)

Fixed submission:
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


n = INT()
l = MAP()

s = sum(l)
tmp=0
for i in range(n):
    tmp+=l[i]
    if tmp >= s/2:
        p1 = tmp - (s/2)
        idx1 = i
        break

tmp=0
for i in range(n-1,-1,-1):
    tmp+=l[i]
    if tmp >= s/2:
        p2 = tmp - (s/2)
        idx2 = i
        break

if p1 <= p2:
    left = sum(l[:idx1+1])
    right = sum(l[idx1+1:])
else:
    left = sum(l[:idx2])
    right = sum(l[idx2:])
print(abs(right-left))

Buggy submission (verdict: Runtime Error):
ef MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


n = INT()
l = MAP()

s = sum(l)
tmp=0
for i in range(n):
    tmp+=l[i]
    if tmp >= s/2:
        idx = i
        break

left = sum(l[:idx+1])
right = sum(l[idx+1:])
print(abs(right-left))