Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(_) for _ in input().split()]
for a in range(0, 10**9):
    if K**(a) <= N < K**(a*1):
        print(a+1)
        break

Fixed submission:
N, K = [int(_) for _ in input().split()]
for a in range(0, 10**9):
    if K**(a) <= N < K**(a+1):
        print(a+1)
        break

Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(_) for _ in input().split()]
for a in range(10**9):
    if K**(a) <= N < K**(a*1):
        print(a+1)
        break

Fixed submission:
N, K = [int(_) for _ in input().split()]
for a in range(0, 10**9):
    if K**(a) <= N < K**(a+1):
        print(a+1)
        break

Buggy python submission (verdict: Runtime Error):
N, K = [int(_) for _ in input().split()]
for a in range(10**9):
    if K**(a) <= N < K**(i*1):
        print(a+1)
        break

Fixed submission:
N, K = [int(_) for _ in input().split()]
for a in range(0, 10**9):
    if K**(a) <= N < K**(a+1):
        print(a+1)
        break
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    P = list(map(int,input().split()))
    cnt = 1
    for i in range(1, N):
        # Pi
        # P[0:i]
        Q = P[0:i]
        if P[i] > min(P[0:i]):
            cnt = cnt
        else:
            cnt += 1

        #Q = [ _ for _ in P[0:i] if P[i] <= _ ]  # TLE
        #for _ in P[0:i+1]:
        #    print(_)
        #if len(Q) == i:
        #    cnt += 1
    print(cnt)

main()

Fixed submission:
def main():
    N = int(input())
    P = list(map(int,input().split()))
    cnt = 0
    Q = max(P)
    for i in range(N):
        if Q >= P[i]:
            cnt += 1
            Q = P[i]
    print(cnt)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    P = list(map(int,input().split()))
    cnt = 1
    for i in range(1, N):
        # Pi
        # P[0:i]
        Q = P[0:i]
        if P[i] > min(P[0:i]):
            cnt = cnt
        else:
            cnt += 1

        #Q = [ _ for _ in P[0:i] if P[i] <= _ ]  # TLE
        #for _ in P[0:i+1]:
        #    print(_)
        #if len(Q) == i:
        #    cnt += 1
    print(cnt)

main()

Fixed submission:
def main():
    N = int(input())
    P = list(map(int,input().split()))
    cnt = 0
    Q = max(P)
    for i in range(N):
        if Q >= P[i]:
            cnt += 1
            Q = P[i]
    print(cnt)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    P = list(map(int,input().split()))
    cnt = 0
    for i in range(N):
        # Pi
        # P[0:i]
        Q = [ _ for _ in P[0:i] if P[i] <= _ ]
        #for _ in P[0:i+1]:
        #    print(_)
        if len(Q) == i:
            cnt += 1
    print(cnt)

main()

Fixed submission:
def main():
    N = int(input())
    P = list(map(int,input().split()))
    cnt = 0
    Q = max(P)
    for i in range(N):
        if Q >= P[i]:
            cnt += 1
            Q = P[i]
    print(cnt)

main()
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
if(a==b[:-1]):
  print("Yes")
else:
  print("No)

Fixed submission:
a = input()
b = input()
if(a==b[:-1]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a, b, c = int(input().split())
if a + b + c >= 22:
  print('bust')
if a + b + c <= 21:
  print('win')

Fixed submission:
a, b, c = map(int, input().split())
if a + b + c >= 22:
  print('bust')
if a + b + c <= 21:
  print('win')
Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.atan((v/a*a)/a))
elif x*2 == v:
	print(0)
else:
	print(math.atan((x/a*a)/a))


Fixed submission:
import math
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.degrees(math.atan2((2*(b-(x/(a*a)))), a)))
elif x == v:
	print(0)
else:
	print(90 - math.degrees(math.atan2(((2*x)/(a*b)), b)))

Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.atan((v/a*a)/a))
else:
	print(math.atan((x/a*a)/a))


