Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S = input()
A = S.split()

for i in A:
    if A[i] == A[i + 1]:
        print('Bad')
    else:
        print('Good')


Fixed submission:
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')
else:
    print('Good')

Buggy python submission (verdict: Runtime Error):
S = str(input())
A = S.split()

for i in A:
    if A[i] == A[i + 1]:
        print('Bad')
    else:
        print('Good')


Fixed submission:
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')
else:
    print('Good')

Buggy python submission (verdict: Runtime Error):
S = str(input())
A = S.split()

for i in range(A):
    if A[i]=A[i+1]:
        print('Bad')
    else:
        print('Good')


Fixed submission:
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')
else:
    print('Good')

Buggy python submission (verdict: Runtime Error):
S = str(input())
A = S.split()

for i in A:
    if A[i]=A[i+1]:
        print('Bad')
    else:
        print('Good')


Fixed submission:
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')
else:
    print('Good')

Buggy python submission (verdict: Runtime Error):
S = input()
A = S.split()

for i in A:
    if A[i]=A[i+1]:
        print('Bad')
    else:
        print('Good')


Fixed submission:
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')
else:
    print('Good')
Buggy python submission (verdict: Runtime Error):
T=[(map(int,input().split()))]
T.sort()
print(T[0]+T[1])

Fixed submission:
T=list(map(int,input().split()))
T.sort()
print(T[0]+T[1])

Buggy python submission (verdict: Runtime Error):
P,Q,R=map(int,input().split())
T=list(P,Q,R)
T.sort()
print(T[0]+T[1])

Fixed submission:
T=list(map(int,input().split()))
T.sort()
print(T[0]+T[1])

Buggy python submission (verdict: Runtime Error):
T=[map(int,input().split())]
T.sort()
print(T[0]+T[1])


Fixed submission:
T=list(map(int,input().split()))
T.sort()
print(T[0]+T[1])
Buggy python submission (verdict: Runtime Error):
N = input()
K = input()
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
S = [input()]

S[K - 1] = S[K - 1].lower()
print(''.join(S))


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
s = [str(i) for i in range(n)]

sl = s[k]
sk = sl.lower()
print(sk)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
s = list(str(n) for n input().split())

s = s[k]
s = s.lower()
print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
s = list(str(i) for i input().split())
n = int(input())
k = int(input())

s = s[k]
s = s.lower()
print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
s = range(n)
s = s.lower(k)
print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
s = list(1:n)
s = s.lower(k)
print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
s = list(1:n)
s = str(s[k])
s = s.lower()
print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
for s in range(n):
    s = s.lower(k)

print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
for s in range(n):
    s = str(s[k])
    s = s.lower()

print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
s = list(n)
up = str(s[k])
s = up.lower()

print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
for i in range(n):
    s = 'i'.lower()

print(s)


Fixed submission:
N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
k = (int(t) + 0.5) // int(a)
i = int(k) * int(b)
print(i)


Fixed submission:
a,b,t = (int(i) for i in input().split())
print(t//a*b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = map(int, input().split())
hst = 0
cnt = 0
for i in l:
  if hst <= i:
    cnt += 1
    hst = i
print(cnt) 

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

if A>B:
    print(A+A-1)
elif A<B:
    print(B+B-1)
else:
    print(A+B)

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

if A>B:
    print(A+A-1)
elif A<B:
    print(B+B-1)
else:
    print(A+B)

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

if A>B:
    print(A+A-1)
elif A<B:
    print(B+B-1)
else:
    print(A+B)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

if k >= max(a - e):
    print('Yay!')
else:
    print(':(')



Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a <= k:
    print('Yay!')
else:
    print(':(')

Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, k = map(int, input().split())

if k >= (a - e):
    print('Yay!')
else:
    print(':(')

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a <= k:
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

if A*B >= C*D:
  print(A*B)
if C*D>= A*B:

Fixed submission:
A, B, C, D = map(int, input().split())

Rectangle1 = A*B
Rectangle2 = C*D

if Rectangle1 > Rectangle2:
    print(Rectangle1)
elif Rectangle1 < Rectangle2:
    print(Rectangle2)
else:
    print(Rectangle1)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

ans = 0

for x in range(K+1):
   for y in range(K+1):
      for z in range(K+1):
         if x + y + z == S:
            ans += 1

print(ans)

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

result = 0

for x in (range(K+1)):
    for y in (range(K+1)):
        if 0 <= S - x - y <=K:
            result +=1
print(result)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())

