Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a=0
b=0
for i in range(len(N)):
	if N[i] == 'A' or N[i] ==  'T' or N[i] ==  'C' or N[i] ==  'G' :
		a+=1
	else: 
		if a > b: b = a
		a=0

print(b)


Fixed submission:
N = input()
a=0
b=0
for i in range(len(N)):
	if N[i] == 'A' or N[i] ==  'T' or N[i] ==  'C' or N[i] ==  'G' :
		a+=1
	else: 
		if a > b: b = a
		a=0

print(max(b,a))
Buggy python submission (verdict: Runtime Error):
N= int(input())
a = N//7
for i in range(a):
	if (N-(a-i)*7)%4 == 0:
		print("Yes")
		exit()
prin("No")

Fixed submission:
N= int(input())
a=N//7
if N%7 == 0 or N%4 ==0:
	print("Yes")
	exit()
for i in range(a):
	if (N-(a-i)*7)%4 == 0:
		print("Yes")
		exit()
print("No")
Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
for i in range(len(A)):
　　if A == B:
　　　　print("Yes")
　　　　exit()
　　A = (A+A[0])[1:]
print("No")


Fixed submission:
A = input()
B = input()
for i in range(len(A)):
    if A == B:
        print("Yes")
        exit()
    A = (A+A[0])[1:]
print("No")

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
for i in range(len(A)):
　　if(A == B):
　　　　print("Yes")
　　　　exit()
　　A = (A+A[0])[1:]
print("No")


Fixed submission:
A = input()
B = input()
for i in range(len(A)):
    if A == B:
        print("Yes")
        exit()
    A = (A+A[0])[1:]
print("No")

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
for i in range(len(A)):
if(A == B):
　　print("Yes")
　　exit()
　　A = (A+A[0])[1:]
print("No")


Fixed submission:
A = input()
B = input()
for i in range(len(A)):
    if A == B:
        print("Yes")
        exit()
    A = (A+A[0])[1:]
print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(m, n):
    return m if n == 0 else gcd(n, m%n)


def lcm(m, n):
    return m // gcd(m, n) * n


def main():
    MOD = 10**9 + 7
    n = int(input())
    a = list(map(int, input().split()))
    m = 1
    for i in a:
        m = lcm(m, i)
    
    ans = 0
    for i in a:
        b = m // i
        ans += b
        ans %= MOD
    
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def gcd(m, n):
    return m if n == 0 else gcd(n, m%n)


def lcm(m, n):
    return m // gcd(m, n) * n


def main():
    MOD = 10**9 + 7
    n = int(input())
    a = list(map(int, input().split()))
    m = 1
    for i in a:
        m = lcm(m, i)
    
    ans = 0
    for i in a:
        b = m // i
        ans += b
    
    print(ans%MOD)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(m, n):
    return m if n == 0 else gcd(n, m%n)


def lcm(m, n):
    return m // gcd(m, n) * n


def main():
    MOD = 10**9 + 7
    n = int(input())
    a = list(map(int, input().split()))
    m = 1
    for i in a:
        m = lcm(m, i)
    
    ans = 0
    for i in a:
        b = m // i
        ans += b
        ans %= MOD
    
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def gcd(m, n):
    return m if n == 0 else gcd(n, m%n)


def lcm(m, n):
    return m // gcd(m, n) * n


def main():
    MOD = 10**9 + 7
    n = int(input())
    a = list(map(int, input().split()))
    m = 1
    for i in a:
        m = lcm(m, i)
    
    ans = 0
    for i in a:
        b = m // i
        ans += b
    
    print(ans%MOD)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
print("{:.10f}"sum(list(map(lambda x: 1/x, a))))


Fixed submission:
int(input())
a = list(map(int, input().split()))
print("{:.10f}".format(1/sum(list(map(lambda x: 1/x, a)))))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
print("{:.10f}"sum((map(lambda x: 1/x, a))))

Fixed submission:
int(input())
a = list(map(int, input().split()))
print("{:.10f}".format(1/sum(list(map(lambda x: 1/x, a)))))
Buggy python submission (verdict: Runtime Error):
k, x = list(map(int, input().split()))
print(' '.join([i for i in range(x-k+1, x+k)]))

Fixed submission:
k, x = list(map(int, input().split()))
print(' '.join([str(i) for i in range(x-k+1, x+k)]))
Buggy python submission (verdict: Runtime Error):
n, x, y = map(int, input().split())
li = [0] * (n-1)
for i in range(1, n+1):
  for j in range(i+1, n+1):
    num = min(j-i, abs(x-i)+abs(y-j)+1)
    li[num-1] += 1
