Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

for i in range(1,4):
	if i != A and i != B:
      print(i)
  

Fixed submission:
A = int(input())
B = int(input())

for i in range(1,4):
  if i != A and i != B:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# B - Sum of Three Integers
K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(S-x-y+1):
          if z > K or x + y + z != S:
            continue
          count += 1
            
# 出力
print(count)


Fixed submission:
# -*- coding: utf-8 -*-
# B - Sum of Three Integers
K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if z >= 0 and z <= K:
            count += 1

# 出力
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
# B - Sum of Three Integers
K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x + y + z != S:
                continue
            count += 1

# 出力
print(count)


Fixed submission:
# -*- coding: utf-8 -*-
# B - Sum of Three Integers
K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if z >= 0 and z <= K:
            count += 1

# 出力
print(count)
Buggy python submission (verdict: Runtime Error):
h = int(input())
w = int(input())
n = int(input())

print(max(h, x)%n)

Fixed submission:
import math

h = int(input())
w = int(input())
n = int(input())

print(math.ceil(n / max(h, w)))
Buggy python submission (verdict: Runtime Error):
import fractions

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

lcm = list[0]
for i in range(1, N):
    lcm = lcm * list[i] // fractions.gcd(lcm, list[i])



ans = 0

for i in range(N):
  ans += int(lcm / list[i])

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


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

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a

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

alllcm = 1

for i in range(N):
  alllcm = lcm(alllcm, list[i])

ans = 0

for i in range(N):
  ans += alllcm // list[i]

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

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

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

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

lcm = lcm_list(list)

ans = 0

for i in range(N):
  ans += lcm // list[i]

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


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

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a

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

alllcm = 1

for i in range(N):
  alllcm = lcm(alllcm, list[i])

ans = 0

for i in range(N):
  ans += alllcm // list[i]

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

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

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

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

lcm = lcm_list(list)

ans = 0

for i in range(N):
  ans += int(lcm / list[i])

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


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

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a

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

alllcm = 1

for i in range(N):
  alllcm = lcm(alllcm, list[i])

ans = 0

for i in range(N):
  ans += alllcm // list[i]

print(ans % (10**9 + 7))
Buggy python submission (verdict: Runtime Error):
N = input()

if N % 2 == 0:
    print((N / 2) / N)

else:
    print(((N + 1) / 2) / N)


Fixed submission:
N = int(input())

if N % 2 == 0:
    print((N / 2) / N)

else:
    print(((N + 1) / 2) / N)
Buggy python submission (verdict: Runtime Error):
NK = input().split('')
N = int(NK[0])
K = int(NK[1])
h_list = input().split('')

# N=1
# K=500
# h_list=[499]

person = 0
for n in range(N):
    if int(h_list[n]) >= K:
        person+=1
    
print(person)

Fixed submission:
N, K = (int(i) for i in input().split())  
h_list = [int(i) for i in input().split()] 

person = 0
for n in range(N):
    if int(h_list[n]) >= K:
        person+=1
    
print(person)

Buggy python submission (verdict: Runtime Error):
NK = input().split('')
N = int(NK[0])
K = int(NK[1])
h_list = input().split('')
h_list = [int(x) for x in hlist]

# N=1
# K=500
# h_list=[499]

person = 0
for n in range(N):
    if h_list[n] >= K:
        person+=1
    
print(person)

Fixed submission:
N, K = (int(i) for i in input().split())  
h_list = [int(i) for i in input().split()] 

person = 0
for n in range(N):
    if int(h_list[n]) >= K:
        person+=1
    
print(person)

Buggy python submission (verdict: Runtime Error):
N, K = input().split('')
N = int(N)
K = int(K)
h_list = input().split('')
h_list = [int(x) for x in hlist]

# N=1
# K=500
# h_list=[499]

person = 0
for n in range(N):
    if h_list[n] >= K:
        person+=1
    
print(person)

Fixed submission:
N, K = (int(i) for i in input().split())  
h_list = [int(i) for i in input().split()] 

person = 0
for n in range(N):
    if int(h_list[n]) >= K:
        person+=1
    
print(person)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split()
b = input().split()
c = input().split()

