Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
nums = [n for n in input()]
ope = ["+", "-"]
for b in range(2 ** 3):
    temp = nums[0]
    for i in range(3):
        temp += ope[b & (1 << i)] + nums[i + 1]
    if eval(temp) == 7:
        print(temp+"=7")
        break

Fixed submission:
target = input()
length = len(target)
binary = length - 1
target_list = []
for i in range(length):
    if i:
        target_list.append("")
    target_list.append(target[i])
for bit in range(binary ** 2):
    temp = target_list.copy()
    for i in range(binary):
        if bit & (1 << i):
            temp[1 + 2 * i] = "+"
        else:
            temp[1 + 2 * i] = "-"
    temp = "".join(temp)
    if eval(temp) == 7:
        print(temp + "=7")
        break

Buggy python submission (verdict: Runtime Error):
nums = [n for n in input()]
ope = ["+", "-"]
for b in range(2 ** 3):
    temp = nums[0]
    for i in range(3):
        temp += f"{ope[b & (1 << i)]}{nums[i + 1]}"
    if eval(temp) == 7:
        print(temp+"=7")
        break

Fixed submission:
target = input()
length = len(target)
binary = length - 1
target_list = []
for i in range(length):
    if i:
        target_list.append("")
    target_list.append(target[i])
for bit in range(binary ** 2):
    temp = target_list.copy()
    for i in range(binary):
        if bit & (1 << i):
            temp[1 + 2 * i] = "+"
        else:
            temp[1 + 2 * i] = "-"
    temp = "".join(temp)
    if eval(temp) == 7:
        print(temp + "=7")
        break

Buggy python submission (verdict: Runtime Error):
nums = [n for n in input()]
ope = ["+", "-"]
for b in range(2 ** 3):
    temp = nums[0]
    for i in range(3):
        temp += f"{ope[b & (1 << i)]}{nums[i + 1]}"
    if eval(temp) == 7:
        print(temp)
        break

Fixed submission:
target = input()
length = len(target)
binary = length - 1
target_list = []
for i in range(length):
    if i:
        target_list.append("")
    target_list.append(target[i])
for bit in range(binary ** 2):
    temp = target_list.copy()
    for i in range(binary):
        if bit & (1 << i):
            temp[1 + 2 * i] = "+"
        else:
            temp[1 + 2 * i] = "-"
    temp = "".join(temp)
    if eval(temp) == 7:
        print(temp + "=7")
        break
Buggy python submission (verdict: Runtime Error):
def dfs(people, sports, use_sports, answer):
    rank = [0 for n in range(sports)]
    for p in range(people):
        for s in (preference[p]):
            if s in use_sports:
                rank[s] += 1
                break
            will_delete = []
    max_p = max(rank)
    exclude = rank.index(max_p)
    answer = min(answer, max_p, dfs(people, sports, use_sports - {exclude}, answer))
    return answer

people, sports = (int(n) for n in input().split(" "))
preference = []
for _ in range(people):
    pre = [int(n) for n in input().split(" ")]
    preference.append(pre)
answer = float("inf")
use_sports = {n for n in range(sports)}
print(dfs(people, sports, use_sports, answer))


Fixed submission:
def dfs(people, sports, use_sports, answer):
    rank = [0 for n in range(sports)]
    for p in range(people):
        for s in (preference[p]):
            if s in use_sports:
                rank[s] += 1
                break
            will_delete = []
    max_p = max(rank)
    exclude = rank.index(max_p)
    if len(use_sports) > 1:
        answer = min(answer, dfs(people, sports, use_sports - {exclude}, answer))
    answer = min(answer, max_p)
    return answer

people, sports = (int(n) for n in input().split(" "))
preference = []
for _ in range(people):
    pre = [int(n) - 1 for n in input().split(" ")]
    preference.append(pre)
answer = float("inf")
use_sports = {n for n in range(sports)}
print(dfs(people, sports, use_sports, answer))
Buggy python submission (verdict: Runtime Error):
target = input()
length = len(target)
binary = length - 1
target_list = []
answers = 0
for i in range(length):
    if i:
        target_list.append("")
    target_list.append(target[i])
