Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a,b=input().split()

if(a=b):
  print("Yes")
  
if(a!=b):
  print("No")

Fixed submission:
a,b=input().split()
if(a==b):
  print("Yes")
if(a!=b):
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b=input().split

if(a=b):
  print("Yes")
  
if(a!=b):
  print("No")

Fixed submission:
a,b=input().split()
if(a==b):
  print("Yes")
if(a!=b):
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b=input.split()

if(a=b):
  print("Yes")
  
if(a!=b):
  print("No")

Fixed submission:
a,b=input().split()
if(a==b):
  print("Yes")
if(a!=b):
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c,=(int(x) for x in input().split())

if a+b+c<=21:
  print(win)
  
else:
  print(bust)

Fixed submission:
a,b,c,=(int(x) for x in input().split())
 
if a+b+c<=21:
  print("win")
  
else:
  print("bust")
Buggy python submission (verdict: Runtime Error):
from sys import stdin
n=int(stdin.readline())
l=map(int,stdin.readline().split())
ans=0
for i in l:
  ans^=i
if ans:
  stdout.write("No")
else:
  stdout.write("Yes")

Fixed submission:
n=input()
l=map(int,raw_input().split())
ans=0
for i in xrange (n):
  ans^=l[i]
if ans:
  print "No"
else:
  print "Yes"

Buggy python submission (verdict: Runtime Error):
n=input()
l=map(int,raw_input().split())
flag=0
for i in xrange (n-1):
  p=list(l)
  del p[i]
  del p[i+1]
  if (l[i]^l[i+1]) not in p:
    flag=1
    break
if flag:
  print "No"
else:
  print "Yes"

Fixed submission:
n=input()
l=map(int,raw_input().split())
ans=0
for i in xrange (n):
  ans^=l[i]
if ans:
  print "No"
else:
  print "Yes"
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
l1 = min(x)
l2 = max(x)
ans = 0
for i in range(l1, l2+1):
    for j in x:
        sum += (i-j)**2
    if sum > ans:
        ans = sum
print(ans)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
l1 = min(x)
l2 = max(x)
ans = 100000000
for i in range(l1, l2+1):
    sum = 0
    for j in x:
        sum += (i-j)**2
    if sum < ans:
        ans = sum
print(ans)
Buggy python submission (verdict: Runtime Error):
*l = map(int, input().split())
if len(set(l)) == 2:
    print('Yes')
else:
    print('No')

Fixed submission:
l = list(map(int, input().split()))
if len(set(l)) == 2:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
ans = 0
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+j+l == s:
                ans += 1
print(ans)

Fixed submission:
k, s = map(int, input().split())
ans = 0
for i in range(k+1):
    for j in range(k+1):
        if s <= i+j+k and i+j <= s:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

for i in range(N):
    print(A.count(i+1))

Fixed submission:
N = int(input())

A = [int(i) for i in input().split()]

S = [0] * (N+1)

for i in A:
    S[i] += 1 

for s in S[1:]:
    print(s)
Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split()) 
A = [list(map(int,input().split())) for i in range(M)]

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)


Fixed submission:
N, M = map(int,input().split()) 
A = list(map(int,input().split()))

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split()) 
P = [list(map(int,input().split())) for i in range(M)]

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)

Fixed submission:
N, M = map(int,input().split()) 
A = list(map(int,input().split()))

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [list(map(int,input().split())) for i in range(M)]

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)


Fixed submission:
N, M = map(int,input().split()) 
A = list(map(int,input().split()))

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input().split() for i in range(M)]

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)

Fixed submission:
N, M = map(int,input().split()) 
A = list(map(int,input().split()))

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()

d = a
a = b
b = d

d = a
a = c
c = d

print(a, b, c)

Fixed submission:
a ,b ,c = map(int,input().split())

d = a
a = b
b = d

d = a
a = c
c = d

print(a, b, c)
Buggy python submission (verdict: Runtime Error):
S = input()
if S[0] == S[1] and s[1] == S[2]:
  print('No')
else:
  print('Yes')


Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2]:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
S = input()
if S[0] == S[1] and s[1] == S[2]:
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2]:
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
S = input()
if S[0] == S[1] and s[1] == S[2]:
  print("No")
