Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
abc = list(map(int, input().split()))
ans = 'YES'
abc = sorted(abc)
for i in range(n):
  if abc[i] = abc[i+1]
  ans ='NO'

print(ans)


Fixed submission:
n = int(input())
abc = list(map(int, input().split()))
ans = 'YES'
abc = sorted(abc)
for i in range(n-1):
  if abc[i] == abc[i+1]:
  	ans ='NO'

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
abc = list(map(int, input().split()))
ans = 'YES'
for i in range(n):
  for j in range(i+1,n):
    if abc[i] == abc[j]:
      ans = 'NO'
      break
  if ans == 'NO':
    break

print(ans)

Fixed submission:
n = int(input())
abc = list(map(int, input().split()))
ans = 'YES'
abc = sorted(abc)
for i in range(n-1):
  if abc[i] == abc[i+1]:
  	ans ='NO'

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
elif
  print("No")


Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
s = input()
if s[3] == s[4] and s[5] == s[6]:
  print("Yes")
elif
  print("No

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = int(1)
for i in range(n):
    ans *= a[i]
if ans <= 10 ** 18:
    print(ans)
else:
    print("-1")

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = int(1)
a.sort(reverse=True)
for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
        ans = ("-1")
        break
if 0 in a:
    ans = 0
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = list(map(int,input().strip().split()))
ans = int(0)
for i in range(k):
    if a > 0:
        ans += 1
        a -= 1
    elif b > 0:
        b -= 1
    else:
        ans -= 1
        c -= 1
print(ans)

Fixed submission:
a, b, c, k = list(map(int,input().strip().split()))
ans = int(0)
if k >= a:
    ans += a
    k -= a
else:
    ans += k
    k = 0
if k >= b:
    k -= b
if k >= c:
    ans -= c
else:
    ans -= k
print(ans)
Buggy python submission (verdict: Runtime Error):
s = str(input())
if s == "ABC":
    print("ARC")
else:
    print(ABC)

Fixed submission:
s = str(input())
if s == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
n,m = list(map(int,input().strip().split()))
h = list(map(int,input().split()))
temp = [1] * n
ans = int(0)
for i in range(m):
    a,b = list(map(int,input().strip().split()))
    if h[a-1] > h[b-1]:
        temp[b-1] *= 0
    elif h[a-1] == h[b-i]:
        temp[a-1] *= 0
        temp[b-1] *= 0
    else:
        temp[a-1] *= 0
ans += temp.count(1)
print(ans)

Fixed submission:
n,m = list(map(int,input().strip().split()))
h = list(map(int,input().split()))
temp = [1] * n
ans = int(0)
for i in range(m):
    a,b = list(map(int,input().strip().split()))
    if h[a-1] > h[b-1]:
        temp[b-1] *= 0
    elif h[a-1] == h[b-1]:
        temp[a-1] *= 0
        temp[b-1] *= 0
    else:
        temp[a-1] *= 0
ans += temp.count(1)
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m = list(map(int,input().strip().split()))
h = list(map(int,input().split()))
temp = [1] * n
for i in range(m):
    a,b = list(map(int,input().strip().split()))
    if h[a-1] > h[b-1]:
        temp[b-1] *= 0
    elif h[a-1] == h[b-i]:
        temp[a-1] *= 0
        temp[b-1] *= 0
    else:
        temp[a-1] *= 0
ans = temp.count(1)
print(ans)



Fixed submission:
n,m = list(map(int,input().strip().split()))
h = list(map(int,input().split()))
temp = [1] * n
ans = int(0)
for i in range(m):
    a,b = list(map(int,input().strip().split()))
    if h[a-1] > h[b-1]:
        temp[b-1] *= 0
    elif h[a-1] == h[b-1]:
        temp[a-1] *= 0
        temp[b-1] *= 0
    else:
        temp[a-1] *= 0
ans += temp.count(1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
temp = int(100)

while temp < x:
    temp *= 0.01

print(temp)

Fixed submission:
import math
x = int(input())
temp = int(100)
ans = int(0)
while temp < x:
    temp += math.floor(temp * 0.01)
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().strip().split()))
ans = "YES"
for i in range(n - 1):
    for j in range(i, n - i - 1):
        if a[i] == a[j + 1]:
            ans = "NO"
