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

from collections import deque 
from functools import reduce
from functools import lru_cache

# input = sys.stdin.readline

n = int(input())

gcd_num = 0

for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            g = math.gcd(i, j)
            gcd_num += math.gcd(g, k)
print(gcd_num)

Fixed submission:
import sys
import numpy as np
import math

from collections import deque 
from functools import reduce
from functools import lru_cache

# input = sys.stdin.readline

n = int(input())

gcd_num = 0

for i in range(1, n+1):
    for j in range(1, n+1):
        g = math.gcd(i, j)
        for k in range(1, n+1):
            gcd_num += math.gcd(g, k)
print(gcd_num)

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

from collections import deque 
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

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

def gcd_list2(numbers):
    if (numbers[0] == 1 or numbers[1] == 1 or numbers[2] == 1):
        return 1
    return reduce(math.gcd, numbers)
  
def gcd_list3(numbers):
    g = math.gcd(numbers[0], numbers[1])
    return math.gcd(g, numbers[2])

@lru_cache(maxsize=None)
def gc(a, b):
    if (a % b == 0):
        return b
    return(gc(b, a%b))  

n = int(input())

sum = 0

for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
#            if (i < j):
#                g = gc(i, j)
#            else:
#                g = gc(j, i)
#            if (g < k):
#                sum += gc(g, k)
#            else:
#                sum += gc(k, g)
            sum += gc(gc(i, j), k)
#            sum += gcd_list3([i, j, k])
print(sum)            

Fixed submission:
import sys
import numpy as np
import math

from collections import deque 
from functools import reduce
from functools import lru_cache

# input = sys.stdin.readline

n = int(input())

gcd_num = 0

for i in range(1, n+1):
    for j in range(1, n+1):
        g = math.gcd(i, j)
        for k in range(1, n+1):
            gcd_num += math.gcd(g, k)
print(gcd_num)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
import math
# for AtCoder
# import fractions
from collections import deque 
from functools import reduce
from functools import lru_cache

# input = sys.stdin.readline

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

n = int(input())

sum = 0

for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            sum += gcd_list([i, j, k])
print(sum)            

Fixed submission:
import sys
import numpy as np
import math

from collections import deque 
from functools import reduce
from functools import lru_cache

# input = sys.stdin.readline

n = int(input())

gcd_num = 0

for i in range(1, n+1):
    for j in range(1, n+1):
        g = math.gcd(i, j)
        for k in range(1, n+1):
            gcd_num += math.gcd(g, k)
print(gcd_num)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
import math
# for AtCoder
import fractions
from collections import deque 
from functools import reduce

# input = sys.stdin.readline

n = int(input())

sum = 0

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

for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            sum += gcd_list([i, j, k])
print(sum)


Fixed submission:
import sys
import numpy as np
import math

from collections import deque 
from functools import reduce
from functools import lru_cache

# input = sys.stdin.readline

n = int(input())

gcd_num = 0

for i in range(1, n+1):
    for j in range(1, n+1):
        g = math.gcd(i, j)
        for k in range(1, n+1):
            gcd_num += math.gcd(g, k)
print(gcd_num)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
import math
# for AtCoder
import fractions
from collections import deque 
from functools import reduce

# input = sys.stdin.readline

n = int(input())

sum = 0

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

for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            sum += gcd_list([i, j, k])
print(sum)


Fixed submission:
import sys
import numpy as np
import math

from collections import deque 
from functools import reduce
from functools import lru_cache

# input = sys.stdin.readline

n = int(input())

gcd_num = 0

for i in range(1, n+1):
    for j in range(1, n+1):
        g = math.gcd(i, j)
        for k in range(1, n+1):
            gcd_num += math.gcd(g, k)
print(gcd_num)