Fixed submission:
import math
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.degrees(math.atan2((2*(b-(x/(a*a)))), a)))
elif x == v:
	print(0)
else:
	print(90 - math.degrees(math.atan2(((2*x)/(a*b)), b)))
Buggy python submission (verdict: Runtime Error):
import numpy as np
def gcd(a, b):
	if a > b:
		a, b = b, a
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
a = np.array([int(x) for x in input().split()])
np.sort(a)
l = np.zeros(n + 1)
r = np.zeros(n + 1)
m = np.zeros(n)
for i in range(n):
	l[i + 1] = gcd(l[i], a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i + 1], a[i])
for i in range(n):
	m[i] = gcd(l[i], r[i + 1])
print(int(np.max(m)))


Fixed submission:
import numpy as np
def gcd(a, b):
	if a < b:
		a, b = b, a
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
a = np.array([int(x) for x in input().split()])
np.sort(a)
l = np.zeros(n + 1)
r = np.zeros(n + 1)
m = np.zeros(n)
for i in range(n):
	l[i + 1] = gcd(l[i], a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i + 1], a[i])
for i in range(n):
	m[i] = gcd(l[i], r[i + 1])
print(int(np.max(m)))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

import bisect
n, q = map(int, readline().split())
s = readline().rstrip()
a = []
for i in range(len(s)):
	if s[i] == 'A' and s[i + 1] == 'C':
		a.append(i)
for _ in range(q):
	l, r = map(int, readline().split())
	l -= 1
	r -= 2
	print(bisect.bisect_right(a, r) - bisect.bisect_left(a, l))


Fixed submission:
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

import bisect
n, q = map(int, readline().split())
s = readline().rstrip()
a = []
for i in range(len(s) - 1):
	if s[i] == 'A' and s[i + 1] == 'C':
		a.append(i)
for _ in range(q):
	l, r = map(int, readline().split())
	l -= 1
	r -= 2
	print(bisect.bisect_right(a, r) - bisect.bisect_left(a, l))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n, q = map(int, readline().split())
s = readline().rstrip()
for _ in range(q):
	l, r = map(int, readline().split())
	l -= 1
	r -= 1
	ans = 0
	for i in range(l, r):
		if s[i] == 'A' and s[i + 1] == 'C':
			ans += 1
	print(ans)



Fixed submission:
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

import bisect
n, q = map(int, readline().split())
s = readline().rstrip()
a = []
for i in range(len(s) - 1):
	if s[i] == 'A' and s[i + 1] == 'C':
		a.append(i)
for _ in range(q):
	l, r = map(int, readline().split())
	l -= 1
	r -= 2
	print(bisect.bisect_right(a, r) - bisect.bisect_left(a, l))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys

n = int(input())
ans = 0
for _ in range(n):
	x, u = input().split()
	float(x)
	if u == "BTC":
		ans += x * 380000
	else:
		ans += x
print(x)


Fixed submission:
import numpy as np
import sys

n = int(input())
ans = 0
for _ in range(n):
	x, u = input().split()
	x = float(x)
	if u == "BTC":
		ans += x * 380000
	else:
		ans += x
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,split())
if a*b%2=0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a = random.randint(1,10000)
b = random.randint(1,10000)
if a * b %= 0:
  print('Even')
else:
  print('Odd')


Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a = random(1,10000)
b = random(1,10000)
if a * b %= 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
if a * b %= 0:
  print('Even')
else:
  print('Odd')

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))

for i in range(1,N+1):
    s=a.count(i)
    print(s)

Fixed submission:
import collections
N=int(input())
a=list(map(int,input().split()))

c = collections.Counter(a)

for s in range(1,N):
    if s in c:
        print(c[s])
    else:
        print("0")
print("0")
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import itertools

k=int(input())
tot=0
for l,m,n in itertools.product(range(1,k+1),range(1,k+1),range(1,k+1)):
    ans=fractions.gcd(m,l%m)
    ans=fractions.gcd(ans,n)
    tot+=ans
