Harryxun/stf_run huggingface dataset:
import math
from functools import reduce
#import math
#import itertools
#import statistics
#import numpy as np
#import collections
#n = int(input())
a, b, c, d = list(map(int, input().split()))
#b = list(map(int, input().split()))

#10 11  13 14 15  17  19 20 21 22 23  25 26 27 28 29 
# 31  33 34 35  37 38 39  
lcm = a*b/math.gcd(a, b)
diff = b-a+1
d1 = (b//c - a//c)
d2 = (b//d - a//d)
a1 =  int((b//lcm-a//lcm))

print(diff-d1-d2+a1)


### FIXED CODE ###

from fractions import gcd
a, b, c, d = list(map(int, input().split()))
#b = list(map(int, input().split()))
total = b-a+1
lcm = int((c*d)/gcd(c, d))

d1 = b//c - a//c
d2 = b//d - a//d
add = b//lcm - a//lcm
if a % c == 0:
    d1 += 1
if a % d == 0:
    d2 += 1
if a % lcm == 0:
    add += 1

print(total-d1-d2+add)
N = int(input())
A = []
for i in range(1,46):
  for j in range(1,46):
    for k in range(1,46):
      A.append(i**2+j**2+k**2+i*j+i*k+j*k)
A = sorted(A)
B = [0]*N
for i in range(N):
  if A[i] == A[i-1]:
    B[A[i]] += 1
  else:
    B[A[i]]=1
[print(i) for i in B]

### FIXED CODE ###

N = int(input())
 
ans = [0] * 10050
 
for i in range(1, 105):
    for j in range(1, 105):
        for k in range(1, 105):
            v = i*i+j*j+k*k+i*j+i*k+j*k
            if v < 10050:
                ans[v] += 1
 
for i in range(N):
    print(ans[i+1])
N,M=[int(i) for i in input().split()]
S=input()
print(S[:M-1]+S[M-1].lower()+S[M:]

### FIXED CODE ###

N,M=[int(i) for i in input().split()]
S=input()
print(S[:M-1]+S[M-1].lower()+S[M:])
import heapq

n, m = list(map(int, input().split()))
a = list(map(lambda x: -float(x), input().split()))

heap = heapq.heapify(a)
for t in range(m):
  discount = heapq.heappop(heap) / 2.
  heapq.heappush(heap, discount)
    
print(sum(map(lambda x: int(-x), heap)))

### FIXED CODE ###

import heapq

n, m = list(map(int, input().split()))
a = list(map(lambda x: -float(x), input().split()))

heapq.heapify(a)
for t in range(m):
  discount = heapq.heappop(a) / 2.
  heapq.heappush(a, discount)
    
print(sum(map(lambda x: int(-x), a)))
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    for i in range(-2,3):
        if a+i <= K and a+i >= 0:
            ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
    ans = min(ans_list)
print(ans)    

### FIXED CODE ###

X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)
count = 0

oi10 = "0"*10 + "1"*10
io10 = "1"*10 + "0"*10

while oi10 in s or io10 in s:
    while oi10 in s:
        s = s.replace(oi10, "", 1)
        count += 10
    while io10 in s:
        s = s.replace(io10, "", 1)
        count += 10

while "01" in s or "10" in s:
    while "01" in s:
        num = s.count("01")
        s = s.replace("01", "")
        count += num
    while "10" in s:
        num = s.count("10")
        s = s.replace("10", "")
        count += num

print(count * 2)

### FIXED CODE ###

s = input().rstrip()
a = s.count("0")
b = s.count("1")
print(min(a,b)*2)
a = input()
if a % 2 == 0:
  print(a // 2)
else:
  print((a + 1) // 2)

### FIXED CODE ###

n = int(input())
if n % 2 != 0:
  n = n + 1
  
print(n // 2)
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

# import math
# import numpy as np
# import copy
# from collections import defaultdict, Counter
# from itertools import product
# from bisect import bisect_left, bisect_right
def inpl(): return list(map(int, input().split()))

S = input()
N = len(S)
while True:
    flag = False
    for i in range(1, len(S)-2):
        l = S[i-1]
        mid = S[i:i+2]
        r = S[i+2]
        if mid == "01" or mid == "10":
            if (l == "0" and r == "1") or (l == "1" and r == "0"):
                S = S[:i] + S[i+2:]
                i += 2
                flag = True
                if i >= len(S)-3:
                    break


    if flag:
        continue

    for i in range(0, len(S)-1):
        mid = S[i:i+2]
        if mid == "01" or mid == "10":
            S = S[:i] + S[i+2:]

    break
print(N-len(S))

### FIXED CODE ###

# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

# import math
# import numpy as np
# import copy
# from collections import defaultdict, Counter
# from itertools import product
# from bisect import bisect_left, bisect_right
def inpl(): return list(map(int, input().split()))

S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")

print(2*min(c0, c1))
n=int(input())
a=list(map(int,input().split()))
set(a)
v=a[-1]
a[-1]=a[-1]%a[-2]
a.sort()
l=a[-1]
i=1
while i<=n:
    while v!=l:
        v=a[-1]
        a[-1]=a[-1]%a[-(i+1)]
        a.sort()
        l=a[-1]
    if a[-1]==0 or a[-1]==1:
        break
    i+=1
if a[-1]==0:
    print(v)
else:
    print(a[0])

### FIXED CODE ###

import fractions
from functools import reduce
n=int(input())
l=list(map(int,input().split()))
print(reduce(fractions.gcd,l))
N = int(input())
S = []
for i in range(N):
    a = input()
    S.append(a)

AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(N):
    if i == AC:
        AC = AC + 1
    if i == WA:
        WA = WA + 1
    if i == TLE:
        TLE = TLE + 1
    if i == RE:
        RE = RE + 1

print("AC x " + AC)
print("WA x " + WA)
print("TLE x " + TLE)
print("RE x " + RE)

    

### FIXED CODE ###

N = int(input())
C0, C1, C2, C3 = 0, 0, 0, 0

for i in range(N):
    S = str(input())
    if S == "AC":
        C0 = C0 + 1
    elif S == "WA":
        C1 = C1 + 1
    elif S == "TLE":
        C2 = C2 + 1
    else:
        C3 = C3 + 1

print("AC x " + str(C0))
print("WA x " + str(C1))
print("TLE x " + str(C2))
print("RE x " + str(C3))
s = list(map(int,input()))
L = len(s)
o = s[0]
p = 11-s[1]
for i in range(1,L):
    n = s[i]
    np = min(o+n,p+n)
    d = min(p+9-n,o+11-n)
    o = np
    p = d
print(min(o,p))

### FIXED CODE ###

N = str(input())
L = len(N)
ans = 0
dp = [[0,0] for _ in range(L)]
s = list(map(int,N))
dp[0] = [s[0],11-s[0]]
for i in range(1,L):
    n = s[i]
    dp[i][0] = min(dp[i-1][0]+n,dp[i-1][1]+n)
    dp[i][1] = min(dp[i-1][1]+9-n,dp[i-1][0]+11-n)
print(min(dp[-1]))
o = input()
e = input()
r = ''

for i in range(len(o)):
  r += o[i]
  if i < len(e)
    r += e[i]
print(r)

### FIXED CODE ###

o = input()
e = input()
r = ''

for i in range(len(o)):
  r += o[i]
  if i < len(e):
    r += e[i]
print(r)
from scipy.special import comb
n,a,b,k=map(int,input().split())
A=0
m=998244353
for i in range(n+1):
 if (k-i*a)%b==0:A+=comb(n,i,exact=True)*comb(n,(k-i*a)//b,exact=True)%m
print(A%m)

### FIXED CODE ###

mod = 998244353
n, a, b, k = map(int, input().split())
ans = 0
def comb(n, r):
    if n < r:return 0
    if n < 0 or r < 0:return 0
    return fa[n] * fi[r] % mod * fi[n - r] % mod
fa = [1] * (n + 1)
fi = [1] * (n + 1)
for i in range(1, n + 1):
    fa[i] = fa[i - 1] * i % mod
    fi[i] = pow(fa[i], mod - 2, mod)
for i in range(n + 1):
    x = k - a * i
    if x >= 0 and x % b == 0:
        j = x // b
        if j <= n:
            ans += comb(n, i) * comb(n, j)
            ans %= mod
print(ans % mod)
N=int(input())
A=list(map(int,input()))
B=[]
p=True
for a in A:
  if a in B:
    p = False
    break
  else:
    B.append(a)
print("Yes" if p else "No")

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
S=set(A)
print("YES" if len(A)==len(S) else "NO")
D = int(input())
P = int(input())
ans = 0.0
def func(i):
    t = 0
    while(i < P):
        i *= 2
        t += 1
    return t

for i in range(1, D + 1):
    ans += float((1/D)) * float(((1 / 2) ** func(i)))

print(ans)

### FIXED CODE ###

D, P = map(int, input().split())    
ans = 0.0
def func(i):
    t = 0
    while(i < P):
        i *= 2
        t += 1
    return t

for i in range(1, D + 1):
    ans += float((1/D)) * float(((1 / 2) ** func(i)))

print(ans)
n,a,b=map(int,input(),split())
ans=N//(A+B)*A
r=N%(A+B)
ans+=min(r,A)

print(ans)



### FIXED CODE ###

N,b,r=map(int,input().split())
ball,x,y=0,0,0
ans=0

ball=b+r
x=N%ball
y=N//ball

ans+=y*b

if x>b:
    ans+=b
else:
    ans+=x


print(ans)
a = n // (2*d+1)

if n%(2*d+1) == 0:
    print(a)
else:
    print(a+1)

### FIXED CODE ###

nd = list(map(int, input().split(' ')))

a = nd[0] // (nd[1]*2+1)

if (nd[0]%(nd[1]*2+1)) != 0:
    a += 1

print(a)
import math
math.ceil((B-1)/A)

### FIXED CODE ###

A,B=input().split()
import math
print(math.ceil((int(B)-1)/(int(A)-1)))
n,d = map(int,input().split())
count = 0

for i in range(n):
  x = list(map(int, input().split()))

for i in range(d):
  n=0
  for j in range(d) if i < j:
    n += (x[i][j]-x[i+1][j])**2
  if  type(n**0.5) = int:
    count +=1

print(count)

### FIXED CODE ###

import math
N,D = map(int,input().split())
X = [list(map(int, input().split())) for i in range(N)]
count = 0
for i in range(N):
    for j in range(i+1,N):
        n = 0
        for k in range(D):
            n = n + (X[i][k]-X[j][k])**2
        n = math.sqrt(n)
        if n.is_integer():
            count += 1
print(count)
A, B, K = map(int, input().split())
d = [i for i in range(100,1,-1) if (A%i==0 and B%i==0)]
print(d[K-1])


### FIXED CODE ###

a,b,k=map(int,input().split())
d=[]
for i in range(1,101):
  if(a%i==0 and b%i==0):
    d.append(i)
e=d[::-1]
print(int(e[k-1]))
counter=0
a,b,c=map(int,input().split())
for i in range(a,b):
    if(c%i==0) counter=counter+1
print(f"{counter}")



### FIXED CODE ###

counter=0
a,b,c=map(int,input().split())
for i in range(a,b+1):
    if((c%i)==0):
        counter=counter+1
print(f"{counter}")
import math

def read_input():
    n, k = map(int, input().split())
    return n, k


# x*2^d >= k となる最小のkを求める
def calc_d(x, k):
    return int(math.ceil(math.log2(k/x)))


def submit():
    n, k = read_input()

    result = 0
    for i in range(1, n + 1):
        if i < k:
            result += math.pow((1/2), calc_d(i, k))
        else:
            result += 1.0

    print(result/n)


if __name__ == '__main__':
    submit()


### FIXED CODE ###

import math

def read_input():
    n, k = map(int, input().split())
    return n, k


# x*2^d >= k となる最小のkを求める
def calc_d(x, k):
    return int(math.ceil(math.log2(k/x)))


def submit():
    n, k = read_input()

    result = 0
    for i in range(1, n + 1):
        if i < k:
            result += math.pow((1/2), calc_d(i, k))
        else:
            result += 1.0

    print(result/n)


if __name__ == '__main__':
    submit()
import math

divisor=[1]
stack=[]
#eiclidean algorithm
A,B=map(int,input().split())
p=max(A,B)
q=min(A,B)
int2=0
gcd=0
while True:
    int2=p%q
    if int2==0:
        gcd=q
        break
    else:
        p=q
        q=int2

stack.append(gcd)
for i in range(2,math.ceil(math.sqrt(gcd))+1):
    if gcd%i==0:
        p=gcd//i
        stack.append(p)
        for x in divisor:
            if i%x==0 and x!=1:
                break
        else:
            divisor+=[i]

while len(stack)!=0:
    p=stack.pop()
    for x in divisor:
        if i%x==0 and x!=1:
            break
    else:
        divisor+=[p]


print(divisor)

### FIXED CODE ###

import math

divisor=[1]
stack=[]
#eiclidean algorithm
A,B=map(int,input().split())
p=max(A,B)
q=min(A,B)
int2=0
gcd=0
while True:
    int2=p%q
    if int2==0:
        gcd=q
        break
    else:
        p=q
        q=int2

if gcd!=1:
    stack.append(gcd)
    
for i in range(2,math.ceil(math.sqrt(gcd))+1):
    if gcd%i==0:
        p=gcd//i
        stack.append(p)
        for x in divisor:
            if i%x==0 and x!=1:
                break
        else:
            divisor+=[i]

while len(stack)!=0:
    p=stack.pop()
    for x in divisor:
        if p%x==0 and x!=1:
            break
    else:
        divisor+=[p]


print(len(divisor))
import sys
input = sys.stdin.readline
import math
def print_ans(N, D):
    """Test Case
    >>> print_ans(6, 2)
    2
    >>> print_ans(14, 3)
    2
    >>> print_ans(20, 4)
    3
    """
    print(math.ceil(N / (D * 2 + 1)))
    

if __name__ == '__main__':
    N, D = map(int,input().rstrip().sprit())
    print_ans(N, D)


### FIXED CODE ###

import sys
input = sys.stdin.readline
import math
def print_ans(N, D):
    """Test Case
    >>> print_ans(6, 2)
    2
    >>> print_ans(14, 3)
    2
    >>> print_ans(20, 4)
    3
    """
    print(math.ceil(N / (D * 2 + 1)))
    

if __name__ == '__main__':
    N, D = map(int,input().rstrip().split())
    print_ans(N, D)
S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k+1,len(S)-k-1))
            k += 1
        else:
            k += 1
    L.sort()
    print(L[0])

### FIXED CODE ###

S=input()
if len(S)==1:
    print('1')
else:
    k=0
    L=[]
    while k < (len(S)-1):
        if S[k] != S[k+1]:
            L.append(max(k+1,len(S)-k-1))
            k += 1
        else:
            k += 1
    L.sort()
    if len(L)==0:
        print(len(S))
    else:
        print(L[0])
N = input()
f = True
L = len(N)
for i in range(N):
  if N[i] != N[L-1-i]:
    f = False
    break
if f:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = input()
f = True
L = len(N)
for i in range(L):
  if N[i] != N[L-1-i]:
    f = False
    break
if f:
  print("Yes")
else:
  print("No")
N = int(input())
T = [0 for i in range(N)]
for t in range(N):
    T[t] = int(input())


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(listT):
    listlen = len(listT)
    ans = -1
    while True:
        ans = lcm(listT[listlen-2], listT[listlen-1])
        listT.pop(listlen-1)
        listT.pop(listlen-2)
        listT.append(ans)
        listlen = len(listT)
        if(listlen == 1):
            break

    return ans

print(solve(T))


### FIXED CODE ###

N = int(input())
result = 1

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    return (a * b) // gcd(a, b)


for i in range(0, N):
    num = int(input())
    result = lcm(result, num)
print(int(result))
import collections
n=int(input())
v=list(map(int,input().split()))
a=[]
b=[]
for i in range(0,n,1):
  a.append(v[i])
  b.append(v[i+1])
c=collections.Counter(a)
d=collections.Counter(b)
C=sorted(c.items(), key=lambda x:-x[1])
D=sorted(d.items(), key=lambda x:-x[1])
A=int(C[0][0])
B=int(D[0][0])
cnt=0
for i in range(n):
  if a[i]!=A:
    cnt+=1
for j in range(n):
  if b[j]!=B:
    cnt+=1
print(cnt)

    





### FIXED CODE ###

import collections,sys
n=int(input())
v=list(map(int,input().split()))
a=[]
b=[]
for i in range(0,n,2):
  a.append(v[i-1])
  b.append(v[i])
c=collections.Counter(a)
d=collections.Counter(b)
C=sorted(c.items(), key=lambda x:-x[1])
D=sorted(d.items(), key=lambda x:-x[1])
A=int(C[0][0])
B=int(D[0][0])
cnt=0
if len(set(v))==1:
  print(n//2)
  sys.exit()
if A!=B:
  for i in range(n//2):
    if a[i]!=A:
      cnt+=1
  for j in range(n//2):
    if b[j]!=B:
      cnt+=1
  print(cnt)
  sys.exit()
if A==B:
  totla=0
  A_=int(C[1][0]) if len(set(a))!=1 else A
  for i in range(n//2):
    if a[i]!=A_:
      totla+=1
  for j in range(n//2):
    if b[j]!=B:
      totla+=1
  totlb=0
  B_=int(D[1][0]) if len(set(b))!=1 else B
  for i in range(n//2):
    if a[i]!=A:
      totlb+=1
  for j in range(n//2):
    if b[j]!=B_:
      totlb+=1
  print(min(totla,totlb))
  sys.exit()
n, k = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
dp = [float('inf') for x in arr]
dp[0] = 0
for i in range(1, n):
  dp[i] = min(dp[j] + abs(arr[i] - arr[j]) for j in range(max(i-k, 0), i))
print(dp[-1])

### FIXED CODE ###

n = int(input())
arr = [int(x) for x in input().split()]
dp = [float('inf') for x in arr]
dp[0] = 0
for i in range(n):
    for j in (i+1, i+2):
        if j < n:
            dp[j] = min(dp[j], dp[i] + abs(arr[i] - arr[j]))
print(dp[-1])
n = int(input())
a = list(map(int, input().split()))

for i in range(len(a)):
    a[i] -= i + 1

a.sort()
b = [a[0]]
for i in a[1:]:
    b.append(b[-1] + i)
hi = len(a)
lo = 0


def score(index):
    return abs((lft * a[index] - b[index]) - (b[-1] - b[index] - (len(a) - index) * a[index]))


for i in range(10000):
    lft = (hi + 2 * lo) // 3
    rgt = (2 * hi + lo) // 3
    ltmp = score(lft)
    rtmp = score(rgt)
    if ltmp <= rtmp:
        lo = lft
    else:
        hi = rgt

printmin([(score(lo), score(lo + 1)]))


### FIXED CODE ###

n = map(int, input().split())
a = list(map(int, input().split()))

for i in range(len(a)):
    a[i] -= i + 1

a.sort()

d1 = a[len(a) // 2]
print(sum([abs(i - d1) for i in a]))
# 105の約数は1, 3, 5, 7, 3 * 5, 3 * 7, 5 * 7, 3 * 5 * 7
# ほかにありえるのは
# ①1, 3, 5, 9, ...
# ②1, 3, 5, 11, ...
# ③1, 3, 5, 13, ...
n = int(input())
if n < 105: print(0)
elif n < 135: print(1)
elif n < 165: print(2)
elif n < 195: print(3)
else print(4)

### FIXED CODE ###

# 105の約数は1, 3, 5, 7, 3 * 5, 3 * 7, 5 * 7, 3 * 5 * 7
# ほかにありえるのは
# ①1, 3, 5, 9, ...
# ②1, 3, 5, 11, ...
# ③1, 3, 7, 9, ...
# ④1, 3, 5, 13, ...
n = int(input())
if n < 105: print(0)
elif n < 135: print(1)
elif n < 165: print(2)
elif n < 189: print(3)
elif n < 195: print(4)
else: print(5)
s=list(input())
booler=True
while s!=[]:
  if s[-5]=="d" and s[-4]=="r" and s[-3]=="e" and s[-2]=="a" and s[-1]=="m":
    for i in range(5):
      del s[-1]
  elif s[-6]=="e" and s[-5]=="r" and s[-4]=="a" and s[-3]=="s" and s[-2]=="e" and s[-1]=="r":
    for i in range(6):
      del s[-1]
  elif s[-5]=="e" and s[-4]=="r" and s[-3]=="a" and s[-2]=="s" and s[-1]=="e":
    for i in range(5):
      del s[-1]
  elif s[-7]=="d" and s[-6]=="r" and s[-5]=="e" and s[-4]=="a" and s[-3]=="m" and s[-2]=="e" and s[-1]=="r":
    for i in range(7):
      del s[-1]
  else:
    booler=False
if b:
  print("YES")
else:
  print("NO")
  

### FIXED CODE ###

s=list(input())
booler=True
while s!=[] and booler==True:
  if s[-5]=="d" and s[-4]=="r" and s[-3]=="e" and s[-2]=="a" and s[-1]=="m":
    for i in range(5):
      del s[-1]
  elif s[-5]=="e" and s[-4]=="r" and s[-3]=="a" and s[-2]=="s" and s[-1]=="e":
    for i in range(5):
      del s[-1]
  elif s[-6]=="e" and s[-5]=="r" and s[-4]=="a" and s[-3]=="s" and s[-2]=="e" and s[-1]=="r":
    for i in range(6):
      del s[-1]
  elif s[-7]=="d" and s[-6]=="r" and s[-5]=="e" and s[-4]=="a" and s[-3]=="m" and s[-2]=="e" and s[-1]=="r":
    for i in range(7):
      del s[-1]
  else:
    booler=False
if booler:
  print("YES")
else:
  print("NO")
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np
 
K = INT()
sum = 0
 
for n in range(K):
  for m in range(K):
    for l in range(K):
      sum += gcd(n+1, gcd(m+1, l+1))
 
print(sum)

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
K = INT()
sum = 0
 
for n in range(K):
  for m in range(K):
    for l in range(K):
      sum += gcd(n+1, gcd(m+1, l+1))
 
print(sum)
import math
A,B,H,M = map(int,input().split())

a = H * 30 + M * 0.5
b = M * 6
c = abs(a-b)
c = c - 180 if c > 180 else c
c = math.radians(c)
d = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(c))
print(d)

### FIXED CODE ###

N = int(input())

a = N%100
a = a%10

if a == 0 or a == 1 or a == 6 or a == 8:
    print("pon")
elif a == 3:
    print("bon")
else:
    print("hon")
a,b=input().split()
c=a+b
a=int.input(a)
if(c==a*a):
  print("Yes")
  else:
    print("no")
          
        
            


### FIXED CODE ###

a,b=input().split()
c=a+b
c=int(c)
flag=0
for i in range(1,c+1):
    if(c==i*i):
      flag=flag+1
      break
if(flag>0):
    print("Yes")
else:
    print('No')