for bit in range(2 ** binary):
    temp = target_list.copy()
    for i in range(binary):
        if bit & (1 << i):
            temp[1 + 2 * i] = "+"
    # print(temp, bit)
    answers += eval("".join(temp))
print(answers)

Fixed submission:
target = input()
length = len(target)
binary = length - 1
target_list = []
answers = 0
for i in range(length):
    if i:
        target_list.append("")
    target_list.append(target[i])
for bit in range(2 ** binary):
    temp = target_list.copy()
    for i in range(binary):
        if bit & (1 << i):
            temp[1 + 2 * i] = "+"
    # print(temp, bit)
    answers += eval("".join(temp))
print(answers)
Buggy python submission (verdict: Runtime Error):
loop, magic_cost = map(int, input().split(" "))
cost = [n for n in map(int, input().split(" "))]
answer = float("inf")
min_costs = [float(inf) for n in range(loop)]
for i in range(loop):
    for j in range(loop):
        min_costs[j] = min(min_costs[j], cost[(i - j) % loop])
    answer = min(answer, sum(min_costs) + (magic_cost * (i) ) )
print(answer)

Fixed submission:
loop, magic_cost = map(int, input().split(" "))
cost = [n for n in map(int, input().split(" "))]
answer = float("inf")
min_costs = [float("inf") for n in range(loop)]
for i in range(loop):
    for j in range(loop):
        min_costs[j] = min(min_costs[j], cost[(i - j) % loop])
    answer = min(answer, sum(min_costs) + (magic_cost * (i) ) )
print(answer)
Buggy python submission (verdict: Runtime Error):
s=input()
print(s-"FESTIVAL")

Fixed submission:
s=input()
print(s[:-8])
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K, M = map(int,input().split())
A = list(map(int,input().split()))
A = np.array(A)
if M*N-np.mean(A)*(N-1) < 0:
    print(0)
elif M*N-np.mean(A)*(N-1)<K:
    print(Decimal(str(M*N-np.mean(A)*(N-1))).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
else:
    print(-1)



Fixed submission:
x = input()
if x =='a':
    print('b')
if x =='b':
    print('c')
if x =='c':
    print('d')
if x =='d':
    print('e')
if x =='e':
    print('f')
if x =='f':
    print('g')
if x =='g':
    print('h')
if x =='h':
    print('i')
if x =='i':
    print('j')
if x =='j':
    print('k')
if x =='k':
    print('l')
if x =='l':
    print('m')
if x =='m':
    print('n')
if x =='n':
    print('o')
if x =='o':
    print('p')
if x =='p':
    print('q')
if x =='q':
    print('r')
if x =='r':
    print('s')
if x =='s':
    print('t')
if x =='t':
    print('u')
if x =='u':
    print('v')
if x =='v':
    print('w')
if x =='w':
    print('x')
if x =='x':
    print('y')
if x =='y':
    print('z')

Buggy python submission (verdict: Runtime Error):
nput()
if x =='a':
    print('b')
if x =='b':
    print('c')
if x =='c':
    print('d')
if x =='d':
    print('e')
if x =='e':
    print('f')
if x =='f':
    print('g')
if x =='g':
    print('h')
if x =='h':
    print('i')
if x =='i':
    print('j')
if x =='j':
    print('k')
if x =='k':
    print('l')
if x =='l':
    print('m')
if x =='m':
    print('n')
if x =='n':
    print('o')
if x =='o':
    print('p')
if x =='p':
    print('q')
if x =='q':
    print('r')
if x =='r':
    print('s')
if x =='s':
    print('t')
if x =='t':
    print('u')
if x =='u':
    print('v')
if x =='v':
    print('w')
if x =='w':
    print('x')
if x =='x':
    print('y')
if x =='y':
    print('z')


Fixed submission:
x = input()
if x =='a':
    print('b')
if x =='b':
    print('c')
if x =='c':
    print('d')
if x =='d':
    print('e')
if x =='e':
    print('f')
if x =='f':
    print('g')
if x =='g':
    print('h')
if x =='h':
    print('i')
if x =='i':
    print('j')
if x =='j':
    print('k')
if x =='k':
    print('l')
if x =='l':
    print('m')
if x =='m':
    print('n')
if x =='n':
    print('o')
if x =='o':
    print('p')
if x =='p':
    print('q')
if x =='q':
    print('r')
if x =='r':
    print('s')
if x =='s':
    print('t')
if x =='t':
    print('u')
if x =='u':
    print('v')
if x =='v':
    print('w')
if x =='w':
    print('x')
if x =='x':
    print('y')
if x =='y':
    print('z')
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())