manzoku_do = 0
i = 0

manzoku_do += int(b[int(a[i])])
i += 1

while i < n:
  manzoku_do += int(b[int(a[i])])
  
  if int(a[i - 1]) == int(a[i]) - 1:
    manzoku_do += int(c[int(a[i -1])])
    i += 1
    
print(manzoku_do)

Fixed submission:
n = int(input())
a = input().split()
b = input().split()
c = input().split()

manzoku_do = 0
i = 0

manzoku_do = 0
i = 0

manzoku_do += int(b[int(a[i]) - 1])
i += 1

while i < n:
  manzoku_do += int(b[int(a[i]) - 1])
  
  if int(a[i - 1]) -1  == int(a[i])-1 - 1:
    manzoku_do += int(c[int(a[i -1]) -1 ])
  i += 1
    
    
print(manzoku_do)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split()
b = input().split()
c = input().split()

manzoku_do = 0
i = 0

manzoku_do += int(b[int(a[i])])
i += 1

while i < n:
  manzoku_do += int(b[int(a[i])])
  
  if a[i - 1] == a[i] - 1:
    manzoku_do += int(c[int(a[i -1])])
    i += 1
    
print(manzoku_do)

Fixed submission:
n = int(input())
a = input().split()
b = input().split()
c = input().split()

manzoku_do = 0
i = 0

manzoku_do = 0
i = 0

manzoku_do += int(b[int(a[i]) - 1])
i += 1

while i < n:
  manzoku_do += int(b[int(a[i]) - 1])
  
  if int(a[i - 1]) -1  == int(a[i])-1 - 1:
    manzoku_do += int(c[int(a[i -1]) -1 ])
  i += 1
    
    
print(manzoku_do)
Buggy python submission (verdict: Runtime Error):

import numpy as np
N = int(input())
B = np.array(input().split(), dtype=int)[::-1]

et = 0

ret += B[0]

i = 0
while i < N-2:
    ret += B[i] if B[i] < B[i+1] else B[i+1]
    i+=1
print(ret)

Fixed submission:
import numpy as np
N = int(input())
B = np.array(input().split(), dtype=int)[::-1]

ret = 0

ret += B[0]

i = 0
while i < N-2:
    ret += B[i] if B[i] < B[i+1] else B[i+1]
    i+=1

ret += B[-1]
print(ret)

Buggy python submission (verdict: Runtime Error):
N = int(input())
B = np.array(input().split(), dtype=int)[::-1]

et = 0

ret += B[0]

i = 0
while i < N-2:
    ret += B[i] if B[i] < B[i+1] else B[i+1]
    i+=1
print(ret)

Fixed submission:
import numpy as np
N = int(input())
B = np.array(input().split(), dtype=int)[::-1]

ret = 0

ret += B[0]

i = 0
while i < N-2:
    ret += B[i] if B[i] < B[i+1] else B[i+1]
    i+=1

ret += B[-1]
print(ret)

Buggy python submission (verdict: Runtime Error):
N = int(input())
B = np.array(input().split(), dtype=uint)[::-1]

et = 0

ret += B[0]

i = 0
while i < N-2:
    ret += B[i] if B[i] < B[i+1] else B[i+1]
    i+=1
print(ret)

Fixed submission:
import numpy as np
N = int(input())
B = np.array(input().split(), dtype=int)[::-1]

ret = 0

ret += B[0]

i = 0
while i < N-2:
    ret += B[i] if B[i] < B[i+1] else B[i+1]
    i+=1

ret += B[-1]
print(ret)
Buggy python submission (verdict: Runtime Error):
n = min[int(i) for in in input().split()]
print(str(n)*int(n))

Fixed submission:
n = [int(i) for i in input().split()]
print(str(min(n)) * max(n))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
ans = [input().split() for _ in range(m)]
ac = []
wn = []
acn,wan = 0,0
for i in ans:
  for j in range(len(ac)):
    if i[0] != ac[j]:
      if i[1] == 'AC' :
        wan += wn.count(i[0])
        ac += [i[0]]
        acn += 1
      else :
        wn += [i[0]]
print(acn,wan)