for i in range(W):
    c = input()
    print(c + '\n' + c)

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

for i in range(H):
    c = input()
    print(c + '\n' + c)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())

ans = 0

for i in range(a,b+1):
    if i % x == 0:
        ans += 1

print(ans)


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

ans = b//x - a//x

if a%x == 0:
    ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

if S[0]==S[1] and S[2]==S[3]　and S[0]!=S[2]:
        print('Yes')

elif S[1]==S[2] and  S[0]==S[3] and S[0]!=S[1]:
        print('Yes')
        
elif S[1]==S[3] and  S[0]==S[2] and S[0]!=S[1]:
        print('Yes')

else :
    print('No')


Fixed submission:
S = input()
 
if S[1]==S[2]==S[3]==S[0]:
        print('No')
        
elif S[0]==S[1] and S[2]==S[3]:
        print('Yes')
 
elif S[1]==S[2] and  S[0]==S[3]:
        print('Yes')
        
elif S[1]==S[3] and  S[0]==S[2]:
        print('Yes')
 
else :
    print('No')
Buggy python submission (verdict: Runtime Error):
long = int(input())
p = input()
plng = []
pstr = p.split(" ")
n = 0

for i in range(long):
    plng.append(int(pstr[i]))


for i in range(long-2):
    three = [plng[i],plng[i+1],plng[i+2]]
    three.sort()

    if three[1] == plng[i + 1]:
     n = n +　1

print(n)


Fixed submission:
long = int(input())
p = input()
plng = []
pstr = p.split(" ")
n = 0

for i in range(long):
    plng.append(int(pstr[i]))



for i in range(long-2):
    three = [plng[i],plng[i+1],plng[i+2]]
    three.sort()

    if three[1] == plng[i + 1]:
     n = n + 1

print(n)

Buggy python submission (verdict: Runtime Error):
long = int(input())
p = input()
plng = []
pstr = p.split(" ")
n = 0

for i in range(long):
    plng.append(int(pstr[i]))


for i in range(long-2):
    three = [plng[i],plng[i+1],plng[i+2]]
    three.sort()

    if three[1] == plng[i + 1]:
     n = n +　1

print(n)


Fixed submission:
long = int(input())
p = input()
plng = []
pstr = p.split(" ")
n = 0

for i in range(long):
    plng.append(int(pstr[i]))



for i in range(long-2):
    three = [plng[i],plng[i+1],plng[i+2]]
    three.sort()

    if three[1] == plng[i + 1]:
     n = n + 1

print(n)

Buggy python submission (verdict: Runtime Error):
long = int(input())
p = input()
plng = []
pstr = p.split(" ")
n = 0

for i in range(long):
    plng.append(int(pstr[i]))

print(plng)

for i in range(long-2):
    three = [plng[i],plng[i+1],plng[i+2]]
    three.sort()

    if three[1] == plng[i + 1]:
     n = n +　1

print(n)


Fixed submission:
long = int(input())
p = input()
plng = []
pstr = p.split(" ")
n = 0

for i in range(long):
    plng.append(int(pstr[i]))



for i in range(long-2):
    three = [plng[i],plng[i+1],plng[i+2]]
    three.sort()

    if three[1] == plng[i + 1]:
     n = n + 1

print(n)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
hantei = 0

x = [a,b,c,d,e]

for i in x:
 for j in x:
    if i - j > k:
        hantei.append(1)


if hantei == 0:
    print("Yay!")
else:
    print(":(")


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

x = [a,b,c,d,e]

x.sort()
if x[4] - x[0] <= k:
    print("Yay!")
else:
    print(":(")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
hantei = 0

x = [a,b,c,d,e]

for i in x:
 for j in x:
    if i - j > k:
        hantei.append(1)


if hantei == 0:
    print("Yay!")
else:
    print(":(")


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

x = [a,b,c,d,e]

x.sort()
if x[4] - x[0] <= k:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
import sys
from collections import Counter
from operator import itemgetter, attrgetter
n=0
 
n = input()
d_list= list(map(int, input().split()))
cou=sorted(Counter(d_list).most_common())
total=len(d_list)
# print(n)
# print(cou)
# print(total)
index=0
before=0
after=0
first=True
t=0
if n == 0:
    print(0)
for c in cou:
#     print(c)
    if first:
        before = c
        first=False
    before = after
    after = c
    t+=c[1]
    if t > total/2:
        break
    index+=1