for i in range(n-1):
  print(li[i])

Fixed submission:
s=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 s = AAA and s = BBB :
    print('No')
else:
    print('Yes')

Fixed submission:
s = input()
if (s[0] != s[1] or s[0] != s[2]):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
balls=map(int,input().split())
print((n//(a+b))*a+min(a,n%(a+b)))

Fixed submission:
n,a,b=map(int,input().split())
print((n//(a+b))*a+min(a,n%(a+b)))
Buggy python submission (verdict: Runtime Error):
input_line = input()
v1,v2,v3 = input_line.split(' ')
if v1+v2+v3 >= 22:
  print('bust')
else:
  print('win')

Fixed submission:
input_line = input()
v1,v2,v3 = input_line.split(' ')
total = int(v1)+int(v2)+int(v3)
if total >= 22:
  print('bust')
else:
  print('win')
Buggy python submission (verdict: Runtime Error):
class Queue:
    def __init__(self):
        self.items = []

    def enqueue(self, item):
        self.items.insert(0, item)

    def dequeue(self):
        return self.items.pop()

    def size(self):
        return len(self.items)

    def self(self):
        return self.items

s = raw_input()
t = raw_input()
q = Queue()

j = 0
S = list(s)
L = len(s)
while j < L :
    q.enqueue(S[L - (j + 1)])
    j += 1

flag = False
i = 0
while i < q.size():
    x = q.dequeue()
    q.enqueue(x)
    if (list(t) == q.self()):
        flag = True
        break
    i += 1

if flag:
    print('Yes')
else:
    print('No')


Fixed submission:
a, b, c = map(int, raw_input().split())
list = [a, b, c]
list.sort()
cost = (list[2] - list[1]) + (list[1] - list[0])
print(cost)
Buggy python submission (verdict: Runtime Error):
def merge(A,B):
    C = []
    
    while len(A)!=0 and len(B) != 0:
        if A[0]>B[0]:
            C.append(A[0])
            del A[0]
        else:
            C.append(B[0])
            del B[0]

    if len(A)>len(B):
        C.extend(A)
    else:
        C.extend(B)

    return C

if __name__ == "__main__":
    X,Y,A,B,C = map(int,input().split())
    P = list(map(int,input().split()))
    Q = list(map(int,input().split()))
    R = list(map(int,input().split()))

    # 後で消す
    # P = [1,23,4,1,2]
    # Q = [4,3,56]
    # R = [70,20,1]

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    S = merge(P[:X],Q[:Y])
    S = merge(S,R)
    
    score = 0
    for i in range(X+Y):
        score += S[i]
    print(score)



Fixed submission:
S = input()

if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
def merge(A,B):
    C = []
    i = 0
    j = 0
    while i < len(A) and j < len(B):
        if A[i]>B[j]:
            C.append(A[i])
            i += 1
        else:
            C.append(B[j])
            j += 1

    if len(A)>len(B):
        C.extend(A[i:])
    else:
        C.extend(B[j:])

    return C

X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))


P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = merge(P[:X],Q[:Y])
S = merge(S,R)

score = 0
for i in range(X+Y):
    score += S[i]
print(score)



Fixed submission:
def merge(A,B):
    C = []
    i = 0
    j = 0
    while i < len(A) and j < len(B):
        if A[i]>B[j]:
            C.append(A[i])
            i += 1
        else:
            C.append(B[j])
            j += 1

    if len(A)-i>len(B)-j:
        C.extend(A[i:])
    else:
        C.extend(B[j:])

    return C

X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))

# P = [3,63,12,5,6]
# Q = [3,5,6,7,8]
# R = [13,5,6,8,23,5]
# X = 3
# Y = 2

# P = [63,12,6]
# Q = [8,7]

# i = 2
# j = 2
# C = [63,12,8,7]


P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = merge(P[:X],Q[:Y])
S = merge(S,R)

score = 0
for i in range(X+Y):
    score += S[i]
print(score)

Buggy python submission (verdict: Time Limit Exceeded):
def merge(A,B):
    C = []
    
    while len(A)!=0 and len(B) != 0:
        if A[0]>B[0]:
            C.append(A[0])
            del A[0]
        else:
            C.append(B[0])
            del B[0]

    if len(A)>len(B):
        C.extend(A)
    else:
        C.extend(B)

    return C

if __name__ == "__main__":
    X,Y,A,B,C = map(int,input().split())
    P = list(map(int,input().split()))
    Q = list(map(int,input().split()))
    R = list(map(int,input().split()))

    # 後で消す
    # P = [1,23,4,1,2]
    # Q = [4,3,56]
    # R = [70,20,1]

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    S = merge(P[:X],Q[:Y])
    S = merge(S,R)
    
    score = 0
    for i in range(X+Y):
        score += S[i]
    print(score)