Fixed submission:
print(chr(ord(input())+1))
Buggy python submission (verdict: Runtime Error):
N,S = int(input()),input()
ans = ""
abc = "ABCDEFGHIGKLMNOPQRSTUVWXYZ"
for i in S:
  ans += abc[(abc.index(i)+N)%26]
print(ans)

Fixed submission:
N = int(input())
 
T = [chr((ord(s)-65 + N)%26 + 65) for s in input()]
 
print("".join(T))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))
Nflag = 0
count = 0
for i in range(N,1,-1):
    for j in range(i-1,0,-1):
        if P[i-1]>P[j-1]:
            Nflag = 1
            break
    if Nflag == 0:
        count+=1
    Nflag = 0
print(count+1)

Fixed submission:
N = int(input())
P = list(map(int,input().split()))
Nflag = 0
count = 0
tmp = float("inf")
for i in P:
    if i<tmp:
        tmp=i
    else:
        count+=1
print(N-count)
Buggy python submission (verdict: Runtime Error):
import math
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)**0.5
 
n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*4/math.factorial(n))

Fixed submission:
r=int(input())
print(r**2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int,input().split()))
 
ans = 1
if min(d) != 0:
  ans = 0
d.sort()
for i in range(1,max(d)+1):
  ans *= d.count(i-1)**d.count(i)
  if ans == 0:
    break
print(ans%998244353)

Fixed submission:
from collections import Counter
mod=998244353
n=int(input())
d=list(map(int,input().split()))
q=Counter(d)
if q[0]!=1 or d[0]!=0:
	print(0)
	exit()
ans=1
for i in range(1,max(d)+1):
    ans*=pow(q[i-1],q[i],mod)
    ans%=mod
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
list = [1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,
       24,25,27,28,30,32,35,36,40,42,45,48,49,54,
       56,63,64,72,81]

if list in n:
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
list = [1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,
       24,25,27,28,30,32,35,36,40,42,45,48,49,54,
       56,63,64,72,81]

if n in list:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(n):
  ans += i
print(ans)

Fixed submission:
n = int(input())

ans = 0
if n%2 != 0:
  ans = n*((n-1)//2)
else:
  ans = n*((n//2)-1) + n//2

print(int(ans))
Buggy python submission (verdict: Runtime Error):
N,Q=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(N-1)]
A.sort()
 
cost=[0]*(N+1)
 
for _ in range(Q):
	a,b=map(int,input().split())
	cost[a]+=b
 
for a in A:
	cost[a[1]] += cost[a[0]]
print(*cost[1:])
N,Q=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(N-1)]
A.sort()

cost=[0]*(N+1)

for _ in range(Q):
	a,b=map(int,input().split())
	cost[a]+=b

for a in A:
	cost[a[1]] += cost[a[0]]
print(*cost[1:])


Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print('red')

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

score = [0 for _ in range(N)]
 
# 子頂点番号:親頂点番号のdictを生成する
d = {}
for i in range(1,N):
  a,b = map(int,input().split())
  d[b] = a
      
# スコア加算処理
for i in range(1,Q+1):
  p,x = map(int,input().split())
  score[p-1] = x  
for i in range(1,len(score)):
  addScore = score[d[i+1]-1]
  score[i] += addScore
print(*score)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Time Limit Exceeded):
def equalCheck(aList, bList):
  checkList = [0] * 10
  for i in range(10):
    for j in range(10):
      if checkList[j] == 0 and aList[i] == bList[j]:
        checkList[j] = 1
  if 0 in checkList:
    return False
  return True

N = int(input())
strList = []
for i in range(N):
  strList.append(input())

count = 0
for i in range(N):
  for j in range(i+1,N):
    if equalCheck(strList[i], strList[j]):
      count += 1
      
print(count)





Fixed submission:
N = int(input())
strList = []
for i in range(N):
  strList.append(input())

count = 0

dict = {}

for i in range(N):
  charList = list(strList[i])
  charList.sort()
  key = "".join(charList)
  if not key in dict:
    dict[key] = 1
  else:
    dict[key] += 1  

