Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
count = 0
# a, b = (12, 18)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


c = make_divisors(a)
d = make_divisors(b)
e = []
for i in c:
    if i in d:
        e.append(i)

print(e)
e.pop(0)
e.sort()

gcd_list = [1]
for i in e:
    count = 0
    for j in gcd_list:
        if math.gcd(i, j) != 1:
            break
        else:
            count += 1
        if count == len(gcd_list):
            gcd_list.append(i)

# for i in range(len(e)):
#     for j in range(i+1, len(e)):
#         if math.gcd(e[i], e[j]) == 1:
#             print(e[i], e[j])
#             count += 1

print(len(gcd_list))


Fixed submission:
import fractions

a, b = map(int, input().split())
count = 0


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


c = make_divisors(a)
d = make_divisors(b)
e = []
for i in c:
    if i in d:
        e.append(i)

e.pop(0)
e.sort()

gcd_list = [1]
for i in e:
    count = 0
    for j in gcd_list:
        if fractions.gcd(i, j) != 1:
            break
        else:
            count += 1
        if count == len(gcd_list):
            gcd_list.append(i)

print(len(gcd_list))
Buggy python submission (verdict: Runtime Error):
a = int(input())

b = list(map(int, input().split()))
c = []
count = 0

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

print(max(c))

Fixed submission:
a = int(input())

b = list(map(int, input().split()))
c = []
count = 0

if a == 1:
    print(0)
    exit()

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

print(max(c))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import itertools

count = 0

n = int(input())

word_list = []
words = []

for i in range(n):
    word_list.append(input())

for i in range(n):
    c = collections.Counter(word_list[i])
    words.append(sorted(list(c.items())))

l = list(range(n))
d = list(itertools.combinations(l, 2))

for i, j in d:
    if words[i] == words[j]:
        count += 1


print(count)

Fixed submission:
import collections
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


n = int(input())
s = []
for i in range(n):
    a = sorted(input())
    s.append(a)

ss = []

for i in range(n):
    ss.append(''.join(s[i]))

c = collections.Counter(ss)
d = sorted(list(c.values()), reverse=True)

sum = 0

for i in d:
    if i == 1:
        print(sum)
        exit()
    else:
        a = combinations_count(i, 2)
        sum += a

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

n, m = map(int, input().split())
ans = 0
jobs = []
to_do = []
heapq.heapify(to_do)
for i in range(n):
    array = list(map(int, input().split()))
    array[1] *= -1
    jobs.append(array)

for i in range(1, m+1):
    addition = [j for j in jobs if j[0] == i]
    if len(addition) > 0:
        for x, y in addition:
            heapq.heappush(to_do, y)
    if len(to_do) > 0:
        ans += -1 * heapq.heappop(to_do)

print(ans)



Fixed submission:
import heapq
from collections import defaultdict

n, m = map(int, input().split())
ans = 0
jobs = defaultdict(list)
to_do = []
heapq.heapify(to_do)
for i in range(n):
    array = list(map(int, input().split()))
    array[1] *= -1
    jobs[array[0]].append(array[1])

for i in range(1, m+1):
    if len(jobs[i]) > 0:
        for j in jobs[i]:
            heapq.heappush(to_do, j)
    if len(to_do) > 0:
        ans += -1 * heapq.heappop(to_do)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ans = 0
jobs = []
for i in range(n):
    array = list(map(int, input().split()))
    jobs.append(array)

for i in range(1, m+1):
    x = [k for k in jobs if k[0] <= i]
    x.sort(key=lambda t:t[1], reverse=True)
    if len(x) > 0:
        job = x.pop(0)
        jobs.remove(job)
        ans += job[1]

print(ans)



Fixed submission:
import heapq
from collections import defaultdict

n, m = map(int, input().split())
ans = 0
jobs = defaultdict(list)
to_do = []
heapq.heapify(to_do)
for i in range(n):
    array = list(map(int, input().split()))
    array[1] *= -1
    jobs[array[0]].append(array[1])

