Buggy python submission (verdict: Runtime Error):
from itertools import product
 
def gcb(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        gcb_table[a][b] = a
    else:
        if gcb_table[a][b] == -1:
            gcb_table[a][b] = gcb(b, a%b)
    return gcb_table[a][b]

k = int(input())
gcb_table = [[-1 for _ in range(k+1)] for _ in range(k+1)]

for i in range(1, k+1):
    for j in range(1, k+1):
        temp = gcb(i, j)
        gcb_table[i][j] = temp
        gcb_table[j][i] = temp
        
res = 0
l_k = range(1, k+1)
for part in itertools.product(l_k, l_k, l_k):
    gcb_first = gcb_table[part[0]][part[1]]
    res += gcb_table[gcb_first][part[2]]
print(res)

Fixed submission:
def gcb(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        gcb_table[a][b] = a
    else:
        if gcb_table[a][b] == -1:
            gcb_table[a][b] = gcb(b, a%b)
    return gcb_table[a][b]

k = int(input())
gcb_table = [[-1 for _ in range(k+1)] for _ in range(k+1)]

for i in range(1, k+1):
    for j in range(1, k+1):
        temp = gcb(i, j)
        gcb_table[i][j] = temp
        gcb_table[j][i] = temp
        
res = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcb_first = gcb_table[a][b]
        for c in range(1, k+1):
            res += gcb_table[gcb_first][c]
print(res)

Buggy python submission (verdict: Runtime Error):
from itertools import product
 
def gcb(a, b):
  	if a < b:
      	a, b = b, a
    if b == 0:
        gcb_table[a][b] = a
    else:
        if gcb_table[a][b] == -1:
            gcb_table[a][b] = gcb(b, a%b)
    return gcb_table[a][b]
  
k = int(input())
gcb_table = [[-1 for _ in range(k+1)] for _ in range(k+1)]
 
for i in range(1, k+1):
    for j in range(1, k+1):
        temp = gcb(i, j)
        gcb_table[i][j] = temp
        gcb_table[j][i] = temp
        
res = 0
l_k = range(1, k+1)
for part in itertools.product(l_k, l_k, l_k):
    gcb_first = gcb_table[part[0]][part[1]]
    res += gcb_table[gcb_first][part[2]]
print(res)

Fixed submission:
def gcb(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        gcb_table[a][b] = a
    else:
        if gcb_table[a][b] == -1:
            gcb_table[a][b] = gcb(b, a%b)
    return gcb_table[a][b]

k = int(input())
gcb_table = [[-1 for _ in range(k+1)] for _ in range(k+1)]

for i in range(1, k+1):
    for j in range(1, k+1):
        temp = gcb(i, j)
        gcb_table[i][j] = temp
        gcb_table[j][i] = temp
        
res = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcb_first = gcb_table[a][b]
        for c in range(1, k+1):
            res += gcb_table[gcb_first][c]
print(res)

Buggy python submission (verdict: Runtime Error):
from itertools import product
 
def gcb(a, b):
    if b == 0:
        gcb_table[a][b] = a
    else:
        if gcb_table[a][b] == -1:
            gcb_table[a][b] = gcb(b, a%b)
    return gcb_table[a][b]

def gcb_3(a, b, c):
    return gcb(gcb(a, b), gcb(b, c))
  
k = int(input())
gcb_table = [[-1 for _ in range(k+1)] for _ in range(k+1)]

for i in range(1, k+1):
    for j in range(1, k+1):
        temp = gcb(i, j)
        gcb_table[i][j] = temp
        gcb_table[j][i] = temp
        
res = 0
l_k = range(1, k+1)
for part in itertools.product(l_k, l_k, l_k):
    gcb_first = gcb_table[part[0]][part[1]]
    res += gcb_table[gcb_first][part[2]]
print(res)

Fixed submission:
def gcb(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        gcb_table[a][b] = a
    else:
        if gcb_table[a][b] == -1:
            gcb_table[a][b] = gcb(b, a%b)
    return gcb_table[a][b]

k = int(input())
gcb_table = [[-1 for _ in range(k+1)] for _ in range(k+1)]

for i in range(1, k+1):
    for j in range(1, k+1):
        temp = gcb(i, j)
        gcb_table[i][j] = temp
        gcb_table[j][i] = temp
        
res = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcb_first = gcb_table[a][b]
        for c in range(1, k+1):
            res += gcb_table[gcb_first][c]
print(res)

Buggy python submission (verdict: Runtime Error):
from itertools import product

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

def gcb_3(a, b, c):
    return gcb(gcb(a, b), gcb(b, c))

k = int(input())
res = 0
l_k = range(1, k+1)
for part in itertools.product(l_k, l_k, l_k):
    res += gcb_3(part[0], part[1], part[2])
print(res)

Fixed submission:
def gcb(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        gcb_table[a][b] = a
    else:
        if gcb_table[a][b] == -1:
            gcb_table[a][b] = gcb(b, a%b)
    return gcb_table[a][b]

k = int(input())
gcb_table = [[-1 for _ in range(k+1)] for _ in range(k+1)]

for i in range(1, k+1):
    for j in range(1, k+1):
        temp = gcb(i, j)
        gcb_table[i][j] = temp
        gcb_table[j][i] = temp
        
res = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        gcb_first = gcb_table[a][b]
        for c in range(1, k+1):
            res += gcb_table[gcb_first][c]
print(res)