peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
input = sys.stdin.readline
A,B,C = [int(i) for i in input().split()]
if A<=C<=B :
    print("Yes")
else :
    print("No")
# Judge status: Wrong Answer
d, n = map(int, input().split())
if n == 100:
    print(99 * 100 ** d)
else:
    print(n * 100 ** d)
# Judge status: Wrong Answer
import itertools
N,M=map(int, input().split())
res=[]
for _ in range(N):
  data=list(map(int, input().split()))
  K=data.pop(0)
  A=data
  res.append(A)
print(res)
flatten_list = list(itertools.chain.from_iterable(res))
cnt=0
for i in range(1, M+1):
  if flatten_list.count(i) == N:
    cnt +=1
print(cnt)
# Judge status: Accepted
a, b = map(int, input().split())
if a > b:
  a, b = b, a
print(str(a) * b)
# Judge status: Wrong Answer

def main2():
    n=int(input())
    l = []
    for i in range(5):
        s = int(input())
        l.append(s)
    print((n)//min(l)+5)
if __name__ == '__main__':
    main2()
# Judge status: Accepted
def euclides(a, b):
    r = a%b
    q = 0
    while(r != 0):
        q = a/b
        a = b
        b = r
        r = a%b
    q = a/b
    return b

foo = list(map(int, input().split()))
A = foo[0]
B = foo[1]
K = foo[2]

GCD = euclides(A, B) # GCD
div = 1
while(GCD > 0):
    if div == K:
        break
    GCD -= 1
    if A%GCD == 0 and B%GCD == 0:
        div += 1

print(GCD)
# Judge status: Wrong Answer
b, t, k = list(map(int,input('').split()))
 
a = b

if k > t-b:
  k = t-b
  
while b<=t:
  if b < a + k or (t-k < b <= t):
    print(b)
  b += 1
# Judge status: Accepted
# ABC061_C
N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB)

for i in range(N):
    K -= AB[i][1]
    if K <= 0:
        print(AB[i][0])
        break
# Judge status: Accepted
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = [None]*n
for i in range(n):
    a[i] = int(input())
ans = 0
for i in range(n):
    num = a[i]
    if num%2==1:
        if i+1<n and a[i+1]>0:
            ans += 1
            a[i+1] -= 1
    ans += num//2