# print(before)
# print(after)
# print(len(cou[index:]))
if not(len(cou[index:]) == total/2):
    print(0)
else:
    print(after[0]-before[0])

Fixed submission:
import sys
from collections import Counter
from operator import itemgetter, attrgetter
n=0
 
n = input()
d_list= list(map(int, input().split()))
cou=sorted(Counter(d_list).most_common())
total=len(d_list)
# print(n)
# print(cou)
# print(total)
index=0
before=0
after=0
first=True
t=0
for c in cou:
#     print(c)
    if first:
        before = c
        first=False
    else:
        before = cou[index-1]
    after = c
    t+=c[1]
    if t > total/2:
        break
    index+=1
# print(before)
# print(after)
# print(len(cou[index:]))
if not(sum(n for _, n in cou[index:]) == sum(n for _, n in cou[:index])):
    print(0)
else:
    print(after[0]-before[0])

Buggy python submission (verdict: Runtime Error):
import sys
from collections import Counter
from operator import itemgetter, attrgetter
n=0
 
n = input()
d_list= list(map(int, input().split()))
cou=sorted(Counter(d_list).most_common())
total=len(d_list)
index=0
before=0
after=0
first=True
t=0
for c in cou:
    if first:
        before = c
        first=False
    before = after
    after = c
    t+=c[1]
    if t > total/2:
        break
    index+=1
if not(len(cou[index:]) == total/2):
    print(0)
else:
    print(after[0]-before[0])

Fixed submission:
import sys
from collections import Counter
from operator import itemgetter, attrgetter
n=0
 
n = input()
d_list= list(map(int, input().split()))
cou=sorted(Counter(d_list).most_common())
total=len(d_list)
# print(n)
# print(cou)
# print(total)
index=0
before=0
after=0
first=True
t=0
for c in cou:
#     print(c)
    if first:
        before = c
        first=False
    else:
        before = cou[index-1]
    after = c
    t+=c[1]
    if t > total/2:
        break
    index+=1
# print(before)
# print(after)
# print(len(cou[index:]))
if not(sum(n for _, n in cou[index:]) == sum(n for _, n in cou[:index])):
    print(0)
else:
    print(after[0]-before[0])
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, D = map(int, input().split())
cnt = 0
for i in range(A, B+1):
    if i%C!=0 and i%D!=0:
        cnt += 1
        
print(cnt)
        

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


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

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

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)

print((B-A+1) -(b_num - a_num))
Buggy python submission (verdict: Time Limit Exceeded):


N = int(input())
jobs = []
for i in range(N):
    jobs.append(list(map(int, input().split())))
           
time = 0
result = "Yes"
jobs.sort(key=lambda x:x[1])

while jobs:
    job = jobs.pop(0)
    time += job[0]
    if(time > job[1]):
        result = "No"
        break

print(result)

    


Fixed submission:


N = int(input())
jobs = []
for i in range(N):
    jobs.append(list(map(int, input().split())))
           
time = 0
result = "Yes"
jobs.sort(key=lambda x:x[1])

for job in jobs:
    time += job[0]
    if(time > job[1]):
        result = "No"
        break

print(result)

Buggy python submission (verdict: Time Limit Exceeded):


N = int(input())
jobs = []
for i in range(N):
    jobs.append(list(map(int, input().split())))
           
time = 0
result = "Yes"
jobs.sort(key=lambda x:x[1])

while jobs:
    job = jobs.pop(0)
    time += job[0]
    if(time > job[1]):
        result = "No"


print(result)

    


Fixed submission:


N = int(input())
jobs = []
for i in range(N):
    jobs.append(list(map(int, input().split())))
           
time = 0
result = "Yes"
jobs.sort(key=lambda x:x[1])

for job in jobs:
    time += job[0]
    if(time > job[1]):
        result = "No"
        break

print(result)
Buggy python submission (verdict: Runtime Error):
a,b=raw_input().spilt()
a=int(a)
b=int(b)
if b-a==1:
  print "No"
else:
  print "Yes"

Fixed submission:
a,b=raw_input().split()
a=int(a)
b=int(b)
if (a==2)|(b==2):
  print "No"
else:
  print "Yes"
