Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

for i in range(1,N+1):
    counter = 0
    prev_item = 1
    for item in A:
        if item == i:
            counter += 1
            prev_item = item
    print(counter)
    if i < N:
        A.remove(prev_item)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count_list = [0] * N
for item in A:
    count_list[item-1] += 1
for countitem in count_list:
    print(countitem)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    counter = 0
    for item in A:
        if item == i:
            counter += 1
    print(counter)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count_list = [0] * N
for item in A:
    count_list[item-1] += 1
for countitem in count_list:
    print(countitem)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count_list = [0] * N
for item in A:
    count_list[item-1] += 1
for countitem in count_list:
    print(countitem)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count_list = [0] * N
for item in A:
    count_list[item-1] += 1
for countitem in count_list:
    print(countitem)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
count_list = [0] * N
for item in A:
    count_list[item-1] += 1
for countitem in count_list:
    print(countitem)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
for k in range(N):
    for j in range(k):
        if S[k] == S[j]:
            continue
        for i in range(j):
            if S[i] == S[j] or S[i] == S[k] or j-i == k-j:
                continue
            count+=1
print(count)

Fixed submission:
import sys

N = input()

for N_char in N:
    if N_char == "7":
        print("Yes")
        sys.exit()
print("No")
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)

total = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            total += gcd(gcd(a,b),c)
print(total)


Fixed submission:
K = int(input())

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)

total = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            total += gcd(gcd(a,b),c)

            
print(total)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
a = stdin.readline().rstrip()
#print(a.upper())    # 読み込んだ文字を大文字に変換
pi = 3.14159265
r = 2*pi*a
print(r)

Fixed submission:
from sys import stdin
a = stdin.readline().rstrip()
#print(a.upper())    # 読み込んだ文字を大文字に変換
a = int(a)
pi = 3.14159265
r = 2*pi*a
print(r)
Buggy python submission (verdict: Runtime Error):
in_str = input()
input_list = map(int,in_str)
per = input_list[0]
money = input_list[1]
target = input_list[2]
time = int(money/par)
ans = 0
if(time>=target):
  ans = target
else:
  ans = time
print(ans)

Fixed submission:
in_str = input()
input_list = list(map(int,in_str.split()))
per = input_list[0]
money = input_list[1]
target = input_list[2]
time = int(money/per)
ans = 0
if(time>=target):
  ans = target
else:
  ans = time
print(ans)
Buggy python submission (verdict: Runtime Error):
in_str = input()
input_list = list(map(int,in_str.split()))
A = input_list[0]
B = input_list[1]
K = input_list[2]
count = 0
ans = 0
for i in range(100):
  if(A/i==0 and B/i==0):
    ans = i
    count+=1
    if(count==K):
      break
print(ans)

Fixed submission:
in_str = input()
input_list = list(map(int,in_str.split()))
A = input_list[0]
B = input_list[1]
K = input_list[2]
count = 0
ans = 0
max = 100
for i in range(max):
  div = max-i
  if(A%div==0 and B%div==0):
    ans = div
    count+=1
    if(count==K):
      break
print(ans)
Buggy python submission (verdict: Runtime Error):
p = int(input().split())
p.extend(int(input().split()))
p.extend(int(input().split()))
#print(p)
count_list = []
for i in range(4):
   count =  p.count(i+1)
   count_list.append(count)
#==
count_list2 = []
for j in range(2):
   count2 = count_list2.count(j+1)
   count2_list.append(count2)
#==
if(count2_list.count(1)==2 and count2_list.count(1)==2):
   print("YES")
else:
   print("NO")

Fixed submission:
p_str = input().split()
p = [int(s) for s in p_str]
p_str = input().split()
p.extend([int(s) for s in p_str])
p_str = input().split()
p.extend([int(s) for s in p_str])
#print(p)
count_list = []
for i in range(4):
   count =  p.count(i+1)
   count_list.append(count)
#print(count_list)
if(count_list.count(1)==2 and count_list.count(2)==2):
   print("YES")
