Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
for i in range(n):
	count = 0
	for k, v in C.items():
		if k == A[i]:
			v -= 1
		count += v * (v - 1) // 2
	print(count)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
count = 0
for v in C.values():
	count += v * (v - 1) // 2
for a in A:
	x = C[a]
	print(count - (x * (x - 1) // 2) + ((x - 1) * (x - 2) // 2))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
from collections import Counter
for i in range(n):
	count = 0
	C = Counter(A[:i] + A[i+1:])
	for v in C.values():
		count += v * (v - 1) // 2
	print(count)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
count = 0
for v in C.values():
	count += v * (v - 1) // 2
for a in A:
	x = C[a]
	print(count - (x * (x - 1) // 2) + ((x - 1) * (x - 2) // 2))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
P = list(map(int, input().split()))
maxv = 0
for i in range(n):
	maxv = max(maxv, sum(P[i:i+k]))
print((maxv + k) * 0.5)

Fixed submission:
n, k = map(int, input().split())
P = list(map(int, input().split()))
maxv = tempsum = sum(P[:k])
for i in range(1, n-k+1):
	tempsum = tempsum - P[i-1] + P[i+k-1]
	maxv = max(maxv, tempsum)
print((maxv + k) * 0.5)

Buggy python submission (verdict: Time Limit Exceeded):
# import numpy as np
n, k = map(int, input().split())
P = list(map(int, input().split()))
for i in range(len(P)):
	P[i] = (P[i] + 1) * 0.5
maxv = 0
for i in range(n):
	maxv = max(maxv, sum(P[i:i+k]))
print(maxv)

Fixed submission:
n, k = map(int, input().split())
P = list(map(int, input().split()))
maxv = tempsum = sum(P[:k])
for i in range(1, n-k+1):
	tempsum = tempsum - P[i-1] + P[i+k-1]
	maxv = max(maxv, tempsum)
print((maxv + k) * 0.5)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
P = list(map(int, input().split()))
for i in range(len(P)):
	P[i] = (P[i] + 1) * 0.5
maxv = 0
for i in range(n):
	maxv = max(maxv, sum(P[i:i+k]))
print(maxv)

Fixed submission:
n, k = map(int, input().split())
P = list(map(int, input().split()))
maxv = tempsum = sum(P[:k])
for i in range(1, n-k+1):
	tempsum = tempsum - P[i-1] + P[i+k-1]
	maxv = max(maxv, tempsum)
print((maxv + k) * 0.5)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
P = np.array(list(map(int, input().split())))
# P = list(map(int, input().split()))
P = (P + 1) * 0.5
maxv = 0
for i in range(n):
	maxv = max(maxv, sum(P[i:i+k]))
print(maxv)

Fixed submission:
n, k = map(int, input().split())
P = list(map(int, input().split()))
maxv = tempsum = sum(P[:k])
for i in range(1, n-k+1):
	tempsum = tempsum - P[i-1] + P[i+k-1]
	maxv = max(maxv, tempsum)
print((maxv + k) * 0.5)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
sum = 0
for i in range(n):
	sum += i + 1
print(sum - n)

Fixed submission:
n = int(input())
print((n * (n+1)) // 2 - n)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
l, r = map(int, input().split())
S = set(range(l, r + 1))
for i in range(m - 1):
	l, r = map(int, input().split())
	S &= set(range(l, r + 1))
print(len(S))

Fixed submission:
n, m = map(int, input().split())
maxl, minr = map(int, input().split())
for i in range(m - 1):
	l, r = map(int, input().split())
	maxl = max(maxl, l)
	minr = min(minr, r)
print(max(0, minr - maxl + 1))
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, m, c = map(int, input().split())
b = np.array(list(map(int, input().split())))
ans = 0
for i in range(n) :
	a = np.array(list(map(int, input().split())))
	if np.sum(a * b) + c > 0 :
		ans += 1
print(ans)

Fixed submission:
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n) :
	a = list(map(int, input().split()))
	if sum([x * y for (x, y) in zip(a, b)]) + c > 0 :
		ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
flag = True
count = 0
while flag:
	flag = False
	for i in range(len(s) - 1):
		if s[i:i+2] == "BW":
			s = s[:i] + "WB" + s[i+2:]
			count += 1
			flag = True
print(count)

Fixed submission:
s = input()
b = 0
ans = 0
for c in s:
	if c == 'B':
		b += 1
	else:
		ans += b
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
n = int(input())
D = sorted(list(map(int, input().split())))
m = int(input())
T = list(map(int, input().split()))
for t in T:
	while t:
		i = bisect_left(D, t)
		if i == n or D[i] != t:
			print("NO")
			exit()
		else:
			t -= D[i]
			n -= 1
			D.pop(i)
else:
	print("YES")

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

from collections import Counter
DC = Counter(D)
TC = Counter(T)
for k, v in TC.items():
	if v > DC[k]:
		print("NO")
		exit()
else:
	print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
D = sorted(list(map(int, input().split())))[::-1]
m = int(input())
T = sorted(list(map(int, input().split())))[::-1]
for t in T:
	for i, d in enumerate(D):
		if d <= t:
			D[i] = 0
			t -= d
			if t == 0:
				break
	if t:
		print("NO")
		exit()
else:
	print("YES")

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

from collections import Counter
DC = Counter(D)
TC = Counter(T)
for k, v in TC.items():
	if v > DC[k]:
		print("NO")
		exit()
else:
	print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
D = sorted(list(map(int, input().split())))[::-1]
m = int(input())
T = sorted(list(map(int, input().split())))[::-1]
for t in T:
	for i, d in enumerate(D):
		if d <= t:
			D[i] = 0
			t -= d
	if t:
		print("NO")
		exit()
else:
	print("YES")

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

from collections import Counter
DC = Counter(D)
TC = Counter(T)
for k, v in TC.items():
	if v > DC[k]:
		print("NO")
		exit()
else:
	print("YES")
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
if len(A) % 2:
	print(*A[-1::-2], *A[1::2])
else:
	print(*A[-1::-2], *A[::2])

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
if len(A) % 2:
	print(*(A[-1::-2] + A[1::2]))
else:
	print(*(A[-1::-2] + A[::2]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(input()) for i in range(n)]
maxv = 0

def f(q, p):
	global maxv
	if q == n:
		if p % 10 != 0 and p > maxv:
			maxv = p
		return
	f(q + 1, p + A[q])
	f(q + 1, p)

f(0, 0)
print(maxv)

Fixed submission:
n = int(input())
A = [int(input()) for i in range(n)]
s = sum(A)
if s % 10:
	print(s)
else:
	A.sort()
	for a in A:
		if a % 10:
			print(s - a)
			exit()
	else:
		print(0)
Buggy python submission (verdict: Runtime Error):
a,b=float(input().split())
ans=int(a*b+0.00001)
print(ans)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b.replace(".",""))
print(a*b//100)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
for i in range(n):
  ans+=i
print(int(ans))

Fixed submission:
n=int(input())
ans=n*(n-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
from copy import deepcopy

length,kaisu=map(int,input().split())
A=deque(map(int,input().split()))
maxhist=[0]
for left in range(kaisu+1):
  for right in range(kaisu-left+1):
    l=deepcopy(A)
    point=[]
    dropable=kaisu-left-right
    for i in range(left):
      num=l.popleft()
      point.append(num)
    for j in range(right):
      num2=l.pop()
      point.append(num2)
    droptime=0
    while(droptime<dropable):
      if point==[]:
        break
      elif min(point)>0:
        break
      else:
        point.sort(reverse=True)
        point.pop(-1)
        droptime+=1
    maxhist.append(sum(point))
print(max(maxhist))

Fixed submission:
from collections import deque
from copy import deepcopy

length,kaisu=map(int,input().split())
A=deque(map(int,input().split()))
maxhist=[0]
for left in range(kaisu+1):
  for right in range(kaisu-left+1):
    l=deepcopy(A)
    point=[]
    dropable=kaisu-left-right
    for i in range(left):
      try:
        num=l.popleft()
        point.append(num)
      except:
        pass
    for j in range(right):
      try:
        num2=l.pop()
        point.append(num2)
      except:
        pass
    droptime=0
    while(droptime<dropable):
      if point==[]:
        break
      elif min(point)>0:
        break
      else:
        try:
          point.sort(reverse=True)
          point.pop(-1)
          droptime+=1
        except:
          break
    maxhist.append(sum(point))
print(max(maxhist))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline

n,m=map(int,input().split())
for i in range(m):
  a,b=map(int,input().split())
  l=[i for i in range(a,b+1)]
  if i==0:
    cards=l
  else:
    cards=list(set(l)&set(cards))
print(len(cards))

Fixed submission:
import sys
input=sys.stdin.readline

n,m=map(int,input().split())
leftgate=[]
rightgate=[]
for i in range(m):
  l,r=map(int,input().split())
  leftgate.append(l)
  rightgate.append(r)
if (min(rightgate)-max(leftgate))>-1:
  print(min(rightgate)-max(leftgate)+1)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
cards=[i for i in range(1,n+1)]
for i in range(m):
  a,b=map(int,input().split())
  l=[i for i in range(a,b+1)]
  cards=list(set(l)&set(cards))
print(len(cards))

Fixed submission:
import sys
input=sys.stdin.readline

n,m=map(int,input().split())
leftgate=[]
rightgate=[]
for i in range(m):
  l,r=map(int,input().split())
  leftgate.append(l)
  rightgate.append(r)
if (min(rightgate)-max(leftgate))>-1:
  print(min(rightgate)-max(leftgate)+1)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
cards=[i for i in range(1,n+1)]
for i in range(m):
  a,b=map(int,input().split())
  l=[i for i in range(a,b+1)]
  cards=list(set(l)&set(cards))
print(len(cards))

Fixed submission:
import sys
input=sys.stdin.readline

n,m=map(int,input().split())
leftgate=[]
rightgate=[]
for i in range(m):
  l,r=map(int,input().split())
  leftgate.append(l)
  rightgate.append(r)
if (min(rightgate)-max(leftgate))>-1:
  print(min(rightgate)-max(leftgate)+1)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
gate=[]
for i in range(m):
  l=list(map(int,input().split()))
  gate.append(l)
count=[0]*n
for g in range(m):
  for j in range(gate[g][0],gate[g][1]+1):
      count[j-1]+=1
ans=0
for i in range(n):
    if count[i]==m:
        ans+=1
print(ans)

Fixed submission:
import sys
input=sys.stdin.readline

n,m=map(int,input().split())
leftgate=[]
rightgate=[]
for i in range(m):
  l,r=map(int,input().split())
  leftgate.append(l)
  rightgate.append(r)
if (min(rightgate)-max(leftgate))>-1:
  print(min(rightgate)-max(leftgate)+1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline

cardamt,sousa=map(int,input().split())
cardlist=list(map(int,input().split()))
for i in range(sousa):
    maisu,number=map(int,input().split())
    newcard=[number]*maisu
    cardlist.extend(newcard)
cardlist.sort(reverse=True)
print(sum(cardlist[0:cardamt]))

Fixed submission:
import sys
input=sys.stdin.readline
 
cardamt,sousa=map(int,input().split())
init=list(map(int,input().split()))
cardlist=[(1,a) for a in init]
for i in range(sousa):
    add=tuple(map(int,input().split()))
    cardlist.append(add)
cardlist.sort(reverse=True, key=lambda x:x[1])
result,totalcard,idx=0,0,0
while(totalcard<cardamt):
    newcardamt=cardlist[idx][0]
    if totalcard+newcardamt<=cardamt:
        totalcard=totalcard+newcardamt
        result=result+cardlist[idx][1]*newcardamt
    else:
        cardamtdelta=cardamt-totalcard
        totalcard=totalcard+cardamtdelta
        result=result+cardlist[idx][1]*cardamtdelta
    idx+=1
    #print(result,totalcard)
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
cardamt,sousa=map(int,input().split())
cardlist=list(map(int,input().split()))
for i in range(sousa):
    maisu,number=map(int,input().split())
    newcard=[number]*maisu
    cardlist.extend(newcard)
cardlist.sort(reverse=True)
print(sum(cardlist[0:cardamt]))

Fixed submission:
import sys
input=sys.stdin.readline
 
cardamt,sousa=map(int,input().split())
init=list(map(int,input().split()))
cardlist=[(1,a) for a in init]
for i in range(sousa):
    add=tuple(map(int,input().split()))
    cardlist.append(add)
cardlist.sort(reverse=True, key=lambda x:x[1])
result,totalcard,idx=0,0,0
while(totalcard<cardamt):
    newcardamt=cardlist[idx][0]
    if totalcard+newcardamt<=cardamt:
        totalcard=totalcard+newcardamt
        result=result+cardlist[idx][1]*newcardamt
    else:
        cardamtdelta=cardamt-totalcard
        totalcard=totalcard+cardamtdelta
        result=result+cardlist[idx][1]*cardamtdelta
    idx+=1
    #print(result,totalcard)
print(result)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
lastindex=0
tenmod=[a%10,b%10,c%10,d%10,e%10]
times=tenmod.count(0)
for i in range(times):
  tenmod.remove(0)
key=min(tenmod)
alltime=0
for i in range(5):
  if l[i]%10==0:
    alltime+=l[i]
  elif l[i]%10==key:
    alltime+=l[i]
  else:
    alltime+=int(l[i]/10)*10+10
print(alltime)


Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
lastindex=0
tenmod=[a%10,b%10,c%10,d%10,e%10]
times=tenmod.count(0)
if times!=0:
  for i in range(times):
    tenmod.remove(0)
if times!=5:
  key=min(tenmod)
else:
  key=0
alltime=0
lastflag=0
for i in range(5):
  if l[i]%10==0:
    alltime+=l[i]
  elif l[i]%10==key and lastflag==0:
    alltime+=l[i]
    lastflag+=1
  else:
    alltime+=int(l[i]/10)*10+10
print(alltime)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
ans=0
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)
if n==1:
    ans=x[0]
else:
    element = gcd(x[0], x[1])
    if n==2:
      ans=element
    else:
        for i in range(2,n):
            element=gcd(element,x[i])
        ans=element
print(ans)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
ans=0
def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)
if n==1:
    ans=l[0]
else:
    element = gcd(l[0], l[1])
    if n==2:
      ans=element
    else:
        for i in range(2,n):
            element=gcd(element,l[i])
        ans=element
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int(input().split()))
print(int(a+b/2))

Fixed submission:
a,b=map(int,input().split())
print(int(a+b/2))
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
for i in range(3):
  if l[i]==1:
    l[i]=9
  else:
    l[i]=1
print(l)

Fixed submission:
l=list(input())
for i in range(3):
  if l[i]=='1':
    l[i]='9'
  else:
    l[i]='1'
l="".join(l)
print(l)
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
l2=sort(l)
print(10*l2[2]+l2[1]+l2[0])

Fixed submission:
l=list(map(int,input().split()))
l2=sorted(l)
print(10*l2[2]+l2[1]+l2[0])
Buggy python submission (verdict: Time Limit Exceeded):
n,x=map(int,input().split())
l=list(map(int,input().split()))

def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list

if n==1:
    print(abs(x-l[0]))
else:
    l.append(x)
    minimum=min(l)
    maximum=max(l)
    delta=maximum-minimum
    if delta==1:
        print(1)
    else:
        kouho=make_divisor_list(delta)
        ans=1
        for num in kouho:
            signal=1
            j=0
            while(j<n):
                if (l[j]-minimum)%num!=0:
                    signal=0
                    break
                else:
                    j+=1
            if signal==1:
                ans=num
        print(ans)


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

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

kouho=[abs(l[i]-x) for i in range(n)]

ans=kouho[0]

for i in range(n-1):
  ans = gcd(ans,kouho[i+1])
  
print(ans)

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

def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list

if n==1:
    print(abs(x-l[0]))
else:
    l.append(x)
    minimum=min(l)
    maximum=max(l)
    delta=maximum-minimum
    if delta==1:
        print(1)
    else:
        kouho=make_divisor_list(delta)
        ans=1
        for num in kouho:
            signal=1
            for j in range(n):
                if (l[j]-minimum)%num!=0:
                    signal=0
            if signal==1:
                ans=num
        print(ans)

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

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

kouho=[abs(l[i]-x) for i in range(n)]

ans=kouho[0]

for i in range(n-1):
  ans = gcd(ans,kouho[i+1])
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

i=1
while(1):
    if i%2==0 and i%N==0:
        print(i)
        break
    else:
        i+=1

Fixed submission:
N=int(input())
if N%2==0:
    print(N)
else:
    print(N*2)
Buggy python submission (verdict: Time Limit Exceeded):
import math

beki=[]
beki.append(1)
x=int(input())
for i in range(int(math.sqrt(x))):
  p=2
  while(i**p<=x):
    beki.append(i**p)
    p+=1
print(beki)

Fixed submission:
import math

beki=[]
beki.append(1)
x=int(input())
for i in range(2,x):
  p=2
  while(i**p<=x):
    beki.append(i**p)
    p+=1
print(max(beki))
Buggy python submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink.append(list(map(int,input().split())))
for j in range(m):
  if drink[j][0]<=n:
    print(all-t[drink[j][0]]+drink[j][1])
  else:
    print(all)


Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink.append(list(map(int,input().split())))
for j in range(m):
  if drink[j][0]<=n:
    print(all-t[drink[j][0]-1]+drink[j][1])
  else:
    print(all)

Buggy python submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink.append(list(map(int,input().split())))
for j in range(m):
  print(all-t[drink[j][0]]+drink[j][1])

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink.append(list(map(int,input().split())))
for j in range(m):
  if drink[j][0]<=n:
    print(all-t[drink[j][0]-1]+drink[j][1])
  else:
    print(all)

Buggy python submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink[i]=list(map(int,input().split()))
for j in range(n):
  print(all-t[j]+drink[j][1])

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink.append(list(map(int,input().split())))
for j in range(m):
  if drink[j][0]<=n:
    print(all-t[drink[j][0]-1]+drink[j][1])
  else:
    print(all)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
sum=0
for i in range(n):
  if l[l[i]]==i:
    sum+=1
print(int(sum/2))

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
sum=0
for i in range(n):
  key=l[i]
  if l[key-1]==i+1:
    sum+=1
print(int(sum/2))
Buggy python submission (verdict: Runtime Error):
l=raw_input().split()
print l[0][0].upper()+l[1][0].upper()+l[2][0].upper()

Fixed submission:
l=raw_input().split()
print l[0][0].upper()+l[1][0].upper()+l[2][0].upper()
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(i, gcd(j, k))
print(ans)

Fixed submission:
# coding: utf-8
# Your code here!
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(i, gcd(j, k))
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
v = list(map(int,input().split()))
v.sort()
for i in range(N-1):
	v[i+1] = (v[i] + v[i+1])/2
print(v[N])

Fixed submission:
N = int(input())
v = list(map(int,input().split()))
v.sort()
for i in range(N-1):
	v[i+1] = (v[i] + v[i+1])/2
print(v[N-1])
Buggy python submission (verdict: Runtime Error):
N, H = input().strip().split(' ')
N, H =[int(N),int(H)]
L =list()
for i in range(0,N):
    X, Y = input().strip().split(' ')
    X, Y =[int(X), int(Y)]
    L.append([X,Y])

L0 = list()
for i in range(0,N):
    L0.append(L[i][0])

L1 = list()
for i in range(0,N):
    L1.append(L[i][1])

M = max(L0)
L2 = list()

for i in range(0,N):
    if L1[i] > M:
        L2.append(L1[i])

L2 = sorted(L2)

count = 0

for i in range(0,len(L2)):
    H -= L2[i]
    count += 1
    if H <= 0:
        print(count)
        break

if H > 0:
    if H % M ==0:
        count += H//M
        print(count)
    else:
        count += H//M + 1
        print(count)

Fixed submission:
x = list(input().strip().split('/'))
x[0] = 2018

print(str(x[0])+'/'+str(x[1])+'/'+str(x[2]))
Buggy python submission (verdict: Runtime Error):
from functools import reduce

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

def solve(N, As):
    init_gcd = reduce(gcd, As, 0)
    Bs = list(map(lambda x: x // init_gcd, As))
    x = 1

    if N == 2:
        print(max(As[0], As[1]))
        raise "hoge"
    else:
        for idx, (b1, b2) in enumerate(zip(Bs, Bs[1:])):
            if gcd(b1, b2) == 1:
                gcd1 = reduce(gcd, Bs[:idx] + [b2] + Bs[idx + 1:], 0)
                gcd2 = reduce(gcd, Bs[:idx + 1] + [b1] + Bs[idx + 2:], 0)
                x = max(gcd1, gcd2)
                break
        print(init_gcd * x)
        return


if __name__ == '__main__':
    N = int(input()) # ignore
    As = list(map(int, input().split()))
    solve(N, As)


Fixed submission:
from functools import reduce

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

def solve(N, As):
    Lgcd = [0 for _ in range(len(As) + 1)]
    Rgcd = [0 for _ in range(len(As) + 1)]
    for i in range(len(As)):
        Lgcd[i + 1] = gcd(Lgcd[i], As[i])
    for i in reversed(range(len(As))):
        Rgcd[i] = gcd(Rgcd[i + 1], As[i])
    ans = 1
    for i in range(len(As)):
        ans = max(ans, gcd(Lgcd[i], Rgcd[i + 1]))
    print(ans)


if __name__ == '__main__':
    N = int(input()) # ignore
    As = list(map(int, input().split()))
    solve(N, As)