print(tot)

Fixed submission:
import math
k= int(input())
tot= 0
for i in range(1, k+1):
    for j in range(1, k+1):
        m = math.gcd(i,j)
        for n in range(1, k+1):
            l = math.gcd(m,n)
            tot += l
print(tot)

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

k=int(input())
tot=0
for l,m,n in itertools.product(range(1,k+1),range(1,k+1),range(1,k+1)):
    ans=l
    ans=fractions.gcd(ans,m)
    ans=fractions.gcd(ans,n)
    tot+=ans
print(tot)

Fixed submission:
import math
k= int(input())
tot= 0
for i in range(1, k+1):
    for j in range(1, k+1):
        m = math.gcd(i,j)
        for n in range(1, k+1):
            l = math.gcd(m,n)
            tot += l
print(tot)

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

k=int(input())
tot=0

for i in range(1,k+1):
    for j in range(1,k+1):
        for m in range(1,k+1):
            ans=i
            ans=fractions.gcd(ans,j)
            ans=fractions.gcd(ans,m)
            tot+=ans
print(tot)

Fixed submission:
import math
k= int(input())
tot= 0
for i in range(1, k+1):
    for j in range(1, k+1):
        m = math.gcd(i,j)
        for n in range(1, k+1):
            l = math.gcd(m,n)
            tot += l
print(tot)

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

k=int(input())
tot=0

for i in range(1,k+1):
    for j in range(1,k+1):
        for m in range(1,k+1):
            ans=i
            ans=fractions.gcd(ans,j)
            ans=fractions.gcd(ans,m)
            tot+=ans
print(tot)

Fixed submission:
import math
k= int(input())
tot= 0
for i in range(1, k+1):
    for j in range(1, k+1):
        m = math.gcd(i,j)
        for n in range(1, k+1):
            l = math.gcd(m,n)
            tot += l
print(tot)
Buggy python submission (verdict: Runtime Error):
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort(reverse=True)

cnt=0
for j in range(n):
    cnt+=a[j]

b=[]
for i in range(n):
    if a[i]>(cnt*(1/(4*m))):
        b.append(a[i])

if len(b) > m:
    print("Yes")
else:
    print("No")

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

a,b=b,a
a,c=c,a
print(a,b,c)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input.split())

ans=n*(n-1)/2#nC2の順列を利用（n個の球から2個の玉を選択）
ans+=m*(m-1)/2

print(int(ans))

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

ans=n*(n-1)/2
ans+=m*(m-1)/2

print(int(ans))
Buggy python submission (verdict: Runtime Error):
N=input()
cnt=0

for i in range(len(N)):
    cnt+=int(N[i])

if int(N)%cnt==0:
    print("Yes")
    
else:
    print("No")
    

Fixed submission:
n,a,b=map(int,input().split())
print(min(n*a,b))
Buggy python submission (verdict: Runtime Error):
N=str(input())

f=int(N[0])+int(N[1])

if int(N)%f==0:
    print("Yes")
    
else:
    print("No")

Fixed submission:
N=input()
cnt=0

for i in range(len(N)):
    cnt+=int(N[i])

if int(N)%cnt==0:
    print("Yes")
    
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())

if b-a=<x and b-a<=0:
    print("delicious")
elif b-a<=x and b-a>0:
    print("safe")
else:
    print("dangerous")

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

if b-a<=x and b-a<=0:
    print("delicious")
elif b-a<=x and b-a>0:
    print("safe")
else:
    print("dangerous")
Buggy python submission (verdict: Runtime Error):
x=input()
if x>=1200:
    print("ARC")
else:
    print("ABC")

Fixed submission:
x=int(input())
if x>=1200:
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
cnt=0
for i in range(k+1):
    for j in range(k+1):
        z=s-i-j
        if z>=0 and z<=k:
            cnt+=1
print(cnt)