else:
   print("NO")
Buggy python submission (verdict: Runtime Error):
N = str(input())
result = any(True if m== '7' else False for n in N)


if result;
	print('yes')
  
else ;
	print('no')

Fixed submission:
N = int(input())

if (N - 7)% 10 ==0 or (N//10 - 7) % 10==0 or (N//100 % 7)==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math

if __name__ == '__main__':
    N = int(input())
    print(N*N(math.pi)


Fixed submission:
if __name__ == '__main__':
    N = int(input())
    import math
    print(2*N*(math.pi))

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    N = int(input())
    import math
    print(N*N(math.pi)


Fixed submission:
if __name__ == '__main__':
    N = int(input())
    import math
    print(2*N*(math.pi))

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    N = int(input())
    import math
    print(N*N(math.pi)


Fixed submission:
if __name__ == '__main__':
    N = int(input())
    import math
    print(2*N*(math.pi))
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    N, M = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]
    res = N - sum(arr)
    if res < 0:
        print(-1)
    else:


Fixed submission:
if __name__ == '__main__':
    N, M = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]
    res = N - sum(arr)
    if res < 0:
        print(-1)
    else:
        print(res)
Buggy python submission (verdict: Runtime Error):
@lru_cache(maxsize=10**5)
def cached_gcd(i, j):
    return math.gcd(i, j)

if __name__ == '__main__':
    N = int(input())
    total = 0
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            g = cached_gcd(j, i)
            for k in range(1, N + 1):
                total += cached_gcd(k, g)
    print(total)



Fixed submission:
import math
from functools import lru_cache

@lru_cache(maxsize=10**6)
def cached_gcd(i, j):
    return math.gcd(i, j)

if __name__ == '__main__':
    N = int(input())
    total = 0
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            g = cached_gcd(j, i)
            for k in range(1, N + 1):
                total += cached_gcd(k, g)
    print(total)

Buggy python submission (verdict: Runtime Error):
@lru_cache(maxsize=10**6)
def cached_gcd(i, j):
    return math.gcd(i, j)

if __name__ == '__main__':
    N = int(input())
    total = 0
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            g = cached_gcd(j, i)
            for k in range(1, N + 1):
                total += cached_gcd(k, g)
    print(total)



Fixed submission:
import math
from functools import lru_cache

@lru_cache(maxsize=10**6)
def cached_gcd(i, j):
    return math.gcd(i, j)

if __name__ == '__main__':
    N = int(input())
    total = 0
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            g = cached_gcd(j, i)
            for k in range(1, N + 1):
                total += cached_gcd(k, g)
    print(total)

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

if __name__ == '__main__':
    N = int(input())
    total = 0
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            for k in range(1, N + 1):
                total += math.gcd(k, math.gcd(j, i))
    print(total)



Fixed submission:
import math
from functools import lru_cache

@lru_cache(maxsize=10**6)
def cached_gcd(i, j):
    return math.gcd(i, j)

if __name__ == '__main__':
    N = int(input())
    total = 0
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            g = cached_gcd(j, i)
            for k in range(1, N + 1):
                total += cached_gcd(k, g)
    print(total)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while max(li)==10 :
   li.remove(max(li))
li.remove(max(li))
print(s+sum(li))

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while 10 in li :
   li.remove(max(li))
if len(li)>0 :
   li.remove(max(li))
print(s+sum(li))

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while max(li)==10 :
   li.remove(max(li))
li.remove(max(li))
s+=sum(li)
print(s)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while 10 in li :
   li.remove(max(li))
if len(li)>0 :
   li.remove(max(li))
print(s+sum(li))
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a<0 or b<0 :
    print("negative!")
elif a>10000 or b>10000 :
    print("too big!")
elif a*b%2==0 :
    print("Even")
else :
    print("Odd")

Fixed submission:
a,b = map(int,input().split())
if a<0 or b<0 :
    print("negative!")
elif a>10000 or b>10000 :
    print("too big!")
elif a*b%2==0 :
    print("Even")
else :
    print("Odd")

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a<0 or b<0 :
    print("negative!")
elif a>10000 or b>10000 :
    print("too big!")
elif a*b%2==0 :
    print("even")
else :
    print("odd")

Fixed submission:
a,b = map(int,input().split())
if a<0 or b<0 :
    print("negative!")
elif a>10000 or b>10000 :
    print("too big!")
elif a*b%2==0 :
    print("Even")
else :
    print("Odd")

Buggy python submission (verdict: Runtime Error):
if (int(input())*int(input()))%2==0 :
    print("even")
else :
    print("odd")

Fixed submission:
a,b = map(int,input().split())
if a<0 or b<0 :
    print("negative!")
elif a>10000 or b>10000 :
    print("too big!")
elif a*b%2==0 :
    print("Even")
else :
    print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
count=0
for X in range(K+1) :
    for Y in range(K+1) :
        for Z in range(K+1) :
            if X+Y+Z==S :
                count+=1
print(count)

Fixed submission:
K,S=map(int,input().split())
count=0
for X in range(K+1) :
    for Y in range(K+1) :
       Z=S-X-Y
       if 0<=Z<=K :
           count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())

ln = []

for i in range(1:10):
  for j in range(1:10):
    ln.append(i*j)
    
print("Yes" if n in ln else "No")

Fixed submission:
n = int(input())

ln = []

for i in range(1,10):
  for j in range(1,10):
    ln.append(i*j)
    
print("Yes" if n in ln else "No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
ln = input().split()
s = 0

for i in range(n):
  for j in range(i + 1, n):
    s += int(ln[i]) * int(ln[j])
    
print(s)

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

if a >= 2 * b:
  print(a - 2 * b)
  
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n = int(input())
str = input()
k = int(input())

c = str[k-1]
str2 = ""
for char in str:
  if char == c:
    s += c
  else:
    s += *
    
print(s)

Fixed submission:
n = int(input())
str = input()
k = int(input())

c = str[k-1]
str2 = ""
for char in str:
  if char == c:
    str2 += c
  else:
    str2 += "*"
    
print(str2)
Buggy python submission (verdict: Runtime Error):
O = input()
N = input()

pw = ""
if len(O) == len(N):
    for i in range(len(O)):
        pw += O[i] + N[i]
else:
    for i in range(len(O)):
        pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)

Fixed submission:
O = input()
N = input()

pw = ""
if len(O) == len(N):
    for i in range(len(O)):
        pw += O[i] + N[i]
else:
    for i in range(len(O)-1):
        pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)

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