else:
  print("Yes)

Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2]:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
h,w = [int(x) for x in stdin.readline().rstrip().split()]
import math
def bishop(h,w):
    if h == 1:
        ans = 1
    else:
        ans = int(w/2)*h + (w%2)*math.ceil(h/2)
    return ans

Fixed submission:
from sys import stdin
import math

h,w = [int(x) for x in stdin.readline().rstrip().split()]
if (h==1)|(w==1):
    ans = 1
else:
    ans = int(w/2)*h + (w%2)*math.ceil(h/2)
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce


dic = {}
ans = 0
n = int(input())
for i in range(n):
    for j in range(n):
        for k in range(n):
            key=(i+1)*(j+1)*(k+1)
            if key in dic:
                ans = ans+dic[key]
            else:
                val = gcd(gcd(i+1, j+1), k+1)
                dic[key] = val
                ans = ans + val
print(ans)

Fixed submission:
from math import gcd
k = int(input())+1
ans = 0
for i in range(1,k):
    for j in range(1,k):
        for l in range(1,k):
            ans+=gcd(gcd(i,j),l)
print(ans)

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

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

ans = 0
n = int(input())
for i in range(n):
  for j in range(n):
    for k in range(n):
      ans += gcd(i+1, j+1, k+1)
print(ans)

Fixed submission:
from math import gcd
k = int(input())+1
ans = 0
for i in range(1,k):
    for j in range(1,k):
        for l in range(1,k):
            ans+=gcd(gcd(i,j),l)
print(ans)
Buggy python submission (verdict: Runtime Error):
a = map(int, input())
s = map(str, input())

if a>=3200:
  print(s)
else:
  print('red')

Fixed submission:
a = int(input())
s = str(input())
 
if a>=3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Runtime Error):
a = int(input())
i = 1
cnt = 0
while i <= a:
  if len(i)%2 == 1:
    cnt += 1
  i += 1

print("{}".format(cnt))

Fixed submission:
a = int(input())
i = 1
cnt = 0
while i <= a:
  if len(str(i))%2 == 1:
    cnt += 1
  i += 1
 
print("{}".format(cnt))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())

lst_s = s.split()
lst = [int(str) for str in lst_s]
i = 0
flg = 0

while i <= n-2 and n > 1:
  if lst[i] == lst[i+1]:
    continue
  elif lst[i] < lst[i+1]:
    lst[i+1] -= 1
  else:
    flg = 1  
  i += 1

if flg == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
s = str(input())

lst_s = s.split()
lst = [int(str) for str in lst_s]
i = 0
flg = 0

if lst[0] > 1:
  lst[0] -= 1

while i <= n-2 and n > 1:
  if lst[i] < lst[i+1]:
    lst[i+1] -= 1
  elif lst[i] > lst[i+1]:
    flg = 1  
  i += 1

if flg == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)

for i in range(0,n+1):
    for j in range(0,n-1):
        if a[j]==i:
            ans[i]+=1
ans=ans[1:]
ansstr=''
for i in range(len(ans)):
    print(ans[i])



Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)

for i in range(len(a)):
    ans[a[i]]+=1
ans=ans[1:]
ansstr=''
for i in range(len(ans)):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if (a==b) and (b==c):
                ans+=np.gcd(a,np.gcd(b,c))
            if ((a!=b) and (b==c)) or ((a==b) and (b!=c)):
                ans+=3*np.gcd(a,np.gcd(b,c))
            if ((a!=b) and (b!=c)):
                ans+=6*np.gcd(a,np.gcd(b,c))
print(ans)

Fixed submission:
import math

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if (a==b) and (b==c):
                ans+=math.gcd(a,math.gcd(b,c))
            if ((a!=b) and (b==c)) or ((a==b) and (b!=c)):
                ans+=3*math.gcd(a,math.gcd(b,c))
            if ((a!=b) and (b!=c)):
                ans+=6*math.gcd(a,math.gcd(b,c))
print(ans)

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

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=np.gcd(a,np.gcd(b,c))
print(ans)

Fixed submission:
import math