Fixed submission:
def merge(A,B):
    C = []
    i = 0
    j = 0
    while i < len(A) and j < len(B):
        if A[i]>B[j]:
            C.append(A[i])
            i += 1
        else:
            C.append(B[j])
            j += 1

    if len(A)-i>len(B)-j:
        C.extend(A[i:])
    else:
        C.extend(B[j:])

    return C

X,Y,A,B,C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))

# P = [3,63,12,5,6]
# Q = [3,5,6,7,8]
# R = [13,5,6,8,23,5]
# X = 3
# Y = 2

# P = [63,12,6]
# Q = [8,7]

# i = 2
# j = 2
# C = [63,12,8,7]


P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

S = merge(P[:X],Q[:Y])
S = merge(S,R)

score = 0
for i in range(X+Y):
    score += S[i]
print(score)
Buggy python submission (verdict: Runtime Error):
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % 5
        if V == 0:
            break

    if cnt<=N:
        flag = False
        print(1)
    
    return flag

def main():
    X = int(input())

    flag = True
    N = X//100
    V = X-N*100

    while flag:
        if N >= V/5:
            flag = fun(N,V)
            N -= 1
            V += 100
        else:
            flag = False
            print(0)

if __name__=='__main__':
    main()

Fixed submission:
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % (5-i)
        if V == 0:
            break

    if cnt<=N and V==0:
        flag = False
        print(1)
    else:
        flag = True
    
    return flag

def main():
    X = int(input())

    flag = True
    N = X//100
    V = X-N*100

    while flag:
        if N >= V/5:
            flag = fun(N,V)
            N -= 1
            V += 100
        else:
            flag = False
            print(0)

if __name__=='__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % 5
        if V == 0:
            break

    if cnt<=N:
        flag = False
        print(1)
    
    return flag

X = int(input())

flag = True
N = X//100
V = X-N*100

while flag:
    if N >= V/5:
        flag = fun(N,V)
        N -= 1
        V += 100
    else:
        flag = False
        print(0)

Fixed submission:
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % (5-i)
        if V == 0:
            break

    if cnt<=N and V==0:
        flag = False
        print(1)
    else:
        flag = True
    
    return flag

def main():
    X = int(input())

    flag = True
    N = X//100
    V = X-N*100

    while flag:
        if N >= V/5:
            flag = fun(N,V)
            N -= 1
            V += 100
        else:
            flag = False
            print(0)

if __name__=='__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % 5
        if V == 0:
            break

    if cnt<=N:
        flag = False
        print(1)
    
    return flag

X = int(input())

flag = True
N = X//100
V = X-N*100

while flag:
    if N > V/5:
        flag = fun(N,V)
        N -= 1
        V += 100
    else:
        flag = False
        
        print(0)

Fixed submission:
def fun(N,V):
    cnt = 0

    for i in range(5):
        cnt += V // (5-i)
        V = V % (5-i)
        if V == 0:
            break

    if cnt<=N and V==0:
        flag = False
        print(1)
    else:
        flag = True
    
    return flag

def main():
    X = int(input())

    flag = True
    N = X//100
    V = X-N*100

    while flag:
        if N >= V/5:
            flag = fun(N,V)
            N -= 1
            V += 100
        else:
            flag = False
            print(0)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
print(n**3)

Fixed submission:
N = int(input())
print(N**3)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
data = list(map(int,input().split()))

max_cnt = 0
for tmp_i in range(N-1):
    i = tmp_i
    cnt = 0
    flag = True
    while flag:
        if i+1<N and data[i]>=data[i+1]:
            cnt += 1
            i += 1
        else:
            flag = False
    if max_cnt<cnt:
        max_cnt=cnt

print(max_cnt)


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

i = 0
max_cnt = 0
while i<N-1:
    # i = tmp_i
    cnt = 0
    flag = True
    while flag:
        if i+1<N and data[i]>=data[i+1]:
            cnt += 1
            i += 1
        else:
            flag = False
            i += 1
    # tmp_i+=1
    if max_cnt<cnt:
        max_cnt=cnt