pw = ""
if len(O) = len(N):
	for i in range(len(O)):
    	pw += O[i] + N[i]
else:
	for i in range(len(O)-1):
    	pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)

Fixed submission:
O = input()
N = input()

pw = ""
if len(O) == len(N):
    for i in range(len(O)):
        pw += O[i] + N[i]
else:
    for i in range(len(O)-1):
        pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)
Buggy python submission (verdict: Runtime Error):
a, b = input.split()
print("H" if a == b else D"")

Fixed submission:
a, b = input().split()
print("H" if a == b else "D")
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()

print("A" + b + "C")

Fixed submission:
str = input()

print("A" + str[8] + "C")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = int(input())
ln = []

for i in range n:
  ln.append(input())
  
ln.sort()

s = ""

for word in ln:
  s += word
  
print(s)

Fixed submission:
n, l = map(int, input().split(" "))
ln = []

for i in range(n):
  ln.append(input())
  
ln.sort()

s = ""
for word in ln:
  s += word
  
print(s)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = 0
for _ in range(m):
  a += int(input())
if a > n: print(-1)
else: print(n-a)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
print(max(n-sum(a), -1))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = dict()
for i in range(n):
    b[i+1] = 0

for i in range(n):
    b[a[i]] += 1

for i in range(n):
    print(b[i+1])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = dict()