k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,a+1):
        for c in range(1,b+1):
            if (a==b) and (b==c):
                ans+=math.gcd(a,math.gcd(b,c))
            if ((a!=b) and (b==c)) or ((a==b) and (b!=c)):
                ans+=3*math.gcd(a,math.gcd(b,c))
            if ((a!=b) and (b!=c)):
                ans+=6*math.gcd(a,math.gcd(b,c))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def distance(i,j,x,y):
    return min(j-i,abs(x-i)+abs(y-j)+1,abs(y-i)+abs(x-j)+1)


n,x,y=map(int,input().split())
for k in range(1,n):
    ans=0
    for i in range(1,n+1):
        for j in range(i,n+1):
            if distance(i,j,x,y)==k:
                ans+=1
    print(ans)

Fixed submission:
def distance(i,j,x,y):
    return min(j-i,abs(x-i)+abs(y-j)+1,abs(y-i)+abs(x-j)+1)


n,x,y=map(int,input().split())

ans=[0]*n
for i in range(1,n+1):
    for j in range(i,n+1):
            ans[distance(i,j,x,y)-1]+=1
for i in range(n-1):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
def distance(i,j,x,y):
    return min(j-i,abs(x-i)+abs(y-j)+1,abs(y-i)+abs(x-j)+1)


n,x,y=map(int,input().split())
for k in range(1,n):
    ans=0
    for i in range(1,n+1):
        for j in range(i,n+1):
            if distance(i,j,x,y)==k:
                ans+=1
    print(ans)

Fixed submission:
def distance(i,j,x,y):
    return min(j-i,abs(x-i)+abs(y-j)+1,abs(y-i)+abs(x-j)+1)


n,x,y=map(int,input().split())

ans=[0]*n
for i in range(1,n+1):
    for j in range(i,n+1):
            ans[distance(i,j,x,y)-1]+=1
for i in range(n-1):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())

                    
print(2*np.pi*n)

Fixed submission:
import numpy as np
 
n = int(input())
 
                    
print(2*np.pi*n)
Buggy python submission (verdict: Time Limit Exceeded):
import math
a = 0
n = int(input())

def ggcd(i, j, k):
    a = math.gcd(i, j)
    b = math.gcd(k, a)
    return b

for i in range(1, n + 1):
    for j in range(1, n + 1):
        for k in range(1, n + 1):
            a += ggcd(i, j, k)

print(a)

Fixed submission:
import math
a = 0
n = int(input())

def ggcd(i, j, k):
    a = math.gcd(i, j)
    b = math.gcd(k, a)
    return b

for i in range(1, n + 1):
    for j in range(1, n + 1):
        for k in range(1, n + 1):
            a += ggcd(i, j, k)

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


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

li = list(map(int, input().split()))
n = li[0]
m = li[1]

print(combinations_count(m, 2)+combinations_count(n, 2))


Fixed submission:
import math


def combinations_count(n, r):
    try:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    except ValueError:
        return 0
    

li = list(map(int, input().split()))
n = li[0]
m = li[1]

print(combinations_count(m, 2)+combinations_count(n, 2))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split()))
mod = 1000000007
nums = [i for i in range(n + 1)]
ans = 0

for i in range(k, n + 2):
	ans += (sum(nums[-1 * i:]) - sum(nums[:i]) + 1) % mod
	ans %= mod
print(ans)


Fixed submission:
n, k = list(map(int, input().split()))
mod = 1000000007
nums = [i for i in range(n + 1)]
ans = 0

for i in range(k, n + 2):
	mx = n * (n + 1) // 2 - (n - i) * (n - i + 1) // 2
	mn = i * (i - 1) // 2
	ans += (mx - mn + 1) % mod
	ans %= mod
print(ans)
Buggy python submission (verdict: Runtime Error):
a = input()
if a[1] == '7' or a[2] == '7' or a[3] == '7' :
  print("Yes")
else :
  print("No")

Fixed submission:
a = input()
if a[0] == '7' or a[1] == '7' or a[2] == '7' :
  print("Yes")
else :
  print("No")

Buggy python submission (verdict: Runtime Error):
a = int(input())
if a[1] == 7 or a[2] == 7 or a[3] == 7 :
  print(Yes)
else :
  print(No)