print(ans)        

Fixed submission:
n = int(input())
a = list(map(int,input().strip().split()))
ans = "YES"
dic = {}
for i in range(n):
    temp = str(a[i])
    if temp in dic:
        ans = "NO"
    else:
        dic[temp] = 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(input().split()))
h.sort()
ans = int(0)
for i in range(len(h) - k):
    ans += int(h[i])
print(ans)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = sorted(h, reverse=True)
ans = 0
for i in range(k, n):
  ans+=h[i]
  
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(input().split())
h.sort()
ans = int(0)
if k >= n:
    print(ans)
else:
    for i in range(n - k):
        ans += int(h[i])
    print(ans)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = sorted(h, reverse=True)
ans = 0
for i in range(k, n):
  ans+=h[i]
  
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(input().split())
h.sort()
ans = int(0)
if k>=n:
  print(ans)
else:
	for i in range(n - k):
    	ans += int(h[i])
	print(ans)


Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = sorted(h, reverse=True)
ans = 0
for i in range(k, n):
  ans+=h[i]
  
print(ans)
Buggy python submission (verdict: Runtime Error):
x = str(input())
lx = len(x)
num = lx - 2
head = int(x[:num])
body = int(x[num:])
up = head * 5
ans = int(0)
if body <= up:
    ans = 1
else:
    ans = 0
if int(x) > 615 * 1000000:
    ans = 0
print(ans)

Fixed submission:
x = str(input())
lx = len(x)
num = lx - 2
if int(x) >= 100:
    head = int(x[:num])
    body = int(x[num:])
    up = head * 5
    ans = int(0)
    if body <= up:
        ans = 1
    else:
        ans = 0
else:
    ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
x = str(input())
lx = len(x)
num = lx - 2
head = int(x[:num])
body = int(x[num:])
up = head * 5
ans = int(0)
if body <= up:
    ans = 1
else:
    ans = 0
if x > 615 * 1000000:
    ans = 0
print(ans)

Fixed submission:
x = str(input())
lx = len(x)
num = lx - 2
if int(x) >= 100:
    head = int(x[:num])
    body = int(x[num:])
    up = head * 5
    ans = int(0)
    if body <= up:
        ans = 1
    else:
        ans = 0
else:
    ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
x = str(input())
lx = len(x)
num = lx - 2
head = int(x[:num])
body = int(x[num:])
up = head * 5
if body <= up:
    print("1")
else:
    print("0")

Fixed submission:
x = str(input())
lx = len(x)
num = lx - 2
if int(x) >= 100:
    head = int(x[:num])
    body = int(x[num:])
    up = head * 5
    ans = int(0)
    if body <= up:
        ans = 1
    else:
        ans = 0
else:
    ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
p = int(A + B)
m = int(A - B)
c = int(A * B)
s = [p,m,c]
max(s)

Fixed submission:
A,B = list(map(int,input().split()))
p = int(A + B)
m = int(A - B)
c = int(A * B)
s = [p,m,c]
print(max(s))
Buggy python submission (verdict: Runtime Error):
6 4 3

Fixed submission:
A,B,C = list(map(int,input().strip().split()))
s = A - B
a = C - s
if a >= 0:
    print(a)
elif a < 0:
    print(0)
Buggy python submission (verdict: Runtime Error):
s = input()
before("Heisei")
after("TBD")
if s[7] == 1 or s[7] == 2 or s[7] == 3 or s[7] == 4:
    print(before)
else:
    print(after)

Fixed submission:
s = input()
before = ("Heisei")
after = ("TBD")
if s[6] == "1" and s[5] == "0":
    print(before)
elif s[6] == "2" and s[5] == "0":
    print(before)
elif s[6] == "3":
    print(before)
elif s[6] == "4":
    print(before)
else:
    print(after)
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int,input().strip()).split()))
ans1 = a + b
ans2 = b - a
if b % a == 0:
    print(ans1)
else:
    print(ans2)

Fixed submission:
a,b = list(map(int,input().strip().split()))
if b % a == 0:
    print(a + b)
else:
    print(b - a)

Buggy python submission (verdict: Runtime Error):
a,b = list(map(int,input().strip()).split())
ans1 = a + b
ans2 = b - a
if b % a == 0:
    print(ans1)