for i in range(n):
    b[i+1] = 0

for i in range(n-1):
    b[a[i]] += 1

for i in range(n):
    print(b[i+1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = dict()
for i in range(n):
    b[i+1] = 0

for i in range(n):
    b[a[i]+1] += 1

for i in range(n):
    print(b[i+1])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = dict()
for i in range(n):
    b[i+1] = 0

for i in range(n-1):
    b[a[i]] += 1

for i in range(n):
    print(b[i+1])
Buggy python submission (verdict: Runtime Error):
def check(s: str):
    return s == s[::-1]


s = input()
if check(s) and check(s[:(n-1)//2]):
    print("Yes")
else:
    print("No")


Fixed submission:
def check(s: str):
    return s == s[::-1]


s = input()
n = len(s)
if check(s) and check(s[:(n-1)//2]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from collections import Counter
from copy import deepcopy

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
for v in c.values():
    all_comb += v*(v-1)/2

for i in range(n):
    tmp = c[a[i]]
    print(all_comb - 2*(tmp-1))


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
all_comb = 0
for v in c.values():
    all_comb += v*(v-1)/2

for i in range(n):
    tmp = c[a[i]]
    print(int(all_comb-tmp+1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0

for i in range(n):
    if a[i] <= min(a[:i+1]):
        ans += 1

print(ans)

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

for i in range(n):
    if a[i] <= minimum:
        ans += 1
        minimum = a[i]

print(ans)

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

for i in range(n):
    if a[n] <= min(a[:n+1]):
        ans += 1

print(ans)

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

for i in range(n):
    if a[i] <= minimum:
        ans += 1
        minimum = a[i]

print(ans)

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

for i in range(n):
    if a[n] <= min(a[:n]):
        ans += 1

print(ans)

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

for i in range(n):
    if a[i] <= minimum:
        ans += 1
        minimum = a[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
from bisect import bisect_right
from collections import defaultdict
h, w = map(int, input().split())
c = []
bf, bl = defaultdict(list), defaultdict(list)
ans = 0

for i in range(h):
    s = input()
    c.append(s)
    for j in range(w):
        if s[j] == '#':
            bl[i].append(j)
            bf[j].append(i)

for i in range(h):
    for j in range(w):
        tmp = 0
        if c[i][j] == '.':
            vert = bisect_right(bf[j], i)
            horz = bisect_right(bl[i], j)
            #print(bf[j], bl[i], i, j, vert, horz)
            if bf[j] == []:
                tmp += h-1
            elif i < bf[j][0] or bf[j][-1] < i:
                if i < bf[j][0]:
                    tmp += bf[j][0]-1
                else:
                    tmp += h-bf[j][-1]-2
            else:
                tmp += bf[j][vert]-bf[j][vert-1]-2
            if bl[i] == []:
                tmp += w-1
            elif j < bl[i][0] or bl[i][-1] < j:
                if j < bl[i][0]:
                    tmp += bl[i][0]-1
                else:
                    tmp += w-bl[i][-1]-2
            else:
                tmp += bl[i][horz]-bl[i][horz-1]-2
        ans = max(ans, tmp+1)
print(ans)

Fixed submission:
a, b, c = map(int, input().split())
A = [a+b, b+c, c+a]
print(min(A))
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

n, m = map(int, input().split())
li_ord = [0 for _ in range(m)]
dic = defaultdict(list)

for i in range(m):
    s = list(map(int, input().split()))[1:]
    for j in s:
        dic[j].append(i)
p = list(map(int, input().split()))
dic = sorted(dict(dic).items())
ans = 0

if dic == []:
    if 1 in p:
        print(0)
    else:
        print(2**n)
    exit()

for i in range(2**n):
    tmp_num = bin(i)[2:].zfill(n)
    li = li_ord
    for j in range(n):
        digit = tmp_num[j]
        #print(digit, dic[j][1])
        if digit == '1':
            for k in dic[j][1]:
                #print(li[k], k)
                li[k] ^= 1
    #print(tmp_num, p, li)
    if p == li:
        ans += 1

print(ans)

Fixed submission:
n, m = map(int, input().split())
s = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0

for i in range(1<<n):
    for j in range(m):
        cnt = 0
        for num in s[j]:  
            if i&(1<<(num-1)) != 0:
                cnt += 1
        if cnt%2 != p[j]: #j番目の電球でアウト
            break
    else: #すべての電球でパス
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
w = [tuple(map(int, input().split()))for _ in range(m)]
w.sort(key=lambda x: x[1], reverse=True)
ans = 0
p, i = 0, 0
b, c = w[i][0], w[i][1]

while p < n and i < m:
    cur = a[p]
    if cur < c:
        b -= 1
        ans += c
    else:
        ans += cur
    if b == 0:
        i += 1
        b, c = w[i][0], w[i][1]
    p += 1

print(ans)

Fixed submission:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
w = [tuple(map(int, input().split()))for _ in range(m)]
w.sort(key=lambda x: x[1], reverse=True)
ans = 0
p, i = 0, 0
b, c = w[i][0], w[i][1]
while p < n and i < m:
    cur = a[p]
    if cur < c:
        b -= 1
        ans += c
    else:
        ans += cur
    if b == 0:
        i += 1
        if i == m:
            ans += sum(a[p+1:])
            break
        b, c = w[i][0], w[i][1]
    p += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = [reduce(gcd, A)]

if len(A) == 1:
    print(A[0])
    exit()
for i in a:
    b = sorted(A)
    b.remove(i)
    if a.count(i) == 1:
        ans.append(reduce(gcd, b))

print(max(ans))


Fixed submission:
from functools import reduce
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = [reduce(gcd, A)]

if len(A) == 1:
    print(A[0])
    exit()
for i in A:
    b = sorted(A)
    b.remove(i)
    if a.count(i) == 1:
        ans.append(reduce(gcd, b))

print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = [reduce(gcd, a)]

if len(A) == 1:
    print(A[0])
    exit()
for i in a:
    b = sorted(A)
    b.remove(i)
    if a.count(i) == 1:
        ans.append(reduce(gcd, b))

print(max(ans))


Fixed submission:
from functools import reduce
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = [reduce(gcd, A)]

if len(A) == 1:
    print(A[0])
    exit()
for i in A:
    b = sorted(A)
    b.remove(i)
    if a.count(i) == 1:
        ans.append(reduce(gcd, b))

print(max(ans))

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

n = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = []

for i in a:
    b = sorted(A)
    b.remove(i)
    ans.append(reduce(gcd, b))

print(max(ans))


Fixed submission:
from functools import reduce
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = [reduce(gcd, A)]

if len(A) == 1:
    print(A[0])
    exit()
for i in A:
    b = sorted(A)
    b.remove(i)
    if a.count(i) == 1:
        ans.append(reduce(gcd, b))

print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from fractions import gcd

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

for i in a:
    b = sorted(a)
    b.remove(i)
    ans.append(reduce(gcd, b))

print(max(ans))


Fixed submission:
from functools import reduce
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = [reduce(gcd, A)]

if len(A) == 1:
    print(A[0])
    exit()
for i in A:
    b = sorted(A)
    b.remove(i)
    if a.count(i) == 1:
        ans.append(reduce(gcd, b))

print(max(ans))
Buggy python submission (verdict: Runtime Error):
ans = 0
a = []
for _ in range(5):
    x = int(input())
    if x%10 == 0:
        ans += x
    else:
        ans += (x//10)*10
        a.append(x%10)

ans += (len(a)-1)*10
ans += min(a)

print(ans)

Fixed submission:
ans = 0
a = []
for _ in range(5):
    x = int(input())
    if x%10 == 0:
        ans += x
    else:
        ans += (x//10)*10
        a.append(x%10)

ans += (len(a)-1)*10
if a != []:
    ans += min(a)
else:
    ans += 10

print(ans)