for i in range(1, m+1):
    if len(jobs[i]) > 0:
        for j in jobs[i]:
            heapq.heappush(to_do, j)
    if len(to_do) > 0:
        ans += -1 * heapq.heappop(to_do)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

s = input()

li_1 = np.ones(len(s))

for i in range(1000):
    li_2 = np.zeros(len(s))
    for j in range(len(s)):
        if s[j] == 'R':
            li_2[j+1] += li_1[j]
        elif s[j] == 'L':
            li_2[j-1] += li_1[j]
    li_1 = li_2

for i in li_1:
    print(int(i), end=' ')


Fixed submission:
from math import ceil
from math import floor
import itertools

s = input()
n = len(s)
t = []

def output(r_cnt, l_cnt):
    global t
    r_num = ceil(r_cnt/2) + floor(l_cnt/2)
    l_num = ceil(l_cnt/2) + floor(r_cnt/2)
    x = [0 for _ in range(r_cnt + l_cnt)]
    x[r_cnt-1] = r_num
    x[r_cnt] = l_num
    t.append(x)


r_cnt = 0
l_cnt = 0
for i in range(n-1):
    if s[i] == 'R':
        r_cnt += 1
    elif s[i] == 'L':
        l_cnt += 1
    if s[i] == 'L' and s[i+1] =='R' or i == n-2:
        if i == n-2:
            l_cnt += 1
        output(r_cnt, l_cnt)
        r_cnt = 0
        l_cnt = 0


t = list(itertools.chain.from_iterable(t))
for i in t:
    print(i, end=' ')

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

li_1 = [1] * len(s)

for i in range(1000):
    li_2 = [0] * len(s)
    for j in range(len(s)):
        if s[j] == 'R':
            li_2[j+1] += li_1[j]
        elif s[j] == 'L':
            li_2[j-1] += li_1[j]
    li_1 = li_2

for i in li_1:
    print(i, end=' ')



Fixed submission:
from math import ceil
from math import floor
import itertools

s = input()
n = len(s)
t = []

def output(r_cnt, l_cnt):
    global t
    r_num = ceil(r_cnt/2) + floor(l_cnt/2)
    l_num = ceil(l_cnt/2) + floor(r_cnt/2)
    x = [0 for _ in range(r_cnt + l_cnt)]
    x[r_cnt-1] = r_num
    x[r_cnt] = l_num
    t.append(x)


r_cnt = 0
l_cnt = 0
for i in range(n-1):
    if s[i] == 'R':
        r_cnt += 1
    elif s[i] == 'L':
        l_cnt += 1
    if s[i] == 'L' and s[i+1] =='R' or i == n-2:
        if i == n-2:
            l_cnt += 1
        output(r_cnt, l_cnt)
        r_cnt = 0
        l_cnt = 0


t = list(itertools.chain.from_iterable(t))
for i in t:
    print(i, end=' ')

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

li_1 = [1] * len(s)

for i in range(10000):
    li_2 = [0] * len(s)
    for j in range(len(s)):
        if s[j] == 'R':
            li_2[j+1] += li_1[j]
        elif s[j] == 'L':
            li_2[j-1] += li_1[j]
    li_1 = li_2

for i in li_1:
    print(i, end=' ')


Fixed submission:
from math import ceil
from math import floor
import itertools

s = input()
n = len(s)
t = []

def output(r_cnt, l_cnt):
    global t
    r_num = ceil(r_cnt/2) + floor(l_cnt/2)
    l_num = ceil(l_cnt/2) + floor(r_cnt/2)
    x = [0 for _ in range(r_cnt + l_cnt)]
    x[r_cnt-1] = r_num
    x[r_cnt] = l_num
    t.append(x)


r_cnt = 0
l_cnt = 0
for i in range(n-1):
    if s[i] == 'R':
        r_cnt += 1
    elif s[i] == 'L':
        l_cnt += 1
    if s[i] == 'L' and s[i+1] =='R' or i == n-2:
        if i == n-2:
            l_cnt += 1
        output(r_cnt, l_cnt)
        r_cnt = 0
        l_cnt = 0