Fixed submission:
s=input()
print(s.replace(","," "))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
cnt=0
for i in range(k+1):
    for j in range(k+1):
        for m in range(k+1):
            if i+j+m==s:
                cnt+=1
            else:
                pass
print(cnt)
    

Fixed submission:
k,s=map(int,input().split())
cnt=0
for i in range(k+1):
    for j in range(k+1):
        z=s-i-j
        if z>=0 and z<=k:
            cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(str(input())

list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Fixed submission:
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())
 
list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy python submission (verdict: Runtime Error):
l,n=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())

list.sort()
ans=""
for i in len(list):
    ans+=list[i]
print(ans)

Fixed submission:
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())
 
list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy python submission (verdict: Runtime Error):
l,n=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())

list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Fixed submission:
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())
 
list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy python submission (verdict: Runtime Error):
l,n=map(int,input().split())
list=[]
for _ in range(n):
    list.append(str(input()))

list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Fixed submission:
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())
 
list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy python submission (verdict: Runtime Error):
l,n=map(int,input().split())
D=[]
for _ in range(n):
    D.append(str(input()))

D.sort()
m=""
for i in S:
    m+=i

print(m)

Fixed submission:
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())
 
list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy python submission (verdict: Runtime Error):
l,n=map(int,input().split())
D=[]
for _ in range(n):
    D.append(str(input()))

S.sort(D,reverse=False)
m=" "
for i in S:
    m+=i

print(m)

Fixed submission:
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())
 
list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy python submission (verdict: Runtime Error):
l,n=map(int,input().split())
D=[]
for _ in range(n):
    D.append(str(input()))

S=sorted(D,reverse=False)
m=" "
for i in S:
    m+=i

print(m)

Fixed submission:
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())
 
list.sort()
ans=""
for i in list:
    ans+=i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

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

if K <= A:
    print(K)
elif A + B >= K:
    print(A)
else:
    total = 0
    for i in range(1, K+1):
        if i <= A:
            total += 1
        elif i > A+B:
            total -= 1
    print(total)


Fixed submission:

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

if K <= A:
    print(K)
elif A + B >= K:
    print(A)
else:
    total = 0
    K -= A
    total += A
    K -= B
    total = total - (K)
    print(total)
Buggy python submission (verdict: Runtime Error):

N, M = map(int, input().split())
H = list(map(int, input().split()))

AB = [list(map(int, input().split())) for _ in range(M)]

check = [True] * N

for ab in AB:
    # 左みる
    print(ab, "left: ", H[ab[0]-1], "right: ", H[ab[1]-1]) 
    if H[ab[0]-1] < H[ab[1] - 1]:
        check[ab[0]-1] = False
    elif H[ab[0]-1] > H[ab[1] - 1]:
        check[ab[1]-1] = False
    #else:
    #    check[ab[0]-1] = not check[ab[0]-1]
    print(check)
print(sum(check))


Fixed submission:

N, M = map(int, input().split())
H = list(map(int, input().split()))

AB = [list(map(int, input().split())) for _ in range(M)]

check = [True] * N

for ab in AB:
    # 左みる
    if H[ab[0]-1] < H[ab[1] - 1]:
        check[ab[0]-1] = False
        
    elif H[ab[1]-1] < H[ab[0] - 1]:
        check[ab[1]-1] = False
    else:
        check[ab[0]-1] = False
        check[ab[1]-1] = False
    
print(sum(check))
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    

    for i in listN:
        print(A.count(i))
main()


Fixed submission:
from sys import stdin
import collections

def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    
    c = collections.Counter(A)
    
    for i in listN:
        print(c[i])
main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    
    for i in range(1, N+1):
        print(A.count(i))
        
main()


Fixed submission:
from sys import stdin
import collections

def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    
    c = collections.Counter(A)
    
    for i in listN:
        print(c[i])
main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N = int(input())
A = list(map(int, stdin.readline().split()))

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




Fixed submission:
from sys import stdin
import collections