else:
    print(ans2)

Fixed submission:
a,b = list(map(int,input().strip().split()))
if b % a == 0:
    print(a + b)
else:
    print(b - a)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if(a==b and b==c):
  print("Yes")
else:
  print("No"

Fixed submission:
a,b,c=map(int,input().split())
if(a==b and b==c):
    print("No")
elif(a==b or b==c or c==a):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
first = 1

for i in range(q):
    t = input().split()
    if int(t[0]) == 1:
        first *= -1
    else:
        f = int(t[1])
        c = t[2]
        
        if first == 1:
            if f == 1:
                s = c + s
            elif f == 2:
                s = s + c
        else:
            if f == 1:
                s = s + c
            elif f == 2:
                s = c + s

if first == 1:
    print(s)
else:
    print(s[::-1])

Fixed submission:
from collections import deque

s = deque(input())
q = int(input())
first = 1

for i in range(q):
    t = input().split()
    if int(t[0]) == 1:
        first *= -1
    else:
        f = int(t[1])
        c = t[2]
        
        if first == 1:
            if f == 1:
                s.appendleft(c)
            elif f == 2:
                s.append(c)
        else:
            if f == 1:
                s.append(c)
            elif f == 2:
                s.appendleft(c)

S = "".join(s)
if first == 1:
    print(S)
else:
    print(S[::-1])

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

for i in range(q):
    t = input().split()
    if int(t[0]) == 1:
        s = s[::-1]
    else:
        f = int(t[1])
        c = t[2]
        
        if f == 1:
            s = c + s
        elif f == 2:
            s = s + c

print(s)

Fixed submission:
from collections import deque

s = deque(input())
q = int(input())
first = 1

for i in range(q):
    t = input().split()
    if int(t[0]) == 1:
        first *= -1
    else:
        f = int(t[1])
        c = t[2]
        
        if first == 1:
            if f == 1:
                s.appendleft(c)
            elif f == 2:
                s.append(c)
        else:
            if f == 1:
                s.append(c)
            elif f == 2:
                s.appendleft(c)

S = "".join(s)
if first == 1:
    print(S)
else:
    print(S[::-1])
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())

print(A-1*(K-A-B) if K >A+B else A)

Fixed submission:
A,B,C,K = map(int,input().split())

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K >A+B :
  print(2*A-K+B)
else :
  print(A)

Fixed submission:
A,B,C,K = map(int,input().split())

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())

if K >A+B :
  print(A-(K-A-B))
else :
  print(A)

Fixed submission:
A,B,C,K = map(int,input().split())

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())
S = A + B + C

if A >=K or A + B >=K:
  print(A)
else :
  print(A-1*(K-A-B))

Fixed submission:
A,B,C,K = map(int,input().split())

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
K = int(input())
S = A + B + C

if A >=K :
  print(1*A)
elif A + B >=K :
  print(1*A + 0*B)
else :
  print(1*A + 0*B -1*(K-A-B))

Fixed submission:
A,B,C,K = map(int,input().split())

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)
Buggy python submission (verdict: Runtime Error):
def resolve():
    N, K = map(int, input().split())
    A = tuple(map(int, input().split()))
    C = [0]*N
    path = []
    cur = 1
    for i in range(K):
        C[cur-1] += 1
        path.append(cur)
        cur = A[cur-1]
        if C.count(2) >= 1:
            init_c = path.index(cur) + 1
            break
    MOD = (K+1) % (len(path) - 1)
    for i in range(init_c, init_c+MOD+1):
        init_c = A[init_c]
    print(init_c)

if __name__ == '__main__':
    resolve()

Fixed submission:
def resolve():
    N, K = map(int, input().split())
    A = tuple(map(int, input().split()))
    path = [1]
    for i in range(2*N):
        cur = A[path[-1]-1]
        path.append(cur)

    if K < N:
        print(path[K])
        exit()

    end = N
    si = N-1
    while path[si] != path[end]:
        si -= 1
    dist = end - si
    K = K % dist
    while K < N:
        K += dist

    print(path[K])