Buggy python submission (verdict: Runtime Error):
#include <cstdio>
#include <algorithm>
using namespace std;
struct me{
    int x,y;
}a[105],b[105];
bool f[105];
bool cmp1(struct me v1,struct me v2){
    return v1.y>v2.y;
}
bool cmp2(struct me v1,struct me v2){
    return v1.x+v1.y<v2.x+v2.y;
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&b[i].x,&b[i].y);
    //sort(a+1, a+1+n, cmp1);
    sort(b+1, b+1+n, cmp2);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(f[j]==false&&a[j].x<b[i].x&&a[j].y<b[i].y){
                f[j]=true;
                break;
            }
        }
    }
    int s=0;
    for(int i=1;i<=n;i++)
        if(f[i]==true)
            s++;
    printf("%d\n",s);
    return 0;
}


Fixed submission:
N=int(raw_input())
ab=[]
cd=[]
for i in xrange(N):
 ab.append(map(int,raw_input().split()))
for i in xrange(N):
 cd.append(map(int,raw_input().split()))
ab.sort(key=lambda x:x[1],reverse=True)
cd.sort()
for c,d in cd:
 for a,b in ab:
  if a<c and b<d:
   ab.remove([a,b])
   break
print N-len(ab)
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

n,l = map(int,input().strip().split())

ringo=[]

for i in range(n):
	ringo.append(l+i)
min = abs(ringo[0])
min_nim = 0
for i in range(len(ringo)):
	if min > abs(ringo[i]):
		min = abs(ringo[i])
		min_num = i
out = 0
for i in range(len(ringo)):
	if i != min_num:
		out = out + ringo[i]
print(out)





Fixed submission:
# -*- coding:utf-8 -*-

n,l = map(int,input().strip().split())

ringo=[]

for i in range(n):
	ringo.append(l+i)
min = abs(ringo[0])
min_num = 0
for i in range(len(ringo)):
	if min > abs(ringo[i]):
		min = abs(ringo[i])
		min_num = i
out = 0
for i in range(len(ringo)):
	if i != min_num:
		out = out + ringo[i]
print(out)
Buggy python submission (verdict: Runtime Error):
a=map(str, input())
char=list(a)
b=set(char)
c=len(b)
if c=2:
	print("Yes")
else:
  print("No")
  
  

Fixed submission:
a=map(str, input())
char=list(a)
b=set(char)
c=len(b)
if c==2:
	print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
if a=>13:
  out=b
elif a=6:
  out=b/2
else:
  out=0
  
print(out)

Fixed submission:
a,b=map(int, input().split())
if a>=13:
  out=b
elif a>=6:
  out=int(b/2)
else:
  out=int(0)
  
print(out)
Buggy python submission (verdict: Runtime Error):
a=input()
c=list(map(int, input().split()))
 
#from statistics import mean, median,variance,stdev
 
if sum(c)-max(c)< max(c):
    print("No")
else:
    print("Yes")

Fixed submission:
x,y= map(int, input().split(" "))
print(x/y)

Buggy python submission (verdict: Runtime Error):
a=input()
c=list(map(int, input().split(" ")))
 
from statistics import mean, median,variance,stdev
 
if sum(list1)-max(list1)< max(list1):
    print("Yes")
else:
    print("No")

Fixed submission:
x,y= map(int, input().split(" "))
print(x/y)
Buggy python submission (verdict: Runtime Error):
a=input()
c=list(map(int, input().split(" ")))
 
from statistics import mean, median,variance,stdev
 
if sum(list1)-max(list1)< max(list1):
    print("Yes")
else:
    print("No")

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

if sum(b)-max(b) > max(b):
    print("Yes")
else:
    print("No")

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

from statistics import mean, median,variance,stdev

if sum(list1)-max(list1)< max(list1):
    print("Yes")
else:
    print("No")

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

if sum(b)-max(b) > max(b):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = [[0]*2]*m
for i in range(m):
  bc[i] = list(map(int,input().split()))
  
std = sorted(bc, key=lambda x: x[1], reverse=True)
  
for i in range(m):
  if min(a) >= std[i][1]:
    break
  for j in range(std[i][0]):
    a[a.index(min(a))] = max(std[i][1], min(a))

print(sum(a))


Fixed submission:
#5618213
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = [list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1], reverse=True)
  
for b,c in bc:
  a.extend([c]*b)
  if len(a) > n*2:
    break
a.sort(reverse=True)
print(sum(a[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))

for i in range(m):
  b, c = map(int,input().split())
  for j in range(b):
    if min(a) >= c:
      break
    a[a.index(min(a))] = max(c, min(a))

print(sum(a))


Fixed submission:
#5618213
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = [list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1], reverse=True)
  