Fixed submission:
a = input()
if a[0] == '7' or a[1] == '7' or a[2] == '7' :
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = []
for i in range(m+1) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = []
for i in range(m) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(a)
ans = []
for i in range(m+1) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = []
for i in range(m) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = []
for i in range(1, m+1) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = []
for i in range(m) :
  if a[i] < sum(a) / (4 * m) :
    continue
  else :
    ans.append(a[-1])

if len(ans) == m :
  print('Yes')
else :
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = []
if n % k == 0:
  print(0)
else :
  while n > 0 :
    n -= k
    a.append(n)
    
  if len(a) == 1 : 
    if a[-1] * -1 > n + k :
      print(n + k)
    else :
      print(a[-1] * -1)

  else :
    if (a[-1]) * -1 > a[-2] :
      print(a[-2])
    else :
      print((a[-1]) * -1)

Fixed submission:
n, k = map(int, input().split())
a = []
if n % k == 0:
  print(0)

elif n // k == 0 :
  if -(n - k) > n :
    print(n)
  else :
    print(-(n - k))

else :
  if n % k > (n % k) - k :
    print(-((n % k) - k))
  else :
    print(n % k)
Buggy python submission (verdict: Runtime Error):
s = input()
print(x * len(s))

Fixed submission:
s = input()
print('x' * len(s))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = a
count = 1
if b = 0 :
  count = 0
elif a >= b :
  count = 1
else :
  while True :
    count += 1
    ans += (a-1)
    if b <= ans:
      break
  
print(count)

Fixed submission:
a, b = map(int, input().split())
ans = a
count = 1
if b == 1 :
  count = 0
elif a >= b :
  count = 1
else :
  while True :
    count += 1
    ans += (a-1)
    if b <= ans:
      break
  
print(count)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = a
count = 1
if b = 1 :
  count = 0
elif a >= b :
  count = 1
else :
  while True :
    count += 1
    ans += (a-1)
    if b <= ans:
      break
  
print(count)

Fixed submission:
a, b = map(int, input().split())
ans = a
count = 1
if b == 1 :
  count = 0
elif a >= b :
  count = 1
else :
  while True :
    count += 1
    ans += (a-1)
    if b <= ans:
      break
  
print(count)
Buggy python submission (verdict: Runtime Error):
n, a = map(int, input().split())
if int(n) < 500 :
  if a >= n :
    print("Yes")
  else :
    print("No")
  
elif n % 500 <= a :
  print("Yes")
else :
  print("No")

Fixed submission:
n = int(input())
a = int(input())
if int(n) < 500 :
  if a >= n :
    print("Yes")
  else :
    print("No")
  
elif n % 500 <= a :
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if 1 <= a <=10000 and 1 <= b <= 10000:
  print(a, b)
  if (a*b) % 2:
    print("odd")
  else:
    print("even")

Fixed submission:
a, b = map(int, input().split())
if a*b % 2 :
  print("Odd")
else:
  print("Even")
Buggy python submission (verdict: Runtime Error):
s = list(input())
for num in s :
  if num == "A":
    index1 = s.index(num)
    continue
  if num == "Z":
    index2 = s.index(num)
    break
    
print(index2 - index1 + 1)

Fixed submission:
s = list(input())
count = 0
index1 = s.index("A")
    
for num in s[::-1]:
  if num == "Z":  
    break
  else :
    count += 1

print(len(s) - (index1 + count))
Buggy python submission (verdict: Runtime Error):
n,m =map(int,input().split())
A = list(map(int, input().split())) 

souwa = sum(A)
print(souwa)

hyou = 1(4*souwa)i
ninki = 0

for i in range(A):
    if A(i)>hyou:
      ninki = ninki + 1

if m == souwa:
     print('Yes')
else:
    print('No')

Fixed submission:
n,m =map(int,input().split())
A = list(map(int, input().split())) 

souwa = sum(A)
hyou = souwa/(4*m)
ninki = 0

for number in A:
  if number >= hyou:
    ninki = ninki + 1

if m <= ninki:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
 
while True:
  zet = abs(n-k)
  if zet == 0:
    print(zet)
    break
  if zet > n:
    print(n)
    break
  n = zet

Fixed submission:
n,k =map(int,input().split())

syou = n//k

zet = abs(n-k*syou)
if zet == 0:
  print(zet)