t = list(itertools.chain.from_iterable(t))
for i in t:
    print(i, end=' ')
Buggy python submission (verdict: Time Limit Exceeded):
a = list(range(13))
b = []
for i in a:
    num = int(str(i) + '0') % 13
    l = []
    for j in range(13):
        l.append((num+j)%13)
    b.append(l)

s = input()
MOD = 10**9+7
dp = [[0 for _ in range(13)] for _ in range(len(s))]
if s[0] == '?':
    for i in range(10):
        dp[0][i] += 1
else:
    dp[0][int(s[0])] += 1

for i in range(1, len(s)):
    if s[i] == '?':
        for j in range(13):
            for k in range(10):
                dp[i][b[j][k]] += dp[i-1][j]
                dp[i][b[j][k]] %= MOD
    else:
        for j in range(13):
            n = b[j][int(s[i])]
            dp[i][n] += dp[i-1][j]
            dp[i][n] %= MOD
print(dp[-1][5]%MOD)


Fixed submission:
a = list(range(13))
b = []
for i in a:
    num = int(str(i) + '0') % 13
    l = []
    for j in range(13):
        l.append((num+j)%13)
    b.append(l)

s = input()
MOD = 10**9+7
dp = [[0 for _ in range(13)] for _ in range(len(s))]
if s[0] == '?':
    for i in range(10):
        dp[0][i] += 1
else:
    dp[0][int(s[0])] += 1

for i in range(1, len(s)):
    if s[i] == '?':
        for j in range(13):
            for k in range(10):
                dp[i][b[j][k]] += dp[i-1][j]
                dp[i][b[j][k]] %= MOD
    else:
        for j in range(13):
            n = b[j][int(s[i])]
            dp[i][n] += dp[i-1][j]
            dp[i][n] %= MOD
print(dp[-1][5]%MOD)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

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

if n % 3 == 0 and len(set(a)) == 3:
    x = list(set(a))
    a = x[0]
    b = x[1]
    c = x[2]
    if a ^ b != c:
        print('No')
        exit()
    if b ^ c != a:
        print('No')
        exit()
    if c ^ a != b:
        print('No')
        exit()
    d = defaultdict(int)
    for i in a:
        d[i] += 1
    if d[a] != d[b] or d[b] != d[c] or d[c] != d[a]:
        print('No')
        exit()
    print('Yes')
elif n % 2 == 0 and len(set(a)) == 2:
    x = list(set(a))
    x.sort()
    if x[0] == 0:
        t = 1
    else:
        print('No')
        exit()
    d = defaultdict(int)
    for i in a:
        d[i] += 1
    if d[x[0]] != d[x[1]]:
        print('No')
        exit()
    print('Yes')
else:
    print('No')

Fixed submission:
from collections import defaultdict

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

if len(set(a)) == 1 and list(set(a))[0] == 0:
    print('Yes')
    exit()

if n % 3 == 0 and len(set(a)) == 3:
    x = list(set(a))
    e = x[0]
    b = x[1]
    c = x[2]
    if e ^ b != c:
        print('No')
        exit()
    if b ^ c != e:
        print('No')
        exit()
    if c ^ e != b:
        print('No')
        exit()
    d = defaultdict(int)
    for i in a:
        d[i] += 1
    if d[e] != d[b] or d[b] != d[c] or d[c] != d[e]:
        print('No')
        exit()
    print('Yes')
elif n % 3 == 0 and len(set(a)) == 2:
    x = list(set(a))
    x.sort()
    if x[0] == 0:
        t = 1
    else:
        print('No')
        exit()
    d = defaultdict(int)
    for i in a:
        d[i] += 1
    if d[x[0]]*2 == d[x[1]]:
        print('Yes')
        exit()
    print('No')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

target = sum(a)//2

a = np.array(a)
a = np.concatenate((a, a))
ans = []

