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

v = int(input())
sum = 0

for i in range(1, v + 1):
    for j in range(1, v + 1):
        for k in range(1, v + 1):
            if i == 1 or j == 1 or k == 1:
                sum += 1
            else:
                sum += math.gcd(math.gcd(i, j), k)

print(sum)

Fixed submission:
from math import gcd

v = int(input())
sum = 0

for i in range(1, v + 1):
    for j in range(1, v + 1):
        for k in range(1, v + 1):
            sum += gcd(gcd(i, j), k)

print(sum)

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

v = int(input())
sum = 0

for i in range(v):
    i += 1
    for j in range(v):
        j += 1
        for k in range(v):
            k += 1
            if i == 1 or j == 1 or k == 1:
                sum += 1
            else:
                sum += math.gcd(math.gcd(i, j), k)

print(sum)

Fixed submission:
from math import gcd

v = int(input())
sum = 0

for i in range(1, v + 1):
    for j in range(1, v + 1):
        for k in range(1, v + 1):
            sum += gcd(gcd(i, j), k)

print(sum)

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

v = int(input())
sum = 0

for i in range(v):
    i += 1
    for j in range(v):
        j += 1
        for k in range(v):
            k += 1
            sum += math.gcd(math.gcd(i, j), k)

print(sum)

Fixed submission:
from math import gcd

v = int(input())
sum = 0

for i in range(1, v + 1):
    for j in range(1, v + 1):
        for k in range(1, v + 1):
            sum += gcd(gcd(i, j), k)

print(sum)

Buggy python submission (verdict: Runtime Error):
import math

v = int(input())
sum = 0

for i in range(v):
    i += 1
    for j in range(v):
        j += 1
        for k in range(v):
            k += 1
            sum += math.gcd(i, j, k)

print(sum)

Fixed submission:
from math import gcd

v = int(input())
sum = 0

for i in range(1, v + 1):
    for j in range(1, v + 1):
        for k in range(1, v + 1):
            sum += gcd(gcd(i, j), k)

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b, c):
    r = 1
    if a == 1 or b == 1 or c == 1:
        return 1
    for i in range(min(a, b, c) + 1):
        i += 1
        if a % i == 0 and b % i == 0 and c % i == 0:
            r = i
    return r

v = int(input())
sum = 0

for i in range(v):
    i += 1
    for j in range(v):
        j += 1
        for k in range(v):
            k += 1
            sum += gcd(i, j, k)

print(sum)

Fixed submission:
from math import gcd

v = int(input())
sum = 0

for i in range(1, v + 1):
    for j in range(1, v + 1):
        for k in range(1, v + 1):
            sum += gcd(gcd(i, j), k)

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b, c):
    r = 1
    for i in range(min(a, b, c) + 1):
        i += 1
        if a % i == 0 and b % i == 0 and c % i == 0:
            r = i
    return r

v = int(input())
sum = 0

for i in range(v):
    i += 1
    for j in range(v):
        j += 1
        for k in range(v):
            k += 1
            sum += gcd(i, j, k)

print(sum)

Fixed submission:
from math import gcd

v = int(input())
sum = 0

for i in range(1, v + 1):
    for j in range(1, v + 1):
        for k in range(1, v + 1):
            sum += gcd(gcd(i, j), k)

print(sum)