# dictが持つvalue値を要素にfor文で回す
count = 0;
for v in dict.values():
  count += (v * (v-1) // 2)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
def equalCheck(aList, bList):
  checkList = [0] * 10
  for i in range(10):
    for j in range(10):
      if aList[i] == bList[j] and checkList[j] == 0:
        checkList[j] = 1
  if 0 in checkList:
    return False
  return True

N = int(input())
strList = []
for i in range(N):
  strList.append(input())

count = 0
for i in range(N):
  for j in range(i+1,N):
    if equalCheck(strList[i], strList[j]):
      count += 1
      
print(count)





Fixed submission:
N = int(input())
strList = []
for i in range(N):
  strList.append(input())

count = 0

dict = {}

for i in range(N):
  charList = list(strList[i])
  charList.sort()
  key = "".join(charList)
  if not key in dict:
    dict[key] = 1
  else:
    dict[key] += 1  

# dictが持つvalue値を要素にfor文で回す
count = 0;
for v in dict.values():
  count += (v * (v-1) // 2)
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

c = 0
for i in range(len(b)):
  # print('倒せる数', b)
  # print('倒せる街にいるモンスターの数',a)
  for j in range(b[i]):
    if a[i] > 0:
      b[i] -= 1
      a[i] -= 1
      c += 1
    elif a[i] == 0 and a[i+1] > 0:
      b[i] -= 1
      a[i+1] -= 1
      c += 1

print(c)


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

c = 0

for i in range(len(b)):
  if b[i] > a[i]:
    c += a[i]
    b[i] = b[i] - a[i]
    a[i] = 0
  else:
    c += b[i]
    a[i] = a[i] - b[i]
    b[i] = 0
  
  if a[i] == 0:
    if b[i] > a[i+1]:
      c += a[i+1]
      b[i] = b[i] - a[i+1]
      a[i+1] = 0
    else:
      c += b[i]
      a[i+1] = a[i+1] - b[i]
      b[i] = 0
  

print(c)
Buggy python submission (verdict: Runtime Error):
l,r = map(int,input().split())

r = min(r, l+4038)

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

Fixed submission:
import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]

# 最大値のインデックス
i1 = np.argmax(a)
temp = a[i1]
a[i1] = 0
# ２番目の最大値のインデックス
i2 = np.argmax(a)
a[i1] = temp


for i in range(n):
  if i == i1:
    print(a[i2])
  else:
    print(a[i1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ia = [int(input()) for _ in range(n)]
a = ia

for i in range(n):
  temp = a.pop(i)
  tempList = sorted(a)
  print(tempList[n-2])
  a.insert(i,temp)

Fixed submission:
import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]

# 最大値のインデックス
i1 = np.argmax(a)
temp = a[i1]
a[i1] = 0
# ２番目の最大値のインデックス
i2 = np.argmax(a)
a[i1] = temp


for i in range(n):
  if i == i1:
    print(a[i2])
  else:
    print(a[i1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ia = [int(input()) for _ in range(n)]
a = ia

for i in range(n):
  temp = a.pop(i)
  print(max(a))
  a.insert(i,temp)

Fixed submission:
import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]

# 最大値のインデックス
i1 = np.argmax(a)
temp = a[i1]
a[i1] = 0
# ２番目の最大値のインデックス
i2 = np.argmax(a)
a[i1] = temp


for i in range(n):
  if i == i1:
    print(a[i2])
  else:
    print(a[i1])
Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())

r = min(r, r+4038)

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

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

r = min(r, l+4038)

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
    if min == 0:
      break
print(min)

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

r = min(r, l+4038)

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

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

r = min(r, l+4038)

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int, input().split())

count = 0
for i in range(a,b+1):
  if i%c != 0 and i%d != 0:
    count += 1
print(count)

Fixed submission:
import fractions

a,b,c,d = map(int, input().split())

a -= 1

# a~bの数でcで割り切れる数の個数は
divC = b//c - a//c
# a~bの数でdで割り切れる数の個数は
divD = b//d - a//d
# a~bの数でc,dの最小公倍数で割り切れる数の個数は
l = (c*d) // fractions.gcd(c,d)
divU= b//l - a//l
divSum = divC+divD-divU


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

if x < a:
  print(0)
elif x => a:
  print(10)

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

if x < a:
  print(0)
elif x >= a:
  print(10)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [1,1]
temp = 1
if 1 in a: dp[1] = 0
  
for i in range(2,n+1):
  if i in a: dp.append(0)
  else: dp.append(dp[i-1] + dp[i-2])

print(dp[n]%1000000007)

Fixed submission:
N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])
 