for i in range(n):
    num = target
    b = a[i+1:i+n:2]
    num -= np.sum(b)
    ans.append(num*2)

for i in range(n):
    print(ans[i], end=' ')

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

target = sum(a)//2

b = a[1:n:2]
a.append(a[0])

ans = []
ans.append((target-sum(b))*2)

for i in range(n-1):
    num = a[i] - ans[i]//2
    ans.append(num*2)

for i in range(n):
    print(ans[i], end=' ')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

target = sum(a)//2

a = np.array(a)
a = np.concatenate((a, a))

for i in range(n):
    num = target
    for j in range(n//2):
        num -= a[i + 2*j + 1]
    print(num*2)


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

target = sum(a)//2

b = a[1:n:2]
a.append(a[0])

ans = []
ans.append((target-sum(b))*2)

for i in range(n-1):
    num = a[i] - ans[i]//2
    ans.append(num*2)

for i in range(n):
    print(ans[i], end=' ')
Buggy python submission (verdict: Runtime Error):
import math

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

# 最小公倍数を求める
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def cal(num, a, b):
    x = num // a
    y = num // b
    z = num // (lcm(a, b))
    print('z={}'.format(z))
    return num - (x + y - z)

num_a = cal(b, c, d)
num_b = cal(a-1, c, d)

print(num_a - num_b)


Fixed submission:
import fractions

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

# 最小公倍数を求める
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def cal(num, a, b):
    x = num // a
    y = num // b
    z = num // (lcm(a, b))
    return num - (x + y - z)

num_a = cal(b, c, d)
num_b = cal(a-1, c, d)

print(num_a - num_b)

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

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


num_b = b - (b // c) - (b // d) + (b // (c * d / math.gcd(c, d)))
num_a = a - 1 - ((a - 1 ) // c) - ((a - 1) // d) + ((a - 1) // (c * d / math.gcd(c, d)))
num = num_b - num_a

print(int(num))


Fixed submission:
import fractions

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

# 最小公倍数を求める
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def cal(num, a, b):
    x = num // a
    y = num // b
    z = num // (lcm(a, b))
    return num - (x + y - z)

num_a = cal(b, c, d)
num_b = cal(a-1, c, d)

print(num_a - num_b)

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:
        if i % D != 0:
             count += 1

print(count)

Fixed submission:
import fractions

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

# 最小公倍数を求める
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def cal(num, a, b):
    x = num // a
    y = num // b
    z = num // (lcm(a, b))
    return num - (x + y - z)

num_a = cal(b, c, d)
num_b = cal(a-1, c, d)

print(num_a - num_b)

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())

# 最小公倍数を求める
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def cal(num, a, b):
    x = num // a
    y = num // b
    z = num // (lcm(a, b))
    return num - (x + y - z)

num_a = cal(b, c, d)
num_b = cal(a-1, c, d)

print(num_a - num_b)
Buggy python submission (verdict: Runtime Error):
n, a, b, c, d = map(int, input().split())
s = list(input())

def check():
    for i in range(a-1, d):
        if s[i-1] == s[i] == '#':
            return False
    return True


def check_2():
    for i in range(b-1, c):
        if s[i-1] == s[i] == s[i+1] == ".":
            return True
    return False


if check() is True:
    if c < d:
        print('Yes')
        exit()
    else:
        if check_2() is True:
            print('Yes')
            exit()
print('No')


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

def check_twice(left, right, l):
    for i in range(left-1, right):
        if l[i] == '#' and l[i+1] == '#':
            return False
    return True

def check_triple(left, right, l):
    f = False
    for i in range(left-1, right-2):
        if l[i] == '.' and l[i+1] == '.' and l[i+2] == '.':
            f = True
            break
        else:
            continue
    return f

if c < d:
    flg = check_twice(a, c, s) & check_twice(b, d, s)
    if flg is True:
        print('Yes')
    else:
        print('No')

else:
    flg = check_twice(a, c, s) & check_triple(b-1, d+1, s)
    if flg is True:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, k = map(int, input().split())

value = np.array(list(map(int, input().split())))
r_value = value[::-1]

max_value = max(value[0], r_value[0])
for i in range(1, k):
    total_value = 0
    if i > n:
        s = value
        s.sort()
        s = list(s)
        for j in range(k-n):
            if s[0] < 0:
                s.pop(0)
        total_value = sum(s)
    else:
        for j in range(i+1):
            a = value[0:j]
            b = r_value[0:i-j]
            c = np.concatenate((a, b))
            c.sort()
            c = list(c)
            for l in range(k-i):
                if c[0] < 0:
                    c.pop(0)
                if c == []:
                    break
            total_value = sum(c)
            if total_value > max_value:
                max_value = total_value
print(max_value)

Fixed submission:
import numpy as np

n, k = map(int, input().split())

value = np.array(list(map(int, input().split())))
r_value = value[::-1]

max_value = max(value[0], r_value[0])
for i in range(1, k):
    total_value = 0
    if i > n:
        s = value
        s.sort()
        s = list(s)
        for j in range(k-n):
            if s[0] < 0:
                s.pop(0)
        total_value = sum(s)
    else:
        for j in range(i+1):
            a = value[0:j]
            b = r_value[0:i-j]
            c = np.concatenate((a, b))
            c.sort()
            c = list(c)
            for l in range(k-i):
                if c[0] < 0:
                    c.pop(0)
                if c == []:
                    break
            total_value = sum(c)
            if total_value > max_value:
                max_value = total_value
print(max_value)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

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

l = []
l2 = []
count = 0

for i in range(m):
    array = list(map(int, input().split()))
    l.append(array)

for i in range(m):
    for j in range(l[i][0], l[i][1]+1):
        l2.append(j)

c = collections.Counter(l2)
d = sorted(list(c.values()),reverse=True)

for i in d:
    if i == m:
        count += 1

print(count)


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

x = []
y = []

for i in range(m):
    array = list(map(int, input().split()))
    x.append(array[0])
    y.append(array[1])

a = max(x[:])
b = min(y[:])

print(len(list(range(a, b+1))))
Buggy python submission (verdict: Runtime Error):
n = int(input())
edges = [[] for _ in range(n+1)]
colors = [None] * (n+1)

for i in range(n-1):
    u, v, w = [int(x) for x in input().split()]
    if w & 1 == 0:
        edges[u].append((v, 0))
        edges[v].append((u, 0))
    else:
        edges[u].append((v, 1))
        edges[v].append((u, 1))

colors[1] = 0


def color(node, c):
    colors[node] = c
    for i, j in edges[node]:
        if colors[i] is None:
            new_color = (c + j)%2
            color(i, new_color)

color(1,1)

for i in colors[1:]:
    print(i)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
edges = [[] for _ in range(n+1)]
colors = [None] * (n+1)

for i in range(n-1):
    u, v, w = [int(x) for x in input().split()]
    if w & 1 == 0:
        edges[u].append((v, 0))
        edges[v].append((u, 0))
    else:
        edges[u].append((v, 1))
        edges[v].append((u, 1))

colors[1] = 0


def color(node, c):
    colors[node] = c
    for i, j in edges[node]:
        if colors[i] is None:
            new_color = (c + j)%2
            color(i, new_color)

color(1,1)

for i in colors[1:]:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())
searching = deque()
searched = deque()


def flatten(data):
    for item in data:
        if hasattr(item, '__iter__'):
            for element in flatten(item):
                yield element
        else:
            yield item


distance_matrix = [[-1 for _ in range(n)] for _ in range(n)]
for i in range(n):
    distance_matrix[i][i] = 0
distance_from_one = [0 for _ in range(n)]
tree = [[] for _ in range(n)]

for i in range(n-1):
    array = list(map(int, input().split()))
    x = array[0]
    y = array[1]
    z = array[2]
    distance_matrix[x-1][y-1] = z
    distance_matrix[y-1][x-1] = z
    tree[x-1].append(y-1)
    tree[y-1].append(x-1)
for i in tree[0]:
    searching.append(i)
    distance_from_one[i] = distance_matrix[0][i]
searched.append(0)


while len(searching) != 0:
    node = searching.popleft()
    if node not in searched:
        searched.append(node)
        for node_2 in tree[node]:
            if node_2 not in searching and node_2 not in searched:
                distance_from_one[node_2] = distance_from_one[node] + distance_matrix[node][node_2]
                searching.append(node_2)

for i in distance_from_one:
    if i%2 == 0:
        print(1)
    else:
        print(0)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
edges = [[] for _ in range(n+1)]
colors = [None] * (n+1)

for i in range(n-1):
    u, v, w = [int(x) for x in input().split()]
    if w & 1 == 0:
        edges[u].append((v, 0))
        edges[v].append((u, 0))
    else:
        edges[u].append((v, 1))
        edges[v].append((u, 1))

colors[1] = 0


def color(node, c):
    colors[node] = c
    for i, j in edges[node]:
        if colors[i] is None:
            new_color = (c + j)%2
            color(i, new_color)

color(1,1)

for i in colors[1:]:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())