for i in range(int(math.sqrt(n)), 0, -1):
    if n % i == 0:
        num = i
        break
        
ans = int(num -1 + (n / num) -1)
print(ans)

Fixed submission:
ab = list(map(int, input().split()))
if ab[0] < 10 and ab[1] < 10:
    print(ab[0] * ab[1])
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
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
  
ans = n
yakusuu = make_divisors(n)
for i in range(0 ,len(yakusuu), 2):
    kari = yakusuu[i] -1 + yakusuu[i+1]-1
    if (ans > kari):
        ans = kari
print(ans)

Fixed submission:
ab = list(map(int, input().split()))
if ab[0] < 10 and ab[1] < 10:
    print(ab[0] * ab[1])
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
r = int(math.sqrt(n))
num = [i for i in range(1, r) if n % i == 0]
num = max(num)
ans = int(num -1 + (n / num) -1)
print(ans)

Fixed submission:
import math
n = int(input())
num = math.sqrt(n)

l = []
for i in range(1,int(num+1)):
    if n % i == 0:
        l.append(i)
ans = int(n/max(l)) -1 + int(max(l)) - 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
num = 1
for i in range(1, int(np.sqrt(n))):
    if n % i == 0:
        num = i
ans = int(num -1 + (n / num) -1)
print(ans)

Fixed submission:
import math
n = int(input())
num = math.sqrt(n)

l = []
for i in range(1,int(num+1)):
    if n % i == 0:
        l.append(i)
ans = int(n/max(l)) -1 + int(max(l)) - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
if s == "Sunny":
    print("Cloudy")
else if s == "Cloudy":
    print("Rainy"):
else:
    print("Sunny")

Fixed submission:
s = input()
d = {"Sunny": "Cloudy", "Cloudy": "Rainy",  "Rainy": "Sunny"}
print(d[s])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
nkq = list(map(int, input().split()))

n = nkq[0]
k = nkq[1]
q = nkq[2]
aes = []
for _ in range(q):
    aes.append(int(input()))
    
    
points = np.ones(n) * k
for a in aes:
    points = points -1
    points[a-1] = points[a-1] + 1
    
    
for p in points:
    if p > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
import numpy as np
nkq = list(map(int, input().split()))


n = nkq[0]
k = nkq[1]
q = nkq[2]
aes = []
for _ in range(q):
    aes.append(int(input()))
    


points = np.zeros(n)  + (k - q)
for a in aes:
    points[a-1] = points[a-1] + 1

for p in points:
    if p > 0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
nkq = list(map(int, input().split()))
n = nkq[0]
k = nkq[1]
q = nkq[2]
aes = []
for _ in range(q):
    aes.append(int(input()))

points = [k] * n
for a in aes:
    points =list(map(lambda p: p-1, points))
    points[a-1] = points[a-1] + 1
    
answer = [ "Yes" if p >0  else "No" for p in points]
for ans in answer:
    print(ans)

Fixed submission:
import numpy as np
nkq = list(map(int, input().split()))


n = nkq[0]
k = nkq[1]
q = nkq[2]
aes = []
for _ in range(q):
    aes.append(int(input()))
    


points = np.zeros(n)  + (k - q)
for a in aes:
    points[a-1] = points[a-1] + 1

for p in points:
    if p > 0:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
nkq = list(map(int, input().split()))
n = nkq[0]
k = nkq[1]
q = nkq[2]
aes = []
for _ in range(q):
    aes.append(int(input()))

points = [k] * n
for a in aes:
    for i in range(n):
        if (a-1) == i:
            points[i] = points[i]
        else:
            points[i] = points[i] -1
for i in range(n):
    if points[i] > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
import numpy as np
nkq = list(map(int, input().split()))


n = nkq[0]
k = nkq[1]
q = nkq[2]
aes = []
for _ in range(q):
    aes.append(int(input()))
    


points = np.zeros(n)  + (k - q)
for a in aes:
    points[a-1] = points[a-1] + 1