def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    
    c = collections.Counter(A)
    
    for i in listN:
        print(c[i])
main()

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

N = int(input())
A = list(map(int, stdin.readline().split()))
#u, counts = np.unique(A, return_counts=True)

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




Fixed submission:
from sys import stdin
import collections

def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    
    c = collections.Counter(A)
    
    for i in listN:
        print(c[i])
main()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(map(int, input().split()))

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


Fixed submission:
from sys import stdin
import collections

def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    
    c = collections.Counter(A)
    
    for i in listN:
        print(c[i])
main()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

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


Fixed submission:
from sys import stdin
import collections

def main():
    readline = stdin.readline
    N = int(input())
    A = list(map(int, readline().split()))
    listN = list(range(1, N+1))    
    c = collections.Counter(A)
    
    for i in listN:
        print(c[i])
main()
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

K = int(input())
sum = 0

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

for i in range(K):
    for j in range(K):
        tmp = math.gcd(i+1, j+1)
        for k in range(K):
            sum += gcd(g, k+1)
        
print(sum)


Fixed submission:
import math

K = int(input())
sum = 0

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

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

K = int(input())

sum = 0

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


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

print(sum)


Fixed submission:
import math

K = int(input())
sum = 0

for i in range(K):
    for j in range(K):
        tmp = math.gcd(i+1, j+1)
        for k in range(K):
            sum += math.gcd(tmp, k+1)
        
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

def substract(min):
    tmp = min
    if N % K == 0:
        return 0
    while(1):
        tmp = abs(tmp - K)
        if tmp > min:
            break
        min = tmp
    return min

if abs(N-K) < N or abs(N-K) < K:
    print(substract(abs(N-K)))
elif N < K:
    print(N)
else:
    print(K)


Fixed submission:
N, K = map(int, input().split())

def substract(min):
    if N % K == 0:
        return 0
    tmp = N % K
    if abs(tmp - K) < tmp:
        return abs(tmp-K)
    return tmp
    #while(1):
    #    tmp = abs(tmp - K)
    #    if tmp > min:
    #        break
    #    min = tmp
    #return min

if abs(N-K) < N or abs(N-K) < K:
    print(substract(abs(N-K)))
elif N < K:
    print(N)
else:
    print(K)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def CheckDigit(A, B):
    # A末とB先端 
    if A[0] != B[len(B) - 1]: return 0
    # A先端とB末
    if B[0] != A[len(A) - 1]: return 0
    return 1 

def ArrayRotation(n):
    ans = 0
    for i in range(n):
        for j in range(n):
            ans += CheckDigit(str(i+1), str(j+1))
    return ans

if N <= 11:
    print(N)
else:
    print(ArrayRotation(N))

Fixed submission:
N = int(input())
digit =[[0] * 10 for i in range(10)]

def CheckDigit():
    ans = 0
    for i in range(10):
        for j in range(10):
            ans += digit[i][j] * digit[j][i]
    return ans

def ArrayRotation(n):
    for i in range(1, n+1):
        tmp = str(i)
        digit[int(tmp[0])][int(tmp[-1])] += 1

if N <= 11:
    print(N)
else:
    ArrayRotation(N)
    print(CheckDigit())
Buggy python submission (verdict: Runtime Error):
number, max = input().split()

if (int(number) * 500 >= int(max)) {
	print('yes'); 
}
print('no');

Fixed submission:
num, max = input().split()
if (int(num) * 500 >= int(max)):
    print('Yes');
else:
    print('No');
Buggy python submission (verdict: Runtime Error):
time = list(int(input()) for i in range(3))
time.remove(max(time))
print(sum(time))

Fixed submission:
time = list(map(int, input().split()))
time.remove(max(time))
print(sum(time))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

num = 0

for i in range(N-1):
    for j in range(i+1,N):
        b3 = A[i]^A[j]
        num += b3

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

Fixed submission:
a,b,c = map(int,input().split())
print('bust' if a+b+c>=22 else 'win')