print(max_cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
data = list(map(int,input().split()))

tmp_i = 0
max_cnt = 0
while  tmp_i<N-1:
    i = tmp_i
    cnt = 0
    flag = True
    while flag:
        if i+1<N and data[i]>=data[i+1]:
            cnt += 1
            i += 1
        else:
            flag = False
    tmp_i+=1
    max_cnt = max(max_cnt,cnt)

print(max_cnt)


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

i = 0
max_cnt = 0
while i<N-1:
    # i = tmp_i
    cnt = 0
    flag = True
    while flag:
        if i+1<N and data[i]>=data[i+1]:
            cnt += 1
            i += 1
        else:
            flag = False
            i += 1
    # tmp_i+=1
    if max_cnt<cnt:
        max_cnt=cnt

print(max_cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

sum = 0
for i in range(N):
    sum += i

print(sum)


Fixed submission:
N = int(input())
print(N*(N-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
count=0
for i in range(n):
  count=count+i
print(count)

Fixed submission:
n=int(input())
count=n*(n-1)//2
print(count)
Buggy python submission (verdict: Runtime Error):
a=[int(input()) for i in range(2)]
sum=0;
if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

print(sum)

Fixed submission:
a=list(map(int,input().split()))
sum=0;
if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

print(sum)

Buggy python submission (verdict: Runtime Error):
a=[int(input()) for i in range(2)]
sum=0;
if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

print(sum)

Fixed submission:
a=list(map(int,input().split()))
sum=0;
if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

if(a[0]>a[1]):
  sum+=a[0]
  a[0]-=1
else:
  sum+=a[1]
  a[1]-=1

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
count=0

for i in range(n-1):
  while True:
    if(a[i]+a[i+1] > x):
      if(a[i+1]>0):
        a[i+1]=a[i+1]-1
        count=count+1
        continue
      else:
        a[i]=a[i]-1
        count=count+1
        continue
    else:
      break

print(count)

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

for i in range(n-1):
  if(a[i]+a[i+1] > x):
    sa=(a[i]+a[i+1])-x
    count=count+sa

    if(a[i+1] > 0 and sa <= a[i+1]):
      a[i+1]=a[i+1]-sa
    else:
      a[i+1]=0

print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = list(map(int, input().split()))

p = len(format(max(A), 'b'))
digit = ['0' + str(p) + 'b'] * N
S = list(map(format, A, digit))
X = np.array([[int(c) for c in s] for s in S])
#print(X)
r = np.sum(X, 0)
#print(r)
r = r * (N - r)
#print(r)

res = 0
for j in range(p):
  res += r[j] * (2 ** (p-1-j))

print(res % (10**9 + 7))

Fixed submission:
a1, a2, a3 = map(int, input().split())
if a1 + a2 + a3 >= 22:
  print('bust')
else:
  print('win')
Buggy python submission (verdict: Runtime Error):
s = input()
l = (len(s) - len(s) % 2) / 2

for i in range(l):
  if s[i] != s[len(s) - i]:
    count += 1

print(count)


Fixed submission:
s = input()
l = int ((len(s) - len(s) % 2) / 2)

count = 0
for i in range(l):
  if s[i] != s[-(i+1)]:
    count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
# load
N = int(input())
a = []
x = []
y = []
for i in range(N):
  a.append(int(input()))
  for j in range(a[i]):
    xtmp, ytmp = map(int, input().split())
    x.append(xtmp)
    y.append(ytmp)

# honest?
b = 0
for i in range(N):
  b += (2**i)

b = format(b, 'b') # string representing binary

contradiction = False
while True:
  for i in range(N):
    if int(b[i]) == 1 and (int(b[x[i]-1]) != y[i]):
      contradiction = True
      break
  if contradiction:
    contradiction = False
    b = format(int(b, 2) - 1, 'b')
  else:
    break

h = 0
for i in range(N):
  h += int(b[i])

print(h)

Fixed submission:
import itertools

# load
N = int(input())
a = []
x = []
y = []
for i in range(N):
  a.append(int(input()))
  xtmp = []
  ytmp = []
  for j in range(a[i]):
    xtmp2, ytmp2 = map(int, input().split())
    xtmp.append(xtmp2)
    ytmp.append(ytmp2)
  x.append(xtmp)
  y.append(ytmp)

#print('x:%s' % x)
#print('y:%s' % y)
#print(x[0][0])

# honest?

contra = False
stop = False
for r in range(N+1):
  for v in itertools.combinations(range(N), r):
    h = [1] * N
    for t in range(len(v)):
      h[v[t]] = 0

    for i in range(N):
      for j in range(a[i]):
      	if h[i] == 1 and (h[x[i][j]-1] != y[i][j]): # contradiction
          contra = True
          #print('contra: h:%s, i:%d, j:%d, h[x[i][j]-1]:%d, y[i][j]:%d' % (h, i, j, h[x[i][j]-1], y[i][j]))
          break
      if contra:
        contra = False
        break
    else:
      stop = True
      #print('answer? h: %s' % h)
      break
  if stop:
    break
    
print(sum(h))
Buggy python submission (verdict: Runtime Error):
word = input()
if word[2]==word[3] and word[4]==word[5]:
    print('Yes')
    sys.exit(0)
print('No')



Fixed submission:
word = list(input())
if word[2]==word[3] and word[4]==word[5]:
    print('Yes')
else: print('No')

Buggy python submission (verdict: Runtime Error):
import sys

word = sys.argv[1]
if word[2]==word[3] and word[4]==word[5]:
    print('Yes')
    sys.exit(0)
print('No')



Fixed submission:
word = list(input())
if word[2]==word[3] and word[4]==word[5]:
    print('Yes')
else: print('No')
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
queries = []
for _ in range(Q):
    queries.append(input())

for query in queries:
    if query == "1":
        S = S[::-1]
    else:
        _, F, C = list(query.split())
        if F == "1":
            S = C + S
        else:
            S = S + C

print(S)

Fixed submission:
S = input()
Q = int(input())
queries = []
for _ in range(Q):
    queries.append(input())

# for query in queries:
#     if query == "1":
#         S = S[::-1]
#     else:
#         _, F, C = list(query.split())
#         if F == "1":
#             S = C + S
#         else:
#             S = S + C
# print(S)

left = ""
right = ""
target = 0

for query in queries:
    if query == "1":
        target = 1 - target
    else:
        _, F, C = list(query.split())
        if F == "1":
            if target == 0:
                left += C
            else:
                right += C
        else:
            if target == 0:
                right += C
            else:
                left += C
if target == 0:
    print("{}{}{}".format(left[::-1], S, right))
else:
    print("{}{}{}".format(right[::-1], S[::-1], left))
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

def lcm(values):
    ans = values[0]
    for i in range(1, len(values)):
        ans = ans * values[i] // gcd(ans, values[i])
    return ans

def count_div2(value):
    count = 0
    while value % 2 == 0:
        count += 1
        value //= 2
    return count

min_value = lcm(A)
amount = M * 2 // min_value

div2 = count_div2(A[0])
if any([count_div2(a) != amount_div2 for a in A]):
    print(0)
else:
    print((amount + 1) // 2)


Fixed submission:
from fractions import gcd
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

def lcm(values):
    ans = values[0]
    for i in range(1, len(values)):
        ans = ans * values[i] // gcd(ans, values[i])
    return ans

def count_div2(value):
    count = 0
    while value % 2 == 0:
        count += 1
        value //= 2
    return count

min_value = lcm(A)
amount = M * 2 // min_value

div2 = count_div2(A[0])
if any([count_div2(a) != div2 for a in A]):
    print(0)
else:
    print((amount + 1) // 2)
Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B = list(map(int, input().split()))
print(lcm(A, B))


Fixed submission:
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
A, B = list(map(int, input().split()))
print(lcm(A, B))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

count = 0
i = 0
while i < len(a):
    if a[i] != i + 1:
        a.pop(i)
        count += 1
    else:
        i += 1
if count < N:
    print(count)
else:
    print(-1)

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

count = 0
i = 0
d = 0
while i + d < len(a):
    if a[i + d] != i + 1:
        d += 1
        count += 1
    else:
        i += 1
if count < N:
    print(count)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import sys
import collections

N = int(input())
D = list(map(int,input().split()))

if D[0] != 0 or D[1] == 0:
    print(0)
    sys.exit()
DD = collections.Counter(D)
result = 1
for i in range(N - 1) - 1:
    if DD[i + 1] == 0:
        print(0)
        sys.exit()
    result *= DD[i] ** DD[i + 1]
print(result % 998244353)


Fixed submission:
import sys
import collections

N = int(input())
D = list(map(int,input().split()))

if D[0] != 0:
    print(0)
    sys.exit()
DD = collections.Counter(D)
max_key = max(DD.keys())
result = 1
last_v = 0
for k in range(max_key + 1):
    if not k in DD:
        print(0)
        sys.exit()
    v = DD[k]
    if k == 0:
        if v > 1:
            print(0)
            sys.exit()
        last_v = v
        continue
    result *= last_v ** v
    last_v = v
print(result % 998244353)
Buggy python submission (verdict: Runtime Error):
import math
import bisect

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()

for i in range(M):
  if (A[N - 1] < A[N - 2]):
    a = A.pop(-1)
    bisect.insort(A, a)
  A[N - 1] /= 2.0
amount = 0
for a in A:
  amount += math.floor(a)
print(amount)

Fixed submission:
S = input()

dict = {"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print(dict[S])