for p in points:
    if p > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
vn = list(map(int, input().split())).sort()

sumV = vn[0]

for v in vn[1:]:
    sumV = (sumV + v)/2
print(sumV)

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

vn.sort()
sumV = vn[0]

for v in vn[1:]:
    sumV = (sumV + v)/2
print(sumV)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
l = lr[0]
r = lr[1]
 
ans=2019
l_2019 = l % 2019
r_2019 = r % 2019
 
for i in range(l_2019,r_2019):
    for j in range(i+1, r_2019+1):
        new_ans = (i * j) % 2019
        if new_ans < ans:
            ans = new_ans
        
print(ans)

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

l = lr[0]
r = lr[1]

ans=2018
tr=min(2019, r-l)
for i in range(l, l+tr):
    for j in range(l+1, l+tr+1):
        ans = min(ans, (i*j)%2019)
        
        
print(ans)

Buggy python submission (verdict: Runtime Error):
l = lr[0]
r = lr[1]
 
ans=2019
l_2019 = l % 2019
r_2019 = r % 2019
 
for i in range(l_2019,r_2019):
    for j in range(i+1, r_2019+1):
        new_ans = (i * j) % 2019
        if new_ans < ans:
            ans = new_ans
        
print(ans)

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

l = lr[0]
r = lr[1]

ans=2018
tr=min(2019, r-l)
for i in range(l, l+tr):
    for j in range(l+1, l+tr+1):
        ans = min(ans, (i*j)%2019)
        
        
print(ans)
Buggy python submission (verdict: Runtime Error):
nx = list(map(int, input().split()))
ln = list(map(int, input().split()))
n = nx[0]
x = nx[1]

dn = 0
count = 1
for i in range(0, n+1, 1):
    dn += ln[i]
    if dn > x:
        break
    count += 1
print(count)

Fixed submission:
nx = list(map(int, input().split()))
ln = list(map(int, input().split()))
n = nx[0]
x = nx[1]

dn = 0
count = 1
for i in range(0, n, 1):
    dn += ln[i]
    if dn > x:
        break
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
wn = list(map(int, input().split()))
 
mini = math.inf
for i in range(n-1):
    new_mini = abs(sum(wn[:i+1]) -sum(wn[i+1:]))
    if new_mini < mini:
        mini = new_mini
print(mini)

Fixed submission:
import math
 
n = int(input())
wn = list(map(int, input().split()))
 
mini = 10000000000
for i in range(n-1):
    new_mini = abs(sum(wn[:i+1]) -sum(wn[i+1:]))
    if new_mini < mini:
        mini = new_mini
print(mini)

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


import math
mini = math.inf
for i in range(n-1):
    new_mini = abs(sum(wn[:i+1]) -sum(wn[i+1:]))
    if new_mini < mini:
        mini = new_mini
print(mini)

Fixed submission:
import math
 
n = int(input())
wn = list(map(int, input().split()))
 
mini = 10000000000
for i in range(n-1):
    new_mini = abs(sum(wn[:i+1]) -sum(wn[i+1:]))
    if new_mini < mini:
        mini = new_mini
print(mini)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
wn = list(map(int, input().split()))
 
    
mini = math.inf
for i in range(n-1):
    new_mini = abs(sum(wn[:i]) -sum(wn[i:]))
    if new_mini < mini:
        mini = new_mini
print(mini)

Fixed submission:
import math
 
n = int(input())
wn = list(map(int, input().split()))
 
mini = 10000000000
for i in range(n-1):
    new_mini = abs(sum(wn[:i+1]) -sum(wn[i+1:]))
    if new_mini < mini:
        mini = new_mini
print(mini)

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


mini = math.inf
for i in range(n-1):
    new_mini = abs(sum(wn[:i]) -sum(wn[i:]))
    if new_mini < mini:
        mini = new_mini
print(mini)

Fixed submission:
import math
 
n = int(input())
wn = list(map(int, input().split()))
 
mini = 10000000000
for i in range(n-1):
    new_mini = abs(sum(wn[:i+1]) -sum(wn[i+1:]))
    if new_mini < mini:
        mini = new_mini
print(mini)
Buggy python submission (verdict: Runtime Error):
NK = input()
NK = N.split(" ")
N = int(NK[0])
K = int(NK[1])


