Buggy python submission (verdict: Runtime Error):
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=math.gcd(math.gcd(n,i),j)

print(res)

Fixed submission:
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=gcd(gcd(n,i),j)

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())

import math
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=math.gcd(math.gcd(n,i),j)

print(res)

Fixed submission:
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=gcd(gcd(n,i),j)

print(res)

Buggy python submission (verdict: Runtime Error):
k=int(input())

import math
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=math.gcd(gcd(n,i),j)

print(res)

Fixed submission:
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=gcd(gcd(n,i),j)

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())

import math
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            ni=math.gcd(n, i)
            res+=math.gcd(ni,j)

print(res)

Fixed submission:
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=gcd(gcd(n,i),j)

print(res)

Buggy python submission (verdict: Time Limit Exceeded):


k=int(input())
 
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
res=0
l= list(range(1,k+1))

for n in l:
    for i in l:
        for j in l:
            res+=gcd(n, i,j)
 
print(res)


Fixed submission:
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=gcd(gcd(n,i),j)

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())

import math
import functools 
import itertools

res=0

l=range(1,k+1)

for i in itertools.product(l, repeat=3):
    new_l = list(set(i))
    if len(new_l)==1:
        res+=int(new_l[0])
    else:
        res+=functools.reduce(math.gcd,new_l)

print(res)

Fixed submission:
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=gcd(gcd(n,i),j)

print(res)

Buggy python submission (verdict: Time Limit Exceeded):

k=int(input())

import math
from functools import reduce

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

res=0

for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):
            res+=gcd(n, i,j)

print(res)





Fixed submission:
k=int(input())

from math import gcd
 
res=0
 
for n in range(1,k+1):
    for i in range(1,k+1):
        for j in range(1,k+1):

            res+=gcd(gcd(n,i),j)

print(res)