if __name__ == '__main__':
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    import statistics
    n = input()
    x = list(map(int, input().split()))
    m = round(statistics.mean(x))
    sum_val = 0
    for val in x:
        sum_val += (val - m) ** 2

    print(sum_val)

if __name__ == '__main__':
    resolve()

Fixed submission:
def resolve():
    n, num = map(int, input().split())
    if n >= 10:
        print(num)
    else :
        print(num + 100*(10-n))

if __name__ == '__main__':
        resolve()
Buggy python submission (verdict: Runtime Error):
import numpy as np
 
def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.mean(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)
 
if __name__ == '__main__':
    resolve()

Fixed submission:
import numpy as np

def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.mean(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
    resolve()

Buggy python submission (verdict: Runtime Error):
import numpy as np

def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.median(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
    resolve()

Fixed submission:
import numpy as np

def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.mean(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
    resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    import statistics
    n = input()
    x = list(map(int, input().split()))
    m = round(statistics.mean(x))
    sum_val = 0
    for val in x:
        sum_val += (val - m) ** 2

    print(sum_val)

if __name__ == '__main__':
    resolve()

Fixed submission:
import numpy as np

def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.mean(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
    resolve()

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

def resolve():
    n = input()
    x = list(map(int, input().split()))
    m = round(statistics.mean(x))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
        resolve()

Fixed submission:
import numpy as np

def resolve():
    input()
    x = list(map(int, input().split()))
    m = int(round(np.mean(x)))
    sum = 0
    for val in x:
        sum += (val - m) ** 2
    print(sum)

if __name__ == '__main__':
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n = int(input())
    arr = tuple(input())
    count = n
    for i in range(n):
        c = 0
        left = arr[:i]
        right = arr[i+1:]
        c += sum([1 for j in left if j == 'W'])
        c += sum([1 for k in right if k == 'E'])
        count = min(c, count)

    print(count)

if __name__ == '__main__':
    resolve()

Fixed submission:
def resolve():
    n = int(input())
    S = list(input())
    min_c = n
    count_e = S.count('E')
    count_w = 0

    for s in S:
        if s == 'E':
            count_e -= 1
        min_c = min(min_c, count_e + count_w)
        if s == 'W':
            count_w += 1

    print(min_c)

if __name__ == '__main__':
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n = int(input())
    arr = list(input())
    count = n
    for i in range(n):
        c = 0
        left = arr[:i]
        right = arr[i+1:]
        c += left.count('W')
        c += right.count('E')
        count = min(c, count)

    print(count)

if __name__ == '__main__':
    resolve()

Fixed submission:
def resolve():
    n = int(input())
    S = list(input())
    min_c = n
    count_e = S.count('E')
    count_w = 0

    for s in S:
        if s == 'E':
            count_e -= 1
        min_c = min(min_c, count_e + count_w)
        if s == 'W':
            count_w += 1

    print(min_c)

if __name__ == '__main__':
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n = int(input())
    arr = list(input())
    count = n
    for i in range(n):
        c = 0
        left = arr[:i]
        right = arr[i+1:]
        c += left.count('W')
        c += right.count('E')
        count = min(c, count)

    print(count)

if __name__ == '__main__':
    resolve()

Fixed submission:
def resolve():
    n = int(input())
    S = list(input())
    min_c = n
    count_e = S.count('E')
    count_w = 0

    for s in S:
        if s == 'E':
            count_e -= 1
        min_c = min(min_c, count_e + count_w)
        if s == 'W':
            count_w += 1

    print(min_c)

if __name__ == '__main__':
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n = int(input())
    power = 1

    for i in range(1, n+1):
        power *= i

    print(power % (10**9 + 7))

if __name__ == '__main__':
    resolve()

Fixed submission:
import math
def resolve():
    n = int(input())
    power = 1

    power = power * math.factorial(n)

    print(power % (10**9 + 7))

if __name__ == '__main__':
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
josi = list(map(int,input().split()))
count=[0]*N
n=0
while n<N-1:
  count[josi[n]] =count[josi[n]]+1
  n=n+1
n=0
while n<N:
  print(count[n])

      

Fixed submission:
N=int(input())
josi = list(map(int,input().split()))
count=[0]*N
n=0
while n<N-1:
  count[josi[n]-1] =count[josi[n]-1]+1
  n=n+1
n=0
while n<N:
  print(count[n])
  n=n+1

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
josi = list(map(int,input().split()))
n=1
m=0
count=0
while n<=N:
  m = n-1 
  while m<N-1:
    if josi[m]==n:
      count = count+1
    m=m+1
  print(count)
  n=n+1
  m=0
  count=0

      

Fixed submission:
N=int(input())
josi = list(map(int,input().split()))
count=[0]*N
n=0
while n<N-1:
  count[josi[n]-1] =count[josi[n]-1]+1
  n=n+1
n=0
while n<N:
  print(count[n])
  n=n+1

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
josi = list(map(int,input().split()))
n=1
m=0
count=0
while n<=N:
  while m<N-1:
    if josi[m]==n:
      count = count+1
    m=m+1
  print(count)
  n=n+1
  m=0
  count=0

      

Fixed submission:
N=int(input())
josi = list(map(int,input().split()))
count=[0]*N
n=0
while n<N-1:
  count[josi[n]-1] =count[josi[n]-1]+1
  n=n+1
n=0
while n<N:
  print(count[n])
  n=n+1

Buggy python submission (verdict: Runtime Error):
N=int(input())
josi = list(map(int,input().split()))
n=1
m=0
count=0
while n<=N:
  m=n
  while m<N:
    if josi[m]=n:
      count = count+1
    m=m+1
  print(count)
  m=0
  count=0

      

Fixed submission:
N=int(input())
josi = list(map(int,input().split()))
count=[0]*N
n=0
while n<N-1:
  count[josi[n]-1] =count[josi[n]-1]+1
  n=n+1
n=0
while n<N:
  print(count[n])
  n=n+1
Buggy python submission (verdict: Runtime Error):
n = int(input())
n_lst = []
for i in range(n):
    n_lst.append(i+1)
    
##共通
kosu = n // 15
 
##3の倍数
a3 = n // 3
lst3 = []
for i in range(a3):
    n3 = 3 * (i+1)
    lst3.append(n3)
 
##5の倍数
a5 = n // 5
lst5 = []
for i in range(a5):
    n5 = 5 * (i+1)
    lst5.append(n5)
 
kosu2 = a5 - kosu
    
###リストから取り除く.strip
for i in range(a3):
    n_lst.remove(lst3[i])
for i in range(kosu2):
    n_lst.remove(lst5[i])
    
goke = sum(n_lst)
print(goke)

Fixed submission:
import math
from functools import reduce
 
k = int(input())
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
kotae = 0
for i in range(k):
    a = i + 1
    for j in range(k):
        b = j + 1
        for l in range(k):
            c = l + 1
            koyakusu = gcd(a, b, c)
            kotae += koyakusu
print(kotae)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
 
k = int(input())
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
kotae = 0
for i in range(k):
    a = i + 1
    for j in range(k):
        b = j + 1
        for l in range(k):
            c = l + 1
            koyakusu = gcd(a, b, c)
            kotae += koyakusu
print(kotae)

Fixed submission:
import math
from functools import reduce
 
k = int(input())
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
kotae = 0
for i in range(k):
    a = i + 1
    for j in range(k):
        b = j + 1
        for l in range(k):
            c = l + 1
            koyakusu = gcd(a, b, c)
            kotae += koyakusu
print(kotae)

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

Fixed submission:
import math
from functools import reduce
 
k = int(input())
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
kotae = 0
for i in range(k):
    a = i + 1
    for j in range(k):
        b = j + 1
        for l in range(k):
            c = l + 1
            koyakusu = gcd(a, b, c)
            kotae += koyakusu
print(kotae)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
 
k = int(input())
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
 
lst = []
for i in range(k):
    a = i + 1
    for j in range(k):
        b = j + 1
        for l in range(k):
            c = l + 1
            koyakusu = gcd(a, b, c)
            lst.append(koyakusu)
kotae = sum(lst)
print(kotae)

Fixed submission:
import math
from functools import reduce
 
k = int(input())
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
kotae = 0
for i in range(k):
    a = i + 1
    for j in range(k):
        b = j + 1
        for l in range(k):
            c = l + 1
            koyakusu = gcd(a, b, c)
            kotae += koyakusu
print(kotae)