h = []
for i in range(N):
  h.append(int(input()))
  
  
h.sort()
ans = h[-1] - h[0]

for i in range(N-K+1):
  ans = min(ans, h[i+K-1] - h[i])
print(ans)

Fixed submission:
d = int(input())

if d == 25:
  print("Christmas")
elif d == 24:
  print("Christmas Eve")
elif d == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

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


p = []
for i in range(N):
  p.append(int(input()))
  
p_max = p.index(max(p))


p[p_max] = p[p_max] / 2 

print(int(sum(p)))

Fixed submission:
d = int(input())

if d == 25:
  print("Christmas")
elif d == 24:
  print("Christmas Eve")
elif d == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

Buggy python submission (verdict: Runtime Error):
D = int(input())

if D == 25:
 print("Christmas")
else if D == 24:
 print("Christmas Eve")
else if D== 23:
 print("Christmas Eve Eve")
else:
 print("Christmas Eve Eve Eve")

Fixed submission:
d = int(input())

if d == 25:
  print("Christmas")
elif d == 24:
  print("Christmas Eve")
elif d == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
NK = input()
NK = N.split(" ")
N = int(NK[0])
K = int(NK[1])

h = []
for i in range(N):
  h.append(int(input()))
  
  
h.sort()
ans = h[-1] - h[0]

for i in range(N-K+1):
  ans = min(ans, h[i+K-1] - h[i])
print(ans)

Fixed submission:
NK = input()
NK = NK.split(" ")
N = int(NK[0])
K = int(NK[1])


h = []
for i in range(N):
  h.append(int(input()))
  
  
h.sort()
ans = h[-1] - h[0]