count = 0

for i in range((n//r)+1):
    for j in range((n//g)+1):
        rg = i * r + j * g
        rest = n - rg
        if rest < 0:
            continue
        elif rest == 0:
            count += 1
        elif rest % b == 0:
            count += 1

print(count)

Fixed submission:
r, g, b, n = map(int, input().split())

count = 0
a = n // r
t = n // g

for i in range(a+1):
    for j in range(t+1):
        rg = i * r + j * g
        rest = n - rg
        if rest < 0:
            continue
        elif rest % b == 0:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
import fractions

n = int(input())
a = list(map(int, input().split()))
b = a[::-1]

left = [0, a[0]]
right = [0, b[0]]
l = a[0]
r = b[0]
for i in range(1, n):
    l = fractions.gcd(l, a[i])
    r = fractions.gcd(r, b[i])
    left.append(l)
    right.append(r)

gcd_max = 0
for i in range(n+1):
    gcd_tmp = gcd(left[i], right[n-i-1])
    if gcd_tmp > gcd_max:
        gcd_max = gcd_tmp

print(gcd_max)


Fixed submission:
import fractions

n = int(input())
a = list(map(int, input().split()))
b = a[::-1]

left = [0, a[0]]
right = [0, b[0]]
l = a[0]
r = b[0]
for i in range(1, n):
    l = fractions.gcd(l, a[i])
    r = fractions.gcd(r, b[i])
    left.append(l)
    right.append(r)

gcd_max = 0
for i in range(n+1):
    gcd_tmp = fractions.gcd(left[i], right[n-i-1])
    if gcd_tmp > gcd_max:
        gcd_max = gcd_tmp

print(gcd_max)

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

n = int(input())
a = list(map(int, input().split()))
b = a[::-1]

left = [0, a[0]]
right = [0, b[0]]
l = a[0]
r = b[0]
for i in range(1, n):
    l = gcd(l, a[i])
    r = gcd(r, b[i])
    left.append(l)
    right.append(r)

gcd_max = 0
for i in range(n+1):
    gcd_tmp = gcd(left[i], right[n-i-1])
    if gcd_tmp > gcd_max:
        gcd_max = gcd_tmp

print(gcd_max)


Fixed submission:
import fractions

n = int(input())
a = list(map(int, input().split()))
b = a[::-1]

left = [0, a[0]]
right = [0, b[0]]
l = a[0]
r = b[0]
for i in range(1, n):
    l = fractions.gcd(l, a[i])
    r = fractions.gcd(r, b[i])
    left.append(l)
    right.append(r)

gcd_max = 0
for i in range(n+1):
    gcd_tmp = fractions.gcd(left[i], right[n-i-1])
    if gcd_tmp > gcd_max:
        gcd_max = gcd_tmp

print(gcd_max)