dp = [0, 1]
for i in range(N):
    if i+1 in A: dp.append(0)
    else: dp.append(dp[i]+dp[i+1])
print(dp[N+1]%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [1,1]
temp = 1
if 1 in a: dp[1] = 0
for i in range(2,n+1):
  dp.append(dp[i-1] + dp[i-2])
  if i in a: dp[i] = 0

print(dp[n]%1000000007)

Fixed submission:
N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])
 
dp = [0, 1]
for i in range(N):
    if i+1 in A: dp.append(0)
    else: dp.append(dp[i]+dp[i+1])
print(dp[N+1]%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [1,1]
temp = 1

if 1 in a: dp[1] = 0
for i in range(2,n+1):
  temp = dp[i-1] + dp[i-2]
  if i in a:
    temp = 0
  dp.append(temp)

print(dp[n]%1000000007)

Fixed submission:
N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])
 
dp = [0, 1]
for i in range(N):
    if i+1 in A: dp.append(0)
    else: dp.append(dp[i]+dp[i+1])
print(dp[N+1]%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

l,r = map(int,input().split())
temp1 = set(range(l,r+1))
for i in range(m-1):
  l,r = map(int,input().split())
  temp2 = set(range(l,r+1))
  temp1 = temp1 & temp2
  
print(len(temp1))


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

s,e = map(int,input().split())
for i in range(m-1):
  l,r = map(int,input().split())
  s = max(s,l)
  e = min(e,r)

print(len(range(s,e+1)))
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))

L=[0]
R=[0]
for i in range(n-1):
    L.append(gcd(L[i],a[i]))
    R.insert(0,gcd(R[-1-i],a[-1-i]))
#print(L)
#print(R)
ans = 0
for i in range(n):
  ans = max(ans,gcd(L[i],R[i]))
print(ans)

Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
L=[0]
R=[0]
for i in range(n-1):
    L.append(gcd(L[i],a[i]))
    R.append(gcd(R[i],a[-1-i]))
MAX=0
for i in range(n):
    MAX=max(MAX,gcd(L[i],R[-1-i]))
print(MAX)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
acCount = [0]*len(S)

count = 0
for i in range(len(S)-1):
  if S[i]=='A' and S[i+1]=='C':
    count += 1
    acCount[i+1] = count

for i in range(Q):
  L,R = map(int, input().split())
  print(max(max(acCount[L:R]) - max(acCount[0:L]),0))

Fixed submission:
N,Q = map(int, input().split())
S = input()
acCount = [0]*len(S)

count = 0
for i in range(len(S)-1):
  if S[i]=='A' and S[i+1]=='C':
    count += 1
  acCount[i+1] = count

  
for i in range(Q):
  L,R = map(int, input().split())
  print(acCount[R-1]-acCount[L-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
acCount = [0]*len(S)

count = 0
for i in range(len(S)-1):
  if S[i]=='A' and S[i+1]=='C':
    acCount[i+1] = 1

for i in range(Q):
  L,R = map(int, input().split())
  print(sum(acCount[L:R]))

Fixed submission:
N,Q = map(int, input().split())
S = input()
acCount = [0]*len(S)

count = 0
for i in range(len(S)-1):
  if S[i]=='A' and S[i+1]=='C':
    count += 1
  acCount[i+1] = count

  
for i in range(Q):
  L,R = map(int, input().split())
  print(acCount[R-1]-acCount[L-1])
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
h,w = map(int,input().spilt())

ans = h*W + w*H - h*w
print(ans)

Fixed submission:
H,W = map(int, input().split())
h,w = map(int, input().split())


print(H*W - h*W - w*H + h*w)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

cost = 0
ans = 0
while True:
  if(b <= cost):
    break
  cost += a
  ans += 1
print(min(ans-1,c)
  

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

if a*c <= b:
  print(c)
else:
  print(b//a)