Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
import itertools
import numpy as np


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


K = int(input())

l = [i for i in range(1, K + 1)]

temp_1 = np.array([])
for j in itertools.combinations(l, 3):
    temp_1=np.append(temp_1,gcd_list(list(j)))

a=np.sum(temp_1)*6

temp_2 = np.array([])

for j in itertools.combinations(l, 2):
    temp_2=np.append(temp_2,gcd_list(list(j[0],j[0],j[1])))
    temp_2=np.append(temp_2,gcd_list(list(j[0],j[1],j[1])))
    
b=np.sum(temp_2)*3

temp_3 = np.array([])
for i in l:
    temp_3 = np.append(temp_3, gcd_list([i, i, i]))

print(int(np.sum(temp_3)+a+b))


Fixed submission:
import math
from functools import reduce
import itertools
import numpy as np

K = int(input())



ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            if i == j and j == k:
                dup_num = 1
            elif i == j or j == k:
                dup_num = 3
            else:
                dup_num = 6
            ans += math.gcd(math.gcd(i, j), k) * dup_num

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools
import numpy as np


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


K = int(input())

l = [i for i in range(1, K + 1)]

temp_sum = np.array([])
for j in itertools.product(l, repeat=3):
    temp_sum=np.append(temp_sum,gcd_list(list(j)))


print(int(np.sum(temp_sum)))

Fixed submission:
import math
from functools import reduce
import itertools
import numpy as np

K = int(input())



ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            if i == j and j == k:
                dup_num = 1
            elif i == j or j == k:
                dup_num = 3
            else:
                dup_num = 6
            ans += math.gcd(math.gcd(i, j), k) * dup_num

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools
import numpy as np


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


K = int(input())

#l = [i for i in range(1, K + 1)]

temp_sum = []
#for j in itertools.product(l, repeat=3):
#    temp_sum.append(gcd_list(list(j)))
for i in range(1,K+1):
    for j in range(1,K+1):
        for l in range(1,K+1):
            temp_sum.append(gcd_list([i,j,l]))

print(np.sum(temp_sum))

Fixed submission:
import math
from functools import reduce
import itertools
import numpy as np

K = int(input())



ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            if i == j and j == k:
                dup_num = 1
            elif i == j or j == k:
                dup_num = 3
            else:
                dup_num = 6
            ans += math.gcd(math.gcd(i, j), k) * dup_num

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools
import numpy as np
  
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K=int(input())
 
l = [i for i in range(1,K+1)]
 
temp_sum=[]
for j in itertools.product(l, repeat=3):
    temp_sum.append(gcd_list(list(j)))

print(np.sum(temp_sum))

Fixed submission:
import math
from functools import reduce
import itertools
import numpy as np

K = int(input())



ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            if i == j and j == k:
                dup_num = 1
            elif i == j or j == k:
                dup_num = 3
            else:
                dup_num = 6
            ans += math.gcd(math.gcd(i, j), k) * dup_num

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools
import numpy as np

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K=int(input())
 
l = [i for i in range(1,K+1)]
 
temp_sum=[]
for j in itertools.product(l, repeat=3):
    temp_sum.append(gcd_list(list(j)))

print(np.sum(temp_sum))

Fixed submission:
import math
from functools import reduce
import itertools
import numpy as np

K = int(input())



ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            if i == j and j == k:
                dup_num = 1
            elif i == j or j == k:
                dup_num = 3
            else:
                dup_num = 6
            ans += math.gcd(math.gcd(i, j), k) * dup_num

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K=int(input())

l = [i for i in range(1,K+1)]

temp_sum=0
for j in itertools.product(l, repeat=3):
    temp_sum+=gcd_list(list(j))

print(temp_sum)

Fixed submission:
import math
from functools import reduce
import itertools
import numpy as np

K = int(input())



ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            if i == j and j == k:
                dup_num = 1
            elif i == j or j == k:
                dup_num = 3
            else:
                dup_num = 6
            ans += math.gcd(math.gcd(i, j), k) * dup_num

print(ans)