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

Fixed submission:
x = int(raw_input())
out = 2*(x//11)
if x%11 == 0: pass
elif x%11 <= 6: out += 1
else: out += 2
print out

Buggy submission (verdict: Runtime Error):
x = int(raw_input)
print 2*(x//11) + (2 if x%11>6 else 1)
Problem p03816 (python)

Fixed submission:
a = int(raw_input())
print ((len(set(map(int, raw_input().split())))-1)//2)*2+1

Buggy submission (verdict: Runtime Error):
int(raw_input())
print len(set(map(int, raw_input().strip())))
Problem p02882 (python)

Fixed submission:
input = str(input()).split(" ")
input = [int(x) for x in input]

a=input[0]
b=input[1]
x=input[2]

import math

##check situation
height = x/a/a
if height <= b/2:
    teihen_height = 2*x/a/b
    print(math.degrees(math.atan(b/teihen_height)))
elif height == b:
    print(0)
else:
    nokori_height = b - height
    print(90-math.degrees(math.atan(0.5*a/nokori_height)))

Buggy submission (verdict: Runtime Error):
input = str(input()).split(" ")
input = [int(x) for x in input]

a=input[0]
b=input[1]
x=input[2]

import math

##check situation
height = x/a/a
if height <= b/2:
    teihen_height = 2*x/a/b
    print(math.degrees(math.atan(b/teihen_height)))
else:
    nokori_height = b - height
    print(90-math.degrees(math.atan(0.5*a/nokori_height)))
Problem p02885 (python)

Fixed submission:
A,B=input().split()
ans=int(A)-int(B)*2
if ans > 0:
  print(ans)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print(max(0,A-2*B)

Buggy submission (verdict: Runtime Error):
A,B=input().sp;it()
print(int(A)-int(B)*2)

Buggy submission (verdict: Runtime Error):
A,B=input()
print(int(A)-int(B)*2)

Buggy submission (verdict: Runtime Error):
A,B=Imput()
print(int(A)-int(B)*2)
Problem p03129 (python)

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

ans='NO'

if N%2==0 and K<=(N/2):
    ans='YES'
if N%2==1 and K<=((N+1)/2) :
    ans='YES'

print(ans)

Buggy submission (verdict: Runtime Error):
K,A,B=map(int,input().split())


ans=1+K
count=0
count=(K-(A))//2
ANS=1+(K-2*count)+abs(A-B)*count

print(max(ANS,ans))

Buggy submission (verdict: Runtime Error):
K,A,B=map(int,input().split())


ans=1+K
count=0
count=(K-(A-1))//2
ANS=(K-2*count)+abs(A-B)*count

print(max(ANS,ans))
Problem p03212 (python)

Fixed submission:
N = int(input())
 
def abc114_c(s):
  if(int(s) > N):
    return 0
  if(all(s.count(c) > 0 for c in "753")):
    ans = 1
  else:
    ans = 0
  for c in "753":
    ans += abc114_c(s+c)
  return ans
print(abc114_c("0"))

Buggy submission (verdict: Runtime Error):
1 N = int(input())
2
3 def dfs(s): # 文字列 s で始まる七五三数の個数
4 if int(s) > N:
5 return 0
6 ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
7 for c in '753':
8 ret += dfs(s + c)
9 return ret
10
11 print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく

Buggy submission (verdict: Runtime Error):
1 N = int(input())
2
3 def dfs(s): # 文字列 s で始まる七五三数の個数
4 if int(s) > N:
5 return 0
6 ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
7 for c in '753':
8 ret += dfs(s + c)
9 return ret
10
11 print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく
Problem p03220 (python)

Fixed submission:
N= int(input())
T,A=map(int,input().split())
H=[int(_) for _ in input().split()]

for i,h in enumerate(H):
    H[i]=abs(T-h*0.006-A)

print(H.index(min(H))+1)

Buggy submission (verdict: Runtime Error):
import numpy

N,M=map(int,input().split())
P=[]
Y=[]
for _ in range(M):
    data=[int(_) for _ in input().split()]
    P.append(data[0])
    Y.append(data[1])

y=[]
for x in range(1,N+1):
    for m in range(M):
        if P[m]==x:
            y.append(Y[m])

    ind=numpy.array(y)
    ind=ind.argsort()
    for i,k in enumerate(y):
        Y[Y.index(k)]=ind[i]+1
    y=[]

for x in range(M):
    xx=str(P[x])
    yy=str(Y[x])
    print(xx.zfill(6)+yy.zfill(6))
Problem p02900 (python)

Fixed submission:
import numpy as np
A,B=np.array(list(map(int, input().split())))
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
    
C=np.array(prime_factorize(gcd(A,B)))
print(len(np.unique(C))+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
A,B=np.array(list(map(int, input().split())))
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
C=np.array(prime_factorize(math.gcd(A,B)))
print(len(np.unique(C))+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
import collections

A,B=np.array(list(map(int, input().split())))

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(math.gcd(A,B)))
print(len(c)+1)
Problem p02903 (python)

Fixed submission:
import numpy as np
H,W,A,B=np.array(list(map(int, input().split())))

for row in range(H):
    if  row<=B-1:
        print(''.join(list(map(str, [1 if i<=A-1 else 0 for i in range(W)]))))
    else:
        print(''.join(list(map(str, [0 if i<=A-1 else 1 for i in range(W)]))))

Buggy submission (verdict: Runtime Error):
import numpy as np
H,W,A,B=np.array(list(map(int, input().split())))

for row in range(H):
    L1=np.array([])
    for column in range(W):
        if (B-row)>=0:
            L1=np.append(np.ones(A),np.zeros(W-A))
        else:
            L1=np.append(np.zeross(A),np.ones(W-A))
    L2=np.array(L1, dtype='int64')
    print(''.join(list(map(str, L2))))
Problem p02923 (python)

Fixed submission:
import numpy as np
N=int(input())
H=np.array(list(map(int, input().split())))
count=0
k=0
for i in range(N-1):
    count+=1
    if H[i]<H[i+1]:
        k=max(k,count-1)
        count=0
print(max(k,count))

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
H=np.array(list(map(int, input().split())))
count=0
c_i=np.array([])
for i in range(N-1):
    if H[i]>=H[i+1]:
        count+=1
        if i==(N-2):
            c_i=np.append(c_i,count)
    else:
        c_i=np.append(c_i,count)
        count=0
print(np.max(c_i))

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
H=np.array(list(map(int, input().split())))
count=0
c_i=[]
for i in range(N-1):
    if H[i]>=H[i+1]:
        count+=1
        if i==(N-2):
            c_i.append(count)
    else:
        c_i.append(count)
        count=0
print(max(c_i))
Problem p03000 (python)

Fixed submission:
import sys

input = sys.stdin.readline

n, x = map(int, input().split())
l = list(map(int, input().split()))

count=1

current=0

for _ in range(n):
    current+=l[_]
    count+=1
    if current > x:
        break



if current > x:
    print(count - 1)
else:
    print(count)

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

count = 1

current = 0

for l in l_list:
    current += l
    count += 1
    if current > x:
        print(count - 1)
        exit(1)

    print(count)
Problem p03001 (python)

Fixed submission:
import sys

input = sys.stdin.readline

w, h, x, y = map(int, input().split())

if w % 2 == 0 and h % 2 == 0 and w // 2 == x and h // 2 == y:
    print(str(w * h / 2) + " " + "1")
else:
    print(str(w * h / 2) + " " + "0")

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

w, h, x, y = map(int, input().split())

if w == h:
    print(f"{w * h / 2} 1")
else:
    print(f"{w * h / 2} 0")
Problem p03059 (python)

Fixed submission:
i = input().split(" ")
a=int(i[0])
b=int(i[1])
t=int(i[2])
print(t // a * b)

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = [int(value) for value in input().split(" ")]


a = sorted(a)

b = []
c = []

for value in a:
    if value % 2 != 0:
        b.append(value)
    else:
        c.append(value)

if len(b) == 0:
    a.remove(c[0])
    print(gcd_list(a))
else:
    a.remove(b[0])
    print(gcd_list(a))
Problem p03061 (python)

Fixed submission:
import fractions
# import math
from functools import reduce
 
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
 
n = int(input())
a = [int(value) for value in input().split(" ")]

from_right_gcd = []
from_left_gcd = []

# 左から
for index in range(len(a)):
    if index == 0:
        from_left_gcd.append(a[index])
        continue
    from_left_gcd.append(fractions.gcd(from_left_gcd[index - 1], a[index]))

# 右から
for index in range(len(a) - 1, -1, -1):
    if index == len(a) - 1:
        from_right_gcd.append(a[index])
        continue
    from_right_gcd.append(fractions.gcd(from_right_gcd[len(a) - index - 1 - 1], a[index]))

maybe_answer_list = []

for index in range(len(a)):
    if index == 0:
        maybe_answer_list.append(from_right_gcd[len(a) - 1 - 1])
        continue
    if index == len(a) - 1:
        maybe_answer_list.append(from_left_gcd[index - 1])
        continue
    maybe_answer_list.append(fractions.gcd(from_left_gcd[index - 1], from_right_gcd[len(a) - index - 1 - 1]))

print(max(maybe_answer_list))

Buggy submission (verdict: Runtime Error):
import fractions
 
n = int(input())
a = [int(value) for value in input().split(" ")]
 
from_right_gcd = []
from_left_gcd = []
 
# 左から
for index in range(a.__len__):
    if index == 0:
        from_left_gcd.append(a[index])
        continue
    from_left_gcd.append(fractions.gcd(from_left_gcd[index - 1], a[index]))
 
# 右から
for index in range(a.__len__ - 1, -1, -1):
    if index == a.__len__ - 1:
        from_right_gcd.append(a[index])
        continue
    from_right_gcd.append(fractions.gcd(from_right_gcd[a.__len__ - index - 1 - 1], a[index]))
 
maybe_answer_list = []
 
for index in range(a.__len__):
    if index == 0:
        maybe_answer_list.append(from_right_gcd[a.__len__ - 1 - 1])
        continue
    if index == a.__len__ - 1:
        maybe_answer_list.append(from_left_gcd[index - 1])
        continue
    maybe_answer_list.append(fractions.gcd(from_left_gcd[index - 1], from_right_gcd[a.__len__ - index - 1 - 1]))
 
print(max(maybe_answer_list))

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

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n = int(input())
a = [int(value) for value in input().split(" ")]


a = sorted(a)

b = []
c = []

for value in a:
    if value % 2 != 0:
        b.append(value)
    else:
        c.append(value)

if len(b) == 0:
    a.remove(c[0])
    print(gcd_list(a))
else:
    a.remove(b[0])
    print(gcd_list(a))

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

def gcd_list(numbers):
    return reduce(fraction.gcd, numbers)

n = int(input())
a = [int(value) for value in input().split(" ")]


a = sorted(a)

b = []
c = []

for value in a:
    if value % 2 != 0:
        b.append(value)
    else:
        c.append(value)

if len(b) == 0:
    a.remove(c[0])
    print(gcd_list(a))
else:
    a.remove(b[0])
    print(gcd_list(a))
Problem p03076 (python)

Fixed submission:
import sys

input = sys.stdin.readline

foods = [int(input()) for _ in range(5)]

exist_remainder_list = [(food, food % 10) for food in foods if food % 10 != 0]

if len(exist_remainder_list) != 0:
    last = min(exist_remainder_list, key=lambda value: value[1])
    foods.remove(last[0])

    ans = 0

    for index, food in enumerate(foods):
        ans += food
        while True:
            if ans % 10 == 0:
                break
            else:
                ans += 1

    print(ans + last[0])
else:
    ans = 0

    for index, food in enumerate(foods):
        ans += food
        while True:
            if ans % 10 == 0:
                break
            else:
                ans += 1

    print(ans)

Buggy submission (verdict: Runtime Error):
# import sys
# 
# input = sys.stdin.readline

foods = [int(input()) for _ in range(5)]

exist_remainder_list = [(food, food % 10) for food in foods if food % 10 != 0]

last = min(exist_remainder_list, key=lambda value: value[1])

foods.remove(last[0])

ans = 0

for index, food in enumerate(foods):
    ans += food
    while True:
        if ans % 10 == 0:
            break
        else:
            ans += 1

print(ans + last[0])

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

foods = [int(input()) for _ in range(5)]

exist_remainder_list = [(food, food % 10) for food in foods if food % 10 != 0]

last = min(exist_remainder_list, key=lambda value: value[1])

foods.remove(last[0])

ans = 0

for index, food in enumerate(foods):
    ans += food
    while True:
        if ans % 10 == 0:
            break
        else:
            ans += 1

print(ans + last[0])

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

foods = [int(input()) for _ in range(5)]

exist_remainder_list = [(food, food % 10) for food in foods if food % 10 != 0]

last = min(exist_remainder_list, key=lambda value: value[1])

foods.remove(last[0])

ans = 0

for index, food in enumerate(foods):
    ans += food
    while True:
        if ans % 10 == 0:
            break
        else:
            ans += 1

print(ans + last[0])
Problem p02900 (python)

Fixed submission:
import fractions


A, B = map(int, input().split())


gcd_ab = fractions.gcd(A,B)	



def factorization(n):
    arr = 0
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr += 1

    if temp!=1:
        arr += 1

    return arr

f = factorization(gcd_ab)
print(f + 1)

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


A, B = map(int, input().split())

if A == B:
    print(3)
    sys.exit()
	


def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

###############################


gcd_ab = fractions.gcd(A,B)	


primes_ab = primes(gcd_ab)

# 1は必ずはいる
count = 1
for t in primes_ab:
    if A % t == 0 and B % t == 0:
        count += 1

print(count)

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


A, B = map(int, input().split())

if A == B:
    print(3)
    sys.exit()

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k  == 0:
            return False
    return True

gcd_ab = fractions.gcd(A,B)	
#gcd_ab = math.gcd(A,B)	


# 1は必ずはいる
count = 1
for t in range(2, gcd_ab + 1):
    if A % t == 0 and B % t == 0 and is_prime(t):
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
import fractions


A, B = map(int, input().split())


def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

###############################


gcd_ab = fractions.gcd(A,B)	


primes_ab = primes(gcd_ab)

# 1は必ずはいる
count = 1
for t in primes_ab:
    if A % t == 0 and B % t == 0:
        count += 1

print(count)
Problem p02937 (python)

Fixed submission:
import bisect
import sys
S = input()
T = input()


# sが何番目に出てくるかの辞書をついくる
s_index = {}
for i in range(len(S)):
    if S[i] in s_index:
        s_index[S[i]].append(i + 1)
    else:
        s_index[S[i]] = [i+1]


current_s_index = 0
loop_count = 0
ans = 0
for t in T:
    if not t in s_index:
        print(-1)
        sys.exit()

    if current_s_index >= s_index[t][-1]:
        current_s_index = s_index[t][0]
        loop_count += 1
    else:
        index = bisect.bisect(s_index[t], current_s_index)
        current_s_index = s_index[t][index]

print(current_s_index + loop_count * len(S))

Buggy submission (verdict: Runtime Error):
import bisect
import sys
S = input()
T = input()


# sが何番目に出てくるかの辞書をついくる
s_index = {}
for i in range(len(S)):
    if S[i] in s_index:
        s_index[S[i]].append(i + 1)
    else:
        s_index[S[i]] = [i+1]


current_s_index = 0
loop_count = 0
ans = 0
for t in T:
    if not t in s_index:
        print(-1)
        sys.exit()

    if current_s_index > s_index[t][-1]:
        current_s_index = s_index[t][0]
        loop_count += 1
    else:
        index = bisect.bisect(s_index[t], current_s_index)
        current_s_index = s_index[t][index]

print(current_s_index + loop_count * len(S))
Problem p02960 (python)

Fixed submission:
S = input()
 
MOD = 10**9+7
 
dp = [[0]*13 for _ in range(len(S) + 1)]
 
 
dp[0][0] = 1
 
for index in range(len(S)):
    if S[index] == '?':
        for pre_index in range(13):
            for i in range(10):
                next_i = (i +  pre_index * 10 ) % 13
                dp[index+1][next_i] += dp[index][pre_index] 
                dp[index+1][next_i] %= MOD

    else:
        for pre_index in range(13):
            i = int(S[index])
            next_i = (i +  pre_index  * 10) % 13
            dp[index+1][next_i] += dp[index][pre_index] 
            dp[index+1][next_i] %= MOD
 
 
 
print(dp[len(S)][5])

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

MOD = 10**9+7

dp = [[0 for _ in range(13)] for _ in range(len(S) + 1)]


dp[0][0] = 1



for index in range(1, len(S) + 1):
    s = S[len(S) - index ]
    if s == '?':
	for i in range(10):
	    for pre_index in range(13):
                next_i = (i   +  pre_index * 10 ) % 13
                dp[index][next_i] += dp[index - 1][pre_index] % MOD
    else:
        i = int(s)
        for pre_index in range(13):
            next_i = (i +  pre_index * 10 ) % 13
            dp[index][next_i] += dp[index - 1][pre_index] % MOD




print(dp[len(S)][5] % MOD)

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

MOD = 10**9+7

dp = [[0 for _ in range(13)] for _ in range(len(S) + 1)]


dp[0][0] = 1

for index in range(1, len(S) + 1):
    s = S[len(S) - index ]
    mul = (10 ** (index - 1)) % 13
    if s == '?':
        for pre_index in range(13):
            for i in range(10):
                next_i = (i * mul  +  pre_index ) % 13
                dp[index][next_i] += dp[index - 1][pre_index] 
    else:
	i = int(s)
        for pre_index in range(13):
            next_i = (i * mul +  pre_index ) % 13
            dp[index][next_i] += dp[index - 1][pre_index] 

    for i in range(13):
        dp[index][i] %= MOD



print(dp[len(S)][5])
Problem p02972 (python)

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



dps = [False for _ in range(N + 1)]

ans =[]
#半分までは確定
fs = N // 2
for i in reversed(range(1, N + 1)):
    d_index = i * 2
    current_sum = 0
    while d_index <= N:
        if dps[d_index]:
            current_sum += 1
        d_index += i

    if current_sum % 2 == A[i-1]:
        dps[i] = False
    else:
        dps[i] = True


ans=[]
for i in range(1, N+1):
    if dps[i]:
        ans.append(i)


print(len(ans))
if len(ans) != 0:
    print(" ".join(map(str, ans)))

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

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(N // 2)

dps = [0 for _ in range(N)]

ans =[]
#半分までは確定
fs = N // 2
for i in range(fs, N):
    dps[i] += A[i]
    if A[i] == 1:
        ans.append(i+1)


for i in reversed(range(fs)):
    # 考慮すべき数i*素数 < N
    num = 0
    for p in prime_list:
        if (i+1) * p <= N:
            num += dps[(i+1) * p - 1]

    
    if num % 2 != A[i]:
        dps[i] += 1
        ans.append(i+1)


print(len(ans))
if len(ans) != 0:
    print(" ".join(map(str, ans)))
Problem p03061 (python)

Fixed submission:
import sys
from fractions import gcd

N = int(input())

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


if len(A) < 3:
    print(max(A))
    sys.exit()


left_side = [0 for _ in range(N)]
left_side[0] = A[0]

right_side = [0 for _ in range(N)]
right_side[-1] = A[-1]



for i in range(N -1):
    left_side[i + 1] = gcd(left_side[i], A[i + 1])

for i in range(1, N):
    right_side[-1* (i + 1)] = gcd(right_side[-1* i], A[ -1 *(i + 1)])


max_gcd = 1 

# left 
max_gcd = max(max_gcd, right_side[1])
# right
max_gcd = max(max_gcd, left_side[-2])

for i in range(1, N -1 ):
    left = left_side[i - 1]
    right = right_side[i + 1]
    max_gcd = max(max_gcd, gcd(left, right))




print(max_gcd)

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

N = int(input())

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


if len(A) < 3:
    print(max(A))
    sys.exit()


left_side = [0 for _ in range(N)]
left_side[0] = A[0]

right_side = [0 for _ in range(N)]
right_side[-1] = A[-1]



for i in range(N -1):
    left_side[i + 1] = gcd(left_side[i], A[i + 1])

for i in range(1, N):
    right_side[-1* (i + 1)] = gcd(right_side[-1* i], A[ -1 *(i + 1)])


max_gcd = 1 
for i in range(1, N -1 ):
    left = left_side[i - 1]
    right = right_side[i + 1]
    max_gcd = max(max_gcd, gcd(left, right))




print(max_gcd)

Buggy submission (verdict: Runtime Error):
import sys
N = input()

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


if len(A) < 3:
    print(max(A))
    sys.exit()



min_0 = A[0]
min_1 = A[1]
min_2 = A[2]


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]



max_primes = primes(A[-1])

def soinsu(n):
    ret = [0 for _ in range(len(max_primes))]
    for p_index in range(len(max_primes)):
        p = max_primes[p_index]
        while n % p == 0:
            n /= p
            ret[p_index] += 1
    return ret

def kouyaku(x, y):
    kouyaku = 1
    for p_index in range(len(max_primes)):
        p = max_primes[p_index]
        i = min(x[p_index], y[p_index])
        kouyaku *= pow(p, i)
    return kouyaku

def check(n):
    fail_count = 0
    for a in A:
        if a % n != 0:
            fail_count +=1
            if fail_count == 2:
                return False
    return True



soinsu_0 = soinsu(min_0)
soinsu_1 = soinsu(min_1)
soinsu_2 = soinsu(min_2) 


kouyaku_01 = kouyaku(soinsu_0, soinsu_1)
kouyaku_12 = kouyaku(soinsu_1, soinsu_2)
kouyaku_02 = kouyaku(soinsu_0, soinsu_2)


ans = 1
if check(kouyaku_01):
    ans = max(ans, kouyaku_01)

if check(kouyaku_12):
    ans = max(ans, kouyaku_12)


if check(kouyaku_02):
    ans = max(ans, kouyaku_02)


print(ans)