Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

print(S)

Fixed submission:
import math


K = int(input())
S=0
for i in range(1,K+1):
    for j in range(1,K+1):
        s=math.gcd(i,j)
        for k in range(1,K+1):
            S += math.gcd(s,k)

print(S)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())
list_A=[]
for i in range(K-1):
    for j in range(K-1):
        for k in range(K-1):
            list_A.append(gcd(i+2,j+2,k+2))
print(sum(list_A)+K**2+(K**2-K)+(K**2-2*K)+1)

Fixed submission:
import math


K = int(input())
S=0
for i in range(1,K+1):
    for j in range(1,K+1):
        s=math.gcd(i,j)
        for k in range(1,K+1):
            S += math.gcd(s,k)

print(S)

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

def gcdlist(l):
    a = l[0]
    for i in range(len(l)):
        a = math.gcd(a,l[i])
    return a

K = int(input())
list_A=[]
for i in range(K-1):
    for j in range(K-1):
        for k in range(K-1):
            list_A.append(gcdlist([i+2,j+2,k+2]))
print(sum(list_A)+K**2+(K**2-K)+(K**2-2*K)+1)

Fixed submission:
import math


K = int(input())
S=0
for i in range(1,K+1):
    for j in range(1,K+1):
        s=math.gcd(i,j)
        for k in range(1,K+1):
            S += math.gcd(s,k)

print(S)

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

def gcdlist(l):
    a = l[0]
    for i in range(len(l)):
        a = math.gcd(a,l[i])
    return a

K = int(input())
list_A=[]
for i in range(K):
    for j in range(K):
        for k in range(K-1):
            #print(gcdlist([i+1,j+1,k+2]))
            list_A.append(gcdlist([i+1,j+1,k+2]))
print(sum(list_A)+K**2)

Fixed submission:
import math


K = int(input())
S=0
for i in range(1,K+1):
    for j in range(1,K+1):
        s=math.gcd(i,j)
        for k in range(1,K+1):
            S += math.gcd(s,k)

print(S)

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

def gcdlist(l):
    a = l[0]
    for i in range(len(l)):
        a = math.gcd(a,l[i])
    return a

K = int(input())
list_A=[]
for i in range(K):
    for j in range(K):
        for k in range(K):
            list_A.append(gcdlist([i+1,j+1,k+1]))
print(sum(list_A))

Fixed submission:
import math


K = int(input())
S=0
for i in range(1,K+1):
    for j in range(1,K+1):
        s=math.gcd(i,j)
        for k in range(1,K+1):
            S += math.gcd(s,k)

print(S)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

K = int(input())
list_A=[]
for i in range(K):
    for j in range(K):
        for k in range(K):
            list_A.append(np.gcd.reduce([i+1,j+1,k+1]))
print(sum(list_A))

Fixed submission:
import math


K = int(input())
S=0
for i in range(1,K+1):
    for j in range(1,K+1):
        s=math.gcd(i,j)
        for k in range(1,K+1):
            S += math.gcd(s,k)

print(S)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
K = int(input())
list_A=[]
for i in range(K):
    for j in range(K):
        for k in range(K):
            list_A.append(gcd(i+1,j+1,k+1))
print(sum(list_A))

Fixed submission:
import math


K = int(input())
S=0
for i in range(1,K+1):
    for j in range(1,K+1):
        s=math.gcd(i,j)
        for k in range(1,K+1):
            S += math.gcd(s,k)

print(S)