for i in range(N-K+1):
  ans = min(ans, h[i+K-1] - h[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
NK = input()
NK = N.split(" ")
N = int(NK[0])
K = int(NK[1])


h = []
for i in range(N):
  h.append(int(input()))
  
  
h.sort()
ans = h[-1] - h[0]

for i in range(N-K+1):
  ans = min(ans, h[i+K-1] - h[i])
print(ans)

Fixed submission:
NK = input()
NK = NK.split(" ")
N = int(NK[0])
K = int(NK[1])


h = []
for i in range(N):
  h.append(int(input()))
  
  
h.sort()
ans = h[-1] - h[0]

for i in range(N-K+1):
  ans = min(ans, h[i+K-1] - h[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
NK = input()
NK = N.split(" ")
N = int(NK[0])
K = int(NK[1])

h = []
for i in range(N):
  h.append(int(input()))
    
h.sort()
ans = h[-1] - h[0]

for i in range(N-K+1):
  ans = min(ans, h[i-K+1] - h[i])
print(ans)

Fixed submission:
NK = input()
NK = NK.split(" ")
N = int(NK[0])
K = int(NK[1])


h = []
for i in range(N):
  h.append(int(input()))
  
  
h.sort()
ans = h[-1] - h[0]

for i in range(N-K+1):
  ans = min(ans, h[i+K-1] - h[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = (int(_) for _ in input().split())
a = [int(input()) for _ in range(q)]

for i in range(1, n+1):
    print('Yes' if k - q + a.count(i) > 0 else 'No')


Fixed submission:
n, k, q = (int(_) for _ in input().split())

a = [k-q] * (n+1)
for i in range(q):
    a[int(input())] += 1

for i in range(1, n+1):
    print('Yes' if a[i] > 0 else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
s = [collections.Counter(input()) for _ in range(n)]
ans = 0

for i, e1 in enumerate(s):
    for e2 in s[i+1:]:
        if e1 == e2:
            ans += 1

print(ans)


Fixed submission:
n = int(input())
s = {}
ans = 0

for i in range(n):
    e = ''.join(sorted(input()))
    s[e] = s.get(e, 0) + 1

for e in s.values():
    ans += e*(e-1) // 2
print(ans)

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

n = int(input())
s = [input() for _ in range(n)]
ans = 0

for i, e1 in enumerate(s):
    for e2 in s[i+1:]:
        if collections.Counter(e1) == collections.Counter(e2):
            ans += 1

print(ans)


Fixed submission:
n = int(input())
s = {}
ans = 0

for i in range(n):
    e = ''.join(sorted(input()))
    s[e] = s.get(e, 0) + 1

for e in s.values():
    ans += e*(e-1) // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]

for i in range(m):
    b, c = [int(_) for _ in input().split()]
    a.extend([c for _ in range(b)])

a.sort(reverse=True)
print(sum(a[:n]))


Fixed submission:
n, m = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]
a.sort(reverse=True)

s = []
for i in range(m):
    s.append([int(_) for _ in input().split()])
s.append([0,0])
s.sort(reverse=True, key=lambda x:x[1])

ida = 0
ids = 0
ans = 0
cnt = 0
while cnt < n:
    if a[ida] >= s[ids][1]:
        ans += a[ida]
        ida += 1
        cnt += 1
    else:
        an = min(n - cnt, s[ids][0])
        ans += s[ids][1] * an
        ids += 1
        cnt += an
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce

n = int(input())
a = [int(_) for _ in input().split()]
ans = 0

for i in range(n):
    r = reduce(fractions.gcd, a[:i] + a[i+1:])
    if ans < r:
        ans = r

print(ans)


Fixed submission:
import fractions
from functools import reduce

n = int(input())
a = [int(_) for _ in input().split()]
left, right, ans = ([0], [0], 0)

for i in range(n):
    left.append(fractions.gcd(left[i], a[i]))
    right.append(fractions.gcd(right[i], a[n-i-1]))

for i in range(n):
    g = fractions.gcd(left[i], right[n-i-1])
    if ans < g:
        ans = g

print(ans)

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

n = int(input())
a = [int(_) for _ in input().split()]
ans = 0

for i in range(n):
    r = reduce(math.gcd, a[:i] + a[i+1:])
    if ans < r:
        ans = r

print(ans)


Fixed submission:
import fractions
from functools import reduce

n = int(input())
a = [int(_) for _ in input().split()]
left, right, ans = ([0], [0], 0)

for i in range(n):
    left.append(fractions.gcd(left[i], a[i]))
    right.append(fractions.gcd(right[i], a[n-i-1]))

for i in range(n):
    g = fractions.gcd(left[i], right[n-i-1])
    if ans < g:
        ans = g

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = [int(_) for _ in input().split()]
s = input()
x = []

cnt = 0
c0 = '1'
for c in s:
    if c == c0:
        cnt += 1
    else:
        x.append(cnt)
        c0 = c
        cnt = 1
else:
    if cnt != 0:
        x.append(cnt)

if s[-1] == '0':
        x.append(0)

if len(x) <= k*2+1:
    print(sum(x))
else:
    y = [sum(x[i:i+k*2+1]) for i in range(0,len(x)-k*2,2)]
    print(max(y))


Fixed submission:
n, k = [int(_) for _ in input().split()]
s = input()
x = []

cnt = 0
c0 = '1'
for c in s:
    if c == c0:
        cnt += 1
    else:
        x.append(cnt)
        c0 = c
        cnt = 1
else:
    if cnt != 0:
        x.append(cnt)

if s[-1] == '0':
        x.append(0)

if len(x) <= k*2+1:
    print(sum(x))
else:
    y = sum(x[0:k*2+1])
    ans = y
    for i in range(2,len(x)-k*2,2):
        y = y - sum(x[i-2:i]) + sum(x[i+2*k-1:i+2*k+1])
        if ans < y:
            ans = y
    print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = [int(_) for _ in input().split())]
print('Yay!' if a <= 8 and b <= 8 else ':()')


Fixed submission:
a, b = [int(_) for _ in input().split()]
print('Yay!' if a <= 8 and b <= 8 else ':(')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] + [int(input()) for _ in range(n)]

pos = 1
cnt = 0
while True:
    cnt += 1
    if a[pos] == 1:
        print(-1)
        break
    elif a[pos] == 2:
        print(cnt)
        break
    pos = a[pos]


Fixed submission:
n = int(input())
a = [0] + [int(input()) for _ in range(n)]

pos = 1
for i in range(n):
    pos = a[pos]
    if pos == 2:
        print(i+1)
        break
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
i = lambda: int(input())
print(len(set([i(), i(), i()])))


Fixed submission:
print(len(set((int(i) for i in input().split()))))