else:
  zet1 = abs(n-k*(syou+1))
  if zet > zet1:
    print(zet1)
  else: 
    print(zet)

Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
test = n
while True:
  zet = abs(test-k)
  if zet == 0:
    print(zet)
    break
  if zet > test:
    print(test)
    break
  test = zet

Fixed submission:
n,k =map(int,input().split())

syou = n//k

zet = abs(n-k*syou)
if zet == 0:
  print(zet)
else:
  zet1 = abs(n-k*(syou+1))
  if zet > zet1:
    print(zet1)
  else: 
    print(zet)

Buggy python submission (verdict: Runtime Error):
n,k =map(int,input().split())

test = n

while True:
  zet = abs(test-k)
  if zet == 0:
    print(zet)
    break
  if zet > test:
    print(f)
    break
  test = zet

Fixed submission:
n,k =map(int,input().split())

syou = n//k

zet = abs(n-k*syou)
if zet == 0:
  print(zet)
else:
  zet1 = abs(n-k*(syou+1))
  if zet > zet1:
    print(zet1)
  else: 
    print(zet)
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(input())

n_dot = n*(n-1)/2
m_dot = m*(m-1)/2

answer = int(n_dot+ m_dot)
print(answer)

Fixed submission:
n,m=(int(x) for x in input().split())

n_dot = n*(n-1)/2
m_dot = m*(m-1)/2

answer = int(n_dot+ m_dot)
print(answer)

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

n_dot = n*(n-1)/2
m_dot = m*(m-1)/2

answer = n_dot+ m_dot
print(answer)

Fixed submission:
n,m=(int(x) for x in input().split())

n_dot = n*(n-1)/2
m_dot = m*(m-1)/2

answer = int(n_dot+ m_dot)
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
import math
 
k = int(input())
ans = 0
 
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += math.gcd(math.gcd(a, b), c)
 
print(ans)

Fixed submission:
import math
 
k = int(input())
ans = 0
 
for a in range(1, k+1):
    for b in range(1, k+1):
        tmp = math.gcd(a,b)
        for c in range(1, k+1):
            ans += math.gcd(tmp, c)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
 
k = int(input())
ans = 0
 
for a in range(1, k+1):
    for b in range(1, k+1):
        tmp = fractions.gcd(a, b)
        for c in range(1, k+1):
            ans += fractions.gcd(tmp, c)
 
print(ans)

Fixed submission:
import math
 
k = int(input())
ans = 0
 
for a in range(1, k+1):
    for b in range(1, k+1):
        tmp = math.gcd(a,b)
        for c in range(1, k+1):
            ans += math.gcd(tmp, c)
 
print(ans)

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

k = int(input())
ans = 0

for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += fractions.gcd(fractions.gcd(a, b), c)

print(ans)

Fixed submission:
import math
 
k = int(input())
ans = 0
 
for a in range(1, k+1):
    for b in range(1, k+1):
        tmp = math.gcd(a,b)
        for c in range(1, k+1):
            ans += math.gcd(tmp, c)
 
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
k = [int(a) for a in input().split()]
k_set = set(k)
all = 0
count_dic = {}

for b in k_set:
    tmp = k.count(b)
    all += tmp * (tmp - 1) // 2
    count_dic[b] = tmp

for c in k:
    tmp = count_dic[c]
    print(all - (tmp - 1))

Fixed submission:
import collections

n = int(input())
k = [int(a) for a in input().split()]
k_set = set(k)
all = 0
count_dic = collections.Counter(k)

for b in k_set:
    tmp = count_dic[b]
    all += tmp * (tmp - 1) // 2

for c in k:
    tmp = count_dic[c]
    print(all - (tmp - 1))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
k = [int(a) for a in input().split()]
k_set = set(k)
all = 0

for b in k_set:
    tmp = k.count(b)
    all += tmp * (tmp - 1) // 2

for c in k:
    tmp = k.count(c)
    print(all - (tmp - 1))

Fixed submission:
import collections

n = int(input())
k = [int(a) for a in input().split()]
k_set = set(k)
all = 0
count_dic = collections.Counter(k)

for b in k_set:
    tmp = count_dic[b]
    all += tmp * (tmp - 1) // 2

for c in k:
    tmp = count_dic[c]
    print(all - (tmp - 1))