print(ans)
# Judge status: Accepted
import fractions
import math
#gcd = math.gcd
gcd = fractions.gcd
n, m = [int(_) for _ in input().split()]
a = sorted([int(_) // 2 for _ in input().split()])
lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // gcd(lcm, a[i])
    if lcm > 10**10:
        print(0)
        exit()
for b in a:
    if (lcm // b) % 2 == 0:
        print(0)
        exit()
ans = m // lcm
if ans % 2 == 0:
    ans -= 1
if ans < 0:
    print(0)
    exit()
print(ans // 2 + 1)
# Judge status: Accepted
sx , sy , tx , ty = map(int,input().split())
print("L",end="")
for i in range(ty-sy+1):
    print("U",end="")
for i in range(tx-sx+1):
    print("R",end="")
for i in range(ty-sy+1):
    print("D",end="")
for i in range(tx-sx):
    print("L",end="")
for i in range(ty-sy):
    print("U",end="")
for i in range(tx-sx+1):
    print("R",end="")
for i in range(ty-sy+1):
    print("D",end="")
for i in range(tx-sx+1):
    print("L",end="")
print("U")
# Judge status: Wrong Answer
a = int(input())
ans = 0

'''
1-10 - 9

100 - 999 - 900

10000 - 99999 - 90000
'''

case = 0

if a > 99999: ans = 9 + 900 + 90000
if 100000 > a > 9999: ans = 9 + 900 + a - 9999
if 10000 > a > 99: ans = 9 + a - 99
if 100 > a > 9: ans = 9
if a < 10: ans = a

  
print(ans)
# Judge status: Accepted
a = list(input().split())
if a.count('7') == 1 and a.count('5') == 2:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
n,l = map(int,input().split())

D=[]
for i in range(n):
    d = l+i
    D.append(d)

if l>-1 :
    mind = min(D)
elif l+n<0:
    mind = max(D)
else:
    mind = 0

ans = sum(D)-mind
print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
S=input()

K-=1

if S[K]=="A":
   S=[c for c in S]
   S[K]="a"
   print("".join(S))

elif S[K]=="B":
   S=[c for c in S]
   S[K]="b"
   print("".join(S))

else:
   S=[c for c in S]
   S[K]="c"
   print("".join(S))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

rates = [0 for _ in range(8)]
gold = 0
for a in A:
    rate = a // 400
    if rate < 8:
        rates[rate] += 1
    elif rate >= 8:
        gold += 1

ansMin = 8 - rates.count(0)
if ansMin == 0:
    ansMin = 1
ansMax = min(ansMin + gold, N)
print(str(ansMin) + ' ' + str(ansMax))
# Judge status: Accepted
def main():
  a, b, c, d = list(input())
  sign = "+-"
  for i in range(2):
    for j in range(2):
      for k in range(2):
        if eval(a+sign[i]+b+sign[j]+c+sign[k]+d)==7:
          print(str(a+sign[i]+b+sign[j]+c+sign[k]+d)+"=7")
          exit()
if __name__ == "__main__":
  main()
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

i = 0
ans = 0
for a in A:
  right, right2 = i, i
  while right+1 < N and A[right] <= A[right+1]: right += 1
  while right2+1 < N and A[right2] >= A[right2+1]: right2 += 1
  i = max(right, right2) + 1
  ans += 1
  if i >= N: break
print(ans)
# Judge status: Wrong Answer
l = list(map(str, input())) 
if l.count(l[0]) == l.count(l[1]) == l.count(l[2]) == l.count(l[3]) == 2: 
    print('Yes')
else:
    print('NO')
# Judge status: Wrong Answer
import math
X, Y = map(int, input().split())
ans = int(math.log2(Y) - math.log2(X))
print(ans+1)
# Judge status: Accepted
import sys
input = sys.stdin.readline
import bisect
N = int(input())
a = [-int(input()) for i in range(N)]
ls = []
res = 0
for elem in a:
    idx = bisect.bisect_right(ls,elem)
    if idx == res:
        ls.append(elem)
        res += 1
    else:
        ls[idx] = elem
print(res)
# Judge status: Wrong Answer
N = int(input())
X = [int(x) for x in input().split()]
allpoint = []
for j in range(1, X[-1]+1):
    total = 0
    for i in X:
        total += (i - j)**2
    allpoint.append(total)
print(min(allpoint))
# Judge status: Wrong Answer
import itertools
import math

a = int(input())
cnt = 0
ans = []
l = list(range(1,int(math.sqrt(a/2))))

for x,y,z in itertools.product(l, repeat=3):
	ans.append(x*x+y*y+z*z+x*y+y*z+z*x)

for i in range(1,a+1):
    print(ans.count(i))
# Judge status: Wrong Answer
input = list(map(int,input().split()))

ans_count = 0
for i in range(0, input[0]):
  for j in range(0, input[0]):
    for k in range(0, input[0]):
      if (i + j + k == input[1]):
        ans_count+=1
        
print(ans_count)
# Judge status: Accepted
N, x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
f=0
i=0
while x>=a[i]:
    x=x-a[i]
    i=i+1
    f=f+1
    if i==N:
        break
if i==N and x>0:
    print(f-1)
else:
    print(f)
# Judge status: Wrong Answer
n=int(input())
a= list(map(int,input().split()))

#for i in a:
#i=0
b=[0]*(max(a)+2)
r=0
#while i<=n:
for i in a:
    b[i]+=1
    b[i+1]+=1
    b[i-1]+=1
print(max(b))
# Judge status: Accepted
a, b, c = map(int, input().split())

print(int(a * b / 2))
# Judge status: Wrong Answer
n=int(input())
for i in reversed(range(7)):
	if n>=2**i:
		print(i)
		quit()
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(-1 if ([a, b] > [9, 9]) else a * b)
# Judge status: Accepted
from functools import lru_cache
@lru_cache(maxsize=None)

def luca(n):
    if n==0:
        return 2
    elif n == 1:
        return 1
    else:
        return luca(n-1)+luca(n-2)

N = int(input())

print(luca(N))
# Judge status: Accepted
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

count = 0
for i in range(2):
    if A > B:
        count += A
        A -= 1
    else:
        count += B
        B -= 1

print(count)
# Judge status: Accepted
n=int(input())
a=[]

for i in range(n):
    a.append(int(input()))

zisyo={}
for i in range(n):
    if a[i] in zisyo:
        zisyo.pop(a[i])
    else:
        zisyo[a[i]]=1
print(len(zisyo))
# Judge status: Accepted
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
cnt=[0 for _ in range(N)]
score={'r':P,'s':R,'p':S}
for i in range(N):
    if i<K:
        cnt[i]=score[T[i]]
    else:
        if T[i-K]!=T[i]:
            cnt[i]=score[T[i]]
        else:
            if cnt[i-K]==0:
                cnt[i]=score[T[i]]
print(sum(cnt))
# Judge status: Accepted
N = int(input())
B = [int(x) for x in input().split()]

A = [0]*N

A[0] = B[0]
A[N - 1] = B[N - 2]

for i in range(1, N - 1):
    A[i] = min(B[i - 1], B[i])

ans = sum(A)

print(ans)
# Judge status: Wrong Answer
def main():
    A, B, C = map(int, input().split())
    if (A == 5 and B == 7 and C == 5) or (A == 7 and B == 5 and C == 5) or (A == 5 and B == 5 and C ==7):
        print('YES')
    else:
        print('No')
main()
# Judge status: Wrong Answer
import fractions
N, M = map(int, input().split())
a = list(map(int, input().split()))
lcm = 1
for x in a:
    lcm = (lcm*x) // fractions.gcd(lcm, x)
ans = (M // lcm)
if M % lcm >= (lcm//2):
    ans += 1

print(ans)
# Judge status: Accepted
H,W=map(int,input().split())
if H%2==0:
  ans=int(H*W/2)
elif W==1 or H==1:
  ans=1
else:
  ans=int((H-1)*W/2+1+(W-1)//2)
print(ans)
# Judge status: Accepted
import math

a, b = map(int, input().split())

for i in range(1001):
    temp_a = i * 0.08
    temp_b = i * 0.1
    if math.floor(temp_a) == a and math.floor(temp_b) == b:
        print(i)
        exit(0)
print("-1")
# Judge status: Wrong Answer
s = input()
t = input()
st = list(s)
ts = list(t)
j = 0
for i in range(len(st)):
    if(st[i] == ts[i]):
        j = 0
    elif(st[i] != ts[i]):
        ts[i] = st[i]
        j = j + 1

# print(st)
# print(ts)
print(j)
# Judge status: Accepted
def main():
    a, b, c = map(int, input().split())
    k = int(input())
    f = False
    cnt = 0
    while b <= a:
        b *= 2
        cnt += 1
    while c <= b:
        c *= 2
        cnt += 1
    if cnt <= k:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N,T=map(int,input().split())
c_t=[]
mincos=1000
for c,t in zip(range(N),range(N)):
    c,t=map(int,input().split())
    if t<=T:
        if c<mincos:
            mincos=c

print("TLE" if mincos==1000 else mincos)
# Judge status: Accepted
X,Y = map(int, input().split())
m = (-X+2*Y)//3
n = (2*X-Y)//3

def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = (numer*(n1-i)) % mod
        denom = (denom*i) % mod
    return numer * pow(denom, mod-2, mod) % mod

if (X+Y)%3 != 0 or m*n<0:
  print(0)
else:
  print(combination(m+n,n))
# Judge status: Accepted
S = input()
if S.count("hi")*2 == len(S):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = input()
n = int(s)
keta = len(s)
cnt = [[0] * (10) for _ in range(10)]
for i in range(1, n + 1):
    a = int(str(i)[0])
    b = i % 10
    cnt[a][b] += 1
ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += cnt[i][j] * cnt[j][i]
print(ans)
# Judge status: Accepted
from functools import reduce

def gcd(x, y):
    if (y==0):return x
    else:return gcd(y, x%y)

N = int(input())
*A, = map(int, input().split())
mod = 10**9 + 7
lcm = reduce(lambda a,b: a*b//gcd(a,b), A)

print(sum(map(lambda x: lcm//x, A))%mod)
# Judge status: Accepted
S, T = input().split()

print(T+S)
# Judge status: Accepted
from bisect import bisect_left, bisect_right

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(n//i)
            if i != n // i:
                divisors.append(n//(n//i))

    divisors.sort()
    return divisors


divisors_M = make_divisors(M)

Max = bisect_left(divisors_M,N)
print(M // divisors_M[Max])
# Judge status: Wrong Answer
K = int(input())
A,B = map(int,input().split())
a = A//K
b = B // K
c = b-a

if c==0:
  print("NG")
else:
  print("OK")
# Judge status: Wrong Answer
a,b,t = map(int,input().split())
cnt = 0
for i in range(1,t):
    if i%a == 0:
        cnt+=b
print(cnt)
# Judge status: Wrong Answer
s=input()
ans=0
if s[0]=="0":
    for i in range(1,len(s)-1,2):
        if s[i]!="1":
            ans+=1
        if s[i+1]!="0":
            ans+=1
    print(ans)
    exit()
else:
    for i in range(1,len(s)-1,2):
        if s[i]!="0":
            ans+=1
        if s[i+1]!="1":
            ans+=1
    print(ans)
    exit()
# Judge status: Wrong Answer
s=input()
S=list(set(s))
A=[]
cnt=124
for i in range(97,123):
  A.append(S.count(chr(i)))
#print(A)
if sum(A)==26:
  print('NONE')
else:
  print(chr(A.index(0)+97))
# Judge status: Wrong Answer
x = int(input())
ans = (x//11)*2
if(x%11>5):
    ans += 2
elif(x%11>0):
    ans += 1

print(ans)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
if (abs(b - c) <= d and abs(a-b) <= d) or abs(c-a) <= d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())

d = {}
for _ in range(N):
  S = input()
  if S in d:
    d[S] += 1
  else:
    d[S] = 1

m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
  print(s)
# Judge status: Accepted
import heapq
N, M = map(int, input().split())
arubaito = [list(map(int, input().split())) for _ in range(N)]
arubaito.sort()
arubaito2 = [[] for _ in range(M+1)]
for i in range(N):
    if arubaito[i][0] <= M:
        arubaito2[arubaito[i][0]].append(arubaito[i][1])
for i in range(M):
    arubaito2[i].sort(reverse=True)
target = []
ans = 0
heapq.heapify(target)
for i in range(1,M+1):
    for k in arubaito2[i]:
        heapq.heappush(target,k*(-1))
    if len(target) > 0:
        ans += heapq.heappop(target)*(-1)
print(ans)
# Judge status: Accepted
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
    
K = input("")
K = int(K)
SUM = 0
for a in range(K):
    ai = a+1
    for b in range(K):
        bi = b+1
        for c in range(K):
            ci = c+1
            SUM = SUM + gcd(ai, bi, ci)

print(SUM)
# Judge status: Wrong Answer
s = list(input())

for i in range(1,len(s)-1):
    adana = s[i-1:i+2]
    if adana[1] == "a" or adana[1] == "i" or adana[1] == "u" or adana[1] == "e" or adana[1] == "o":
        print("".join(adana))
        break
    else:
        continue
# Judge status: Wrong Answer
s = input()
n = len(s)
le = 1
ans = n
for i in range(n - 1):
    if s[i] == s[i + 1]:
        le += 1
    else:
        ans -= (le + 1) // 3
        le = 1
print(ans)
# Judge status: Accepted
n = int(input())
ans = 0
s = 0
for i in range(1,n+1):
    if i*(i+1)//2 >= n:
        break
k = i*(i+1)//2 - n
for j in range(1,i+1):
    if j == k:
        pass
    else:
        print(j)
# Judge status: Accepted
N,x = map(int,input().split())
a = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    if i == 0:
        if a[i] > x:
            ans += a[i] - x
            a[i] = x
    else:
        tmp = a[i] + a[i-1]
        if tmp > x:
            ans += tmp - x
            a[i] -= tmp - x

print(ans)
# Judge status: Accepted
n=int(input())
ans=0

for a in range(1,n):
    if n%a==0:
        ans+=n//a-1
    else:
        ans+=n//a

print(ans)
# Judge status: Wrong Answer
s = list(input())
K = int(input())
def plus(c,i):
    return chr((ord(c)-ord('a')+i)%26+ord('a'))
# 上から順に回るなら回す
for i,ss in enumerate(s):
    want = ord('z') + 1 - ord(ss)
    if K >= want:
        s[i] = plus(ss,want)
        K = K - want
K = K % 26
if K >= 1:
    s[-1] = plus(s[-1],K)
print("".join(s))
# Judge status: Accepted
import math
from itertools import permutations

N = int(input())
positions = [tuple(map(int, input().split(' '))) for _ in range(N)]


def distance(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)


s_distance = 0
n_routes = 0
for route in permutations(positions):
    s_distance += sum([distance(p1, p2) for p1, p2 in zip(route, route[1:])])
    n_routes += 1

print(s_distance / n_routes)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, K, S = map(int, input().split())
res = [0] * N
for i in range(K):
  res[i] = S
for i in range(K, N):
  if S < 10 ** 9:
    res[i] = 10 ** 9
  else:
    res[i] = 1
print(*res)
# Judge status: Accepted
n,k=map(int,input().split())
r=n%k
s=min([r,k-r])
print(s)
# Judge status: Accepted
S = input()

if S.isupper():
    print('A')
else:
    print('a')
# Judge status: Wrong Answer
n = int(input())

print(n%1000)
# Judge status: Accepted
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())

    i = int(n ** 0.5)

    while i >= 1:
        if n % i == 0:
            j = n // i
            print(i + n // i - 2)
            exit()
        i -= 1


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Judge status: Accepted
A, B, C = map(int,input().split())
print(max(C-(A-B),0))
# Judge status: Accepted
N, K = map(int, input().split())
ans = 0
while N != 0:
    N = N // K
    ans += 1
print(ans)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
h = int(input())
s = (a+b)*h/2
print(s)
# Judge status: Accepted
N = int(input())
v = list(map(int, input().split()))

v.sort()
m = v[0]
for i in range(1, N):
	m = (m + v[i]) / 2

print(m)
# Judge status: Wrong Answer
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for a in range(41):
  for b in range(201):
    for c in range(401):
      if 500*a + 100*b + 50*c == X:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))

abs_sum = 0
minus = 0
abs_list = []
for i in range(n):
    if A[i] < 0:
        minus += 1
    abs_list.append(abs(A[i]))
    abs_sum += abs_list[i]

if minus % 2 != 0:
    abs_sum -= min(abs_list)
print(abs_sum)
# Judge status: Accepted
x, y = map(int, input().split())
d = abs(abs(x) - abs(y))
if 0 <= x < y or x < y <= 0:
  print(d)
elif y < 0 < x or x < 0 < y:
  print(d+1)
elif 0 < y < x or y < x < 0:
  print(d+2)
elif y == 0 < x or y < x == 0:
  print(d+1)
else:
  raise Exception
# Judge status: Accepted
N = input()
N = int(N)
A = input().split()

minA = min(A)
minA = int(minA)
M = 10 ** 18

Y = 0
if minA != 0:
    Y = 1
    for i in range(N):
        X = A[i]
        X = int(X)
        Y = Y * X
        if Y > M:
            break


if Y > M:
    print(-1)
else:
    print(Y)
# Judge status: Accepted
n,m = map(int,input().split())
ans = 0

if n > m:
    n,m = m,n

if n == 1:
    if m == 1:
        print(1)
    else:
        print(m-2)
else:
    print((n-2)*(m-2))
# Judge status: Accepted
l=list(ord(c) for c in input())
sample=list(range(97,123))
diff=list(sorted(set(sample).difference(l)))
if len(diff)>0:
    print (chr(diff[0]))
else:
    print ('None')
# Judge status: Accepted
n = int(input())
p = input().split()
q = input().split()



def kai(s):
    var = s
    for i in range(1, s):
        var = var * i
    return var

def jun (v):
    l = [i for i in range(1, n + 1)]
    vn = 1
    for i in range(len(v)):
        tmp  = int(v[i])
        tmp_l = list(filter(lambda x: x < tmp, l))
        vn += len(tmp_l) * kai(len(l)-1)
        l.remove(tmp)
    return vn

print(abs(jun(p) - jun(q)) )
# Judge status: Accepted
S=input()
T=input()
d={}
for s,t in zip(S,T):
    if s in d:
        if d[s]!=t:
            print("No")
            exit()
    else:
        d[s]=t

if len(d)!=len(set(d.values())):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n, k = map(int, input().split())
h_list = list(map(int, input().split()))
dp = [0]
for i in range(1, n):
    mi = min([abs(h_list[i] - h_list[j]) + dp[j] for j in range(max(0, i - k), i)])
    dp.append(mi)
print(dp[-1])
# Judge status: Wrong Answer
sx,sy,tx,ty = map(int,input().split())

dx = tx-sx
dy = ty-sy
ans = ''
ans += 'R'*dx + 'U'*dy + 'L'*dx + 'D'*dy
dx+=1
dy+=1
ans +='D'+'R'*dx+'U'*dy+'L'
ans +='U'+'L'*dx+'D'*dy+'R'
print('ans')
# Judge status: Accepted
s = input()

a = s.count("a")
b = s.count("b")
c = s.count("c")

if abs(a-b) <=1 and abs(b-c) <= 1 and abs(c-a) <= 1: print("YES")
else: print("NO")
# Judge status: Accepted
def solve():
    A, B, C = map(int, input().split())

    if B - A == C - B:
        return True

    return False


if __name__ == '__main__':
    res = solve()
    if res:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
N = int(input())

print(N * 800 - (N // 15) * 200 )
# Judge status: Wrong Answer
# 累積和
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
cum_sum = [0]*n

total = 0
for i in range(n):
    total += a[i]
    cum_sum[i] = total

max_sum = cum_sum[-1]
dp = [0] * n
dp[0] = 10**9
for i in range(n-1):
    dp[i+1] = min(dp[i], abs(cum_sum[i]-(max_sum-cum_sum[i])))

print(min(dp))
# Judge status: Accepted
from collections import Counter

N, *A = map(int, open(0).read().split())

m = max(A) + 1
ok = [True] * m
ctr = Counter(A)
ans = 0
for a in sorted(A):
    if ok[a] and ctr[a] == 1:
        ans += 1
        
    for j in range(2 * a, m, a):
        ok[j] = False
            
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())

ids=[]

import heapq
import bisect

arr=[[] for _ in range(n)]

for i in range(n):
    heapq.heapify(arr[i])

for _ in range(m):
    p,y=map(int,input().split())
    ids.append([p,y])

    heapq.heappush(arr[p-1],y)

for info in ids:
    index = bisect.bisect_left(arr[info[0]-1],info[1])

    print(str(info[0]).zfill(6)+str(index+1).zfill(6))
# Judge status: Accepted
s = input()
t = input()
ss = sorted(s)
tt = sorted(t,reverse=True)
if ss < tt:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N=int(input())
A=list(map(int, input().split()))
master=False
if max(A)>=3200:
  master=True
  
def judge(n):
  return n//400

rate=[0]*8
masters=0
for a in A:
  if judge(a)<8:
    rate[judge(a)]+=1
  else:
    masters+=1
  
count=0
for r in rate:
  if r!=0:
    count+=1
if master:
  MAX=min(count+masters, 8)
else:
  MAX=count

print(count,MAX)
# Judge status: Wrong Answer
A, B = map(int, input().split())

M = max(A, B)
m = min(A, B)
ans = 1

tmp = m
l = []
for i in range(2, int(-(-m**0.5//1))+1):
    if tmp % i == 0 and M % i == 0:
        l.append(i)
        ans += 1
        while tmp % i == 0:
            tmp //= i

if tmp != 1 and M % tmp == 0:
    l.append(tmp)
    ans += 1

if l == [] and M % m == 0 and m != 1:
    l.append(m)
    ans += 1

print(ans)
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()
    K = int(input())

    ans = 1
    for s in S:
        if s != "1":
            ans = int(s)
            break

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter
N,*A = map(int,open(0).read().split())
ca = Counter(A)
copy_ca = ca.copy()
for i in ca.items():
    if i[1] % 2 == 0:
        del copy_ca[i[0]]
print(len(copy_ca))
# Judge status: Accepted
n=int(input())
if n%1000==0:
    print(0)
else:
    i=n//1000
    print((i+1)*1000-n)
# Judge status: Wrong Answer
N=int(input())
W=list(map(int,input().split()))
s=[]
for T in range(0,N-1):
  S_1=sum(W[0:T])
  S_2=sum(W[T:N])
  s.append(abs(S_1-S_2))
print(min(s))
# Judge status: Wrong Answer
a,b=map(int,input().split())
c=a-1
count=1
while a<b:
  a=a+c
  count+=1
print(count)
# Judge status: Accepted
N=int(input())
alist=list(map(int,input().split()))
#print(alist)

blist=[]
for i in range(N):
  blist.append(alist[i]-(i+1))

blist.sort()
#print(blist)
b=blist[N//2]
#print(b)
answer=0
for i in range(N):
  answer+=abs(alist[i]-(b+i+1))
  
print(answer)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = [0]*pow(10,6)
for a in A:
    B[a]+=1
    B[a+1]+=1
    B[a+2]+=1
print(max(B))
# Judge status: Accepted
H,A=input().split()
print('Yes' if H==A else 'No')
# Judge status: Accepted
a,b,c,d=[int(i) for i in input().split()]
c=-(-c//b)
a=-(-a//d)
print("Yes" if c<=a else "No")
# Judge status: Accepted
import math
from functools import reduce

def main():
    k = int(input())
    ans = 0
    ary = []
    for i in range(1,k+1):
        for j in range(1,k+1):
            ary.append(math.gcd(i,j))
    for i, aa in enumerate(ary):
        for j in range(1,k+1):
            ans += math.gcd(aa,j)
    print(ans)


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

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

if __name__=='__main__':
    main()