for b,c in bc:
  a.extend([c]*b)
  if len(a) > n*2:
    break
a.sort(reverse=True)
print(sum(a[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = list(map(int,input().split()))

for i in range(m):
  b, c = map(int,input().split())
  for j in range(b):
    a[a.index(min(a))] = max(c, min(a))

print(sum(a))

Fixed submission:
#5618213
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = [list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1], reverse=True)
  
for b,c in bc:
  a.extend([c]*b)
  if len(a) > n*2:
    break
a.sort(reverse=True)
print(sum(a[:n]))
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(m,n):
  x=max(m,n)
  y=min(m,n)
  if x==0:
    return 0
  while y!=0:
    x,y=y,x%y
  return x
 
n = int(input())
a = list(map(int, input().split()))
b = [0]
 
for i in range(n):
  a[i],a[n-1]=a[n-1],a[i]
  temp = a[0]
  for j in range(n-1):
    temp=gcd(temp,a[j])
    if temp == 1:
      break
    if temp < max(b):
      break
  b.append(temp)
  a[i],a[n-1]=a[n-1],a[i]
  
print(max(b))


Fixed submission:
def gcd(m,n):
  x=max(m,n)
  y=min(m,n)
  while y!=0:
    x,y=y,x%y
  return x

n = int(input())
a = list(map(int, input().split()))
b = []
l = [0]
r = [0]

for i in range(n):
  l.append(gcd(a[i],l[i]))
  r.append(gcd(a[n-1-i],r[i]))

for i in range(n):
  b.append(gcd(l[i],r[n-1-i]))
  
print(max(b))

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(m,n):
  x=max(m,n)
  y=min(m,n)
  if x==0:
    return 0
  while y!=0:
    x,y=y,x%y
  return x
 
n = int(input())
a = list(map(int, input().split()))
b = [0]
 
for i in range(n):
  a[i],a[n-1]=a[n-1],a[i]
  temp = a[0]
  for j in range(n-1):
    temp=gcd(temp,a[j])
    if temp < max(b):
      break
  b.append(temp)
  a[i],a[n-1]=a[n-1],a[i]
  
print(max(b))

Fixed submission:
def gcd(m,n):
  x=max(m,n)
  y=min(m,n)
  while y!=0:
    x,y=y,x%y
  return x

n = int(input())
a = list(map(int, input().split()))
b = []
l = [0]
r = [0]

for i in range(n):
  l.append(gcd(a[i],l[i]))
  r.append(gcd(a[n-1-i],r[i]))

for i in range(n):
  b.append(gcd(l[i],r[n-1-i]))
  
print(max(b))

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(m,n):
  x=max(m,n)
  y=min(m,n)
  if x==0:
    return 0
  while y!=0:
    x,y=y,x%y
  return x

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

for i in range(n):
  a[i],a[n-1]=a[n-1],a[i]
  temp = a[0]
  for j in range(n-1):
    temp=gcd(temp,a[j])
  b.append(temp)
  a[i],a[n-1]=a[n-1],a[i]
  
print(max(b))

Fixed submission:
def gcd(m,n):
  x=max(m,n)
  y=min(m,n)
  while y!=0:
    x,y=y,x%y
  return x

n = int(input())
a = list(map(int, input().split()))
b = []
l = [0]
r = [0]

for i in range(n):
  l.append(gcd(a[i],l[i]))
  r.append(gcd(a[n-1-i],r[i]))

for i in range(n):
  b.append(gcd(l[i],r[n-1-i]))
  
print(max(b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
k = int(input())
ans = ""

for l in s:
  if l != s[k]:
    l = "*"
  ans += l
print(ans)
  

Fixed submission:
n = int(input())
s = str(input())
k = int(input())
ans = ""

for l in s:
  if l != s[k-1]:
    l = "*"
  ans += l
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())

a = s[0:s.rfind('.')].count('#')
b = s[s.find('#'):n].count('.')
c = 0

for i in range(n//2):
  if s[i] == "#" and s[i:n].find('.') != -1:
    c += 1
  if s[n-i] == "." and s[i:n].find('#') != -1:
    c += 1
    
ans = min([a, b, c])
print(ans)


Fixed submission:
n = int(input())
s = str(input())
k = [s.count('.')]

for i in range(n):
  if s[i] == "#":
    k.append(k[i]+1)
  else:
    k.append(k[i]-1)
    
print(min(k))