peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
#!/usr/bin/env python3

from collections import deque

k = int(input())

que = deque(reversed([i for i in range(1, 10)]))

x = -1
for _ in range(k):
    # print(f"loop: {_}")
    # print(f"que: {que}")
    x = que.pop()
    # print(f"x: {x}\n")
    if x % 10 != 0:
        que.appendleft(x * 10 + x % 10 - 1)
    que.appendleft(x * 10 + x % 10)
    if x % 10 != 9:
        que.appendleft(x * 10 + x % 10 - 1)

print(x)
# Judge status: Accepted

def main():
    A,B,C  = map(int, input().split()) 
    temp = A
    while temp % B != C:
        temp += A
        if temp % B == A % B:
            print('NO')
            return
    print('YES')


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = map(int, input().split())
if (a + b + c) >= 22:
    print('bust')
else:
    print('win')
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 11:36:43 2020

@author: shinba
"""

n = input()

if n.count("9") != 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m=map(int, input().split())
if n == 1 and m == 1:
    print(1)
elif n == 1:
    print(m-2)
elif m == 1:
    print(n-2)
else:
    Ans = (m-2) * (n-2)
    print(Ans)
# Judge status: Accepted
import itertools
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
k = [(1+i)/2 for i in p]
a = list(itertools.accumulate(k))
max = a[K-1]
for i in range(K,N):
    if max < a[i] - a[i-K]:
        max = a[i] - a[i-K]
print(max)
# Judge status: Accepted
S = list(input())

if S[0] == 'A':
    cnt = 0
    for i in range(2, len(S)-1):
        if S[i] == 'C':
            cnt += 1
    if cnt == 1:
        S.sort()
        for i in range(2, len(S)):
            if S[i].isupper():
                print('WA')
                exit()
        print('AC')
    else:
        print('WA')
else:
    print('WA')
# Judge status: Accepted
A, B, C = input().split()
if len(set([A, B, C])) == 2:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
print(int(N / 2 * (N + 1)))
# Judge status: Accepted

a, b = (int(x) for x in input().split())

if (a * b) % 2 == 0 :
    print('Even')
else :
    print('Odd')
# Judge status: Accepted
n = int(input())
happiness = [list(map(int, input().split())) for i in range(n)]
dp = [[0] * 3 for i in range(n + 1)]

for i in range(n):
  dp[i + 1][0] = max(dp[i][1], dp[i][2]) + happiness[i][0]
  dp[i + 1][1] = max(dp[i][2], dp[i][0]) + happiness[i][1]
  dp[i + 1][2] = max(dp[i][1], dp[i][0]) + happiness[i][2]

print(max(dp[n]))
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
A.sort()
cnt=0
ans=[]
a=A[0]
for i in range(1,N):
    if A[i]-a<=2:
        cnt+=1
    else:
        a=A[i]
        ans.append(cnt)
        cnt=0
ans.append(cnt)
MAX=max(ans)
if MAX>0:
    print(MAX+1)
else:
    print(MAX)
# Judge status: Accepted
n = input()

if (n[0] == n[1] and n[1] == n[2]) or (n[1] == n[2] and n[2] == n[3]):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]
A = [0 for i in range(26)]
ans = 0
for i in range(D):
  K = []
  for k in range(26):
    c = 0
    for j in range(26):
      if j != k:
        c += C[j] * (i+1-A[j])
    an = S[i][k]-c
    K.append([an, k+1])
  K.sort()
  a = K[-1][1]
  print(a)
  A[a-1] = i+1
  ans += K[-1][0]
# Judge status: Wrong Answer
N, *X = map(int, open(0).read().split())

ans = 0
tmp = 0
for i in range(N):
    if X[i] == i + 1:
        tmp += 1
        if tmp == 2:
            ans += 1
            tmp = 0
    else:
        ans += int(tmp > 0)
        tmp = 0

print(ans)
# Judge status: Accepted
#鬼
a,v=map(int,input().split())

#逃げている
b,w=map(int,input().split())

#t秒以内
t=int(input())

if v>w:
    if abs(a-b)<=(v-w)*t:
        print("YES")
        exit()

print("NO")
# Judge status: Wrong Answer
N, K = [int(i) for i in input().split()]
A = [0] + [int(i) for i in input().split()]
B = [1]
while(True):
    tmp = A[B[-1]]
    if not tmp in B:
        B += [tmp]
    else:
        head = B.index(tmp)
        break
K = (K - len(B[:head]))  % len(B[head:])
print(B[head:][K])
# Judge status: Accepted
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
asum=[]
s=sum(a)
for i in range(n):
    s=s-a[i]
    asum.append(s)
ans=1
x=2**n
p=1
if n==0:
    if a[0]==1:
        print(1)
    else:
        print(-1)
    sys.exit()
for i in range(n):
    x//=2
    p-=a[i]
    if 2*p<asum[i]/x or asum[i]<p:
        print(-1)
        sys.exit()
    p=min(2*p,asum[i])
    ans+=p
print(ans)
# Judge status: Accepted
S = input()
wordNum = [0 for i in range(26)]
for wordOne in S:
    idx = ord(wordOne) - ord('a')
    wordNum[idx] += 1

ans = "None"
for i in range(26):
    if wordNum[i] == 0:
        ans = chr(ord('a') + i)
        break;

print(ans)
# Judge status: Wrong Answer
from functools import lru_cache


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


k = int(input())
ans = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        for p in range(1, k + 1):
            ans += gcd(i, gcd(j, p))
print(ans)
# Judge status: Accepted
n,r = list(map(int,input().split()))
if n >= 10:
  print(r)
else:
  print(r + (100 * (10-n)))
# Judge status: Accepted
from collections import Counter
n = int(input())
ls = list(map(int,input().strip().split()))
dic = Counter(ls)
for i in range(1,n+1):
    print(dic[i])
# Judge status: Accepted
n=int(input())
v =list(map(int,input().split()))
v.sort()
x = v[0]
if n > 2:
        for i in range(1,n):
            x += v[i]*2**(i-1)

        ans = x/2**(n-1)
        print(ans)

else:
        print((x+v[1])/2)
# Judge status: Wrong Answer
import heapq as hp
n = int(input())
if n%2 ==0:
    m = n//2 + 1
else:
    m = (n+1) //2
a,b = [],[]
for i in (0,n):
    c = list(map(int, input().split()))
    a.append(c[0])
    b.append(c[1])
la = hp.nlargest(m,a)
lb = hp.nlargest(m,b)
if n%2 == 0:
    c = la[-1] + la[-2] 
    d = lb[-1] + lb[-2] 
    print(d-c+1)
else:
    print(lb[-1]//2-la[-1]//2+1)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
import itertools

ans = 0
for K in itertools.combinations(L, 3):
    if K[0] != K[1] and K[1] != K[2] and K[2] != K[0]:
        k_sorted= sorted(K)
        #print(k_sorted)
        if k_sorted[2] < k_sorted[0] + k_sorted[1]:
            ans += 1
print(ans)
# Judge status: Accepted
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    a = input()[:-1]

    if ord('a') <= ord(a) <= ord('z'):
        print('a')
    else:
        print('A')
        

main()
# Judge status: Wrong Answer
s = list(map(int,input().split()))
print(s.count(1))
# Judge status: Accepted
s, w = map(int, input().split())
print('unsafe' if s <= w else 'safe')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a = sorted([i//400 for i in a])
min_a = 0
max_a = 0
flag = -1
for i in range(n):
  if a[i] >= 8:
    max_a += 1
  elif flag != a[i]:
    min_a += 1
    max_a += 1
  flag = a[i]
print(max(1,min_a),max_a)
# Judge status: Accepted
import collections
n = int(input())
l = list(int(input()) for i in range(n))
d = collections.Counter(l)
ans = 0
for v in d.values():
  ans += v % 2
print(ans)
# Judge status: Accepted
import fractions

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

gcd=a[0]
for i in range(1,n):
    gcd=fractions.gcd(a[i],gcd)

print(gcd)
# Judge status: Wrong Answer
n = int(input())
a_ls = list(map(int, input().split()))
times = 0
i = 0
# indの右側を切断するかどうか
cut = [0] * n
while i+2 < n:
    if a_ls[i] < a_ls[i+1] > a_ls[i+2] or a_ls[i] > a_ls[i+1] < a_ls[i+2] and not cut[i]:
        times += 1
        cut[i+1] = 1
    i += 1
if times > 0:
    print(times+1)
else:
    print(0)
# Judge status: Accepted
base_name=input()
new_name=input()

if new_name[:-1]==base_name:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a = sorted(input(), reverse=True)
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
ans = 'No'
k = [aa, bb]
sorted(k)
if k[0] == bb:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
from collections import deque

n, m = map(int, input().split())
rooms = [[] for i in range(n + 1)]

for i in range(m):
    a, b = map(int, input().split())
    rooms[a].append(b)
    rooms[b].append(a)

q = deque()
q.append(1)
signs = [-1]*(n + 1)
signs[1] = 0

while q:
    rnum = q.popleft()
    for i in rooms[rnum]:
        if signs[i] == -1:
            signs[i] = rnum
            q.append(i)

print("Yes")

for i in signs[2:]:
    print(i)
# Judge status: Accepted
s = list(str(input()))
a = 0
b = 0
c = 0
for i in range(len(s)):
    if s[i] == 'a':
        a += 1
    elif s[i] == 'b':
        b += 1
    elif s[i] == 'c':
        c += 1

if a == 1 and b == 1 and c == 1:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
from collections import Counter

N = input()
D_list = list(map(int, input().split()))

max_D = max(D_list)
cnt_dic = dict(Counter(D_list))

if (D_list[0] == 0) & (cnt_dic.get(0) == 1):
    ans = 1
    for n in range(1, max_D + 1):
        ans *= cnt_dic.get(n - 1, 0)  ** cnt_dic.get(n, 1)
    print(ans)
else: 
    print(0)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
ans = []
ans.append(100* a + 10*b + c)
ans.append(100* a + 10*c + b)
ans.append(100*  b+ 10*a + c)
ans.append(100* b + 10*b + a)
ans.append(100* c + 10*a + b)
ans.append(100* c + 10*b + a)
print(max(ans))
# Judge status: Wrong Answer
a = int(input())
b = int(input())
h = int(input())

print((a + b) * h / 2)
# Judge status: Accepted
n, m = list(map(int, input().split()))
print('Yes' if n == m else 'No')
# Judge status: Accepted
N,M,X=[int(s) for s in input().split()]
Book=[[int(s) for s in input().split()] for _ in range(N)]
INF=10**7

ans=set()
ans.add(INF)

for n in range(2**N):
  #Bit全探索
  Xls=[0 for i in range(M)]
  cost=0
  for i in range(N):
    if ((n>>i)&1)==1:
      cost+=Book[i][0]
      for b in range(M):
        Xls[b]+=Book[i][b+1]
    if min(Xls)>=X:
      ans.add(cost)
if min(ans)==INF:
  print(-1)
else:
  print(min(ans))
# Judge status: Accepted
a=input()
b=input()
c=''
for i in range(3):
    c+=a[2-i]
if(c==b):
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
array = list(map(int, input().split(' ')))

K = int(input())

for i in range(K):
  if array[2] == max(array):
    if array[0] > array[1]:
      array[1] = array[1] * 2
    else:
      array[0] = array [0] * 2
  else:
    array[2] = array[2] * 2

if array[0] < array[1] and array[1] < array[2]:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N=int(input())
c=[[0]*10]*10
for n in range(1,N+1):
    c[int(str(n)[0])][int(str(n)[-1])]+=1
sum=0
for i in range(10):
    for j in range(10):
        sum+=c[i][j]*c[j][i]
print(sum)
# Judge status: Wrong Answer
a=input()
print('chr(ord(a)+1)')
# Judge status: Wrong Answer
l = list(map(int,input().split()))
cnt = 0

while True:
    if len([i for i in l if i%2 == 1]) == 0:
        cnt += 1
        l = [int(s/2) for s in l]
    else:
        break

print(cnt)
# Judge status: Accepted
from collections import deque
n = int(input())
a = list(map(str, input().split()))
b = deque()
if n%2:
    flag = False
else:
    flag = True
for i in range(n):
    if flag:
        if (i+1)%2:
            b.append(a[i])
        else:
            b.appendleft(a[i])
    else:
        if (i+1)%2:
            b.appendleft(a[i])
        else:
            b.append(a[i])
res = list(b)
print(' '.join(res))
# Judge status: Accepted
A, B, X = map(int, input().split())

if (X >= A and X <= A + B):
	print("YES")
else:
	print("NO")
# Judge status: Accepted
import math
from fractions import gcd
a, b = map(int, input().split())
g = gcd(a, b)
sqrt = math.floor(g ** 0.5)
factors = [1]
z = g
for i in range(2, sqrt + 1):
    if not z % i:
        factors.append(i)
        while z % i == 0:
            z //= i
if z > 1:
    factors.append(z)
print(len(factors))
# Judge status: Accepted
import math

n,m = map(int,input().split())
li = list(map(int,input().split()))
wa = 0
for i in li :
    wa+=i

for i in li :
    if i < math.ceil((wa/float(4*m))) :
        n -= 1

if n>=m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x, y = map(int, input().split())
if x == 0:
    if y == 100:
        print(101)
    else:
        print(y)
elif x == 1:
    if y == 100:
        print(10100)
    else:
        print(y*100)
else:
    if y == 100:
        print(1010000)
    else:
        print(y*10000)
# Judge status: Wrong Answer
n = int(input())

result_list = [0] * n

half = int(n/2)

for x in range(1, half):
    for y in range(1, half):
        for z in range(1, half):
            calculated_n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if calculated_n <= n+1:
                result_list[calculated_n-1] += 1



print(result_list)
# Judge status: Accepted
# coding: utf-8
A, B, N = map(int, input().split())

num = min(B-1, N)

print(A * num // B - A * (num // B))
# Judge status: Accepted

N= int(input())
B = list(map(int,input().split()))
A = [0]*N
A[0] = B[0]
for i in range(len(A)-2):
    A[i+1] = min(B[i],B[i+1])
    
A[-1] = B[-1]  
#print(A)
print(sum(A))
# Judge status: Accepted
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x, y = map(int, read().split())

def f(x, y):
    # + のみ
    if x <= y:
        yield y - x
    # 反転、+
    if -x <= y:
        yield 1 + x + y
    # +、反転
    if x <= -y:
        yield 1 - x - y
    # 反転、+、反転
    if -x <= -y:
        yield 2 - y + x

x = min(f(x, y))
print(x)
# Judge status: Accepted
def intersect_list(lst1, lst2):
    arr = []
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            pass
        else:
            arr.append(element)
    return arr

n = int(input())
a0 = list(input())
for i in range(n-1):
    a  = list(input())
    a0 = intersect_list(a0, a)

print("".join(sorted(a0)))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a + b == c or a + c == b or b + c ==a:
  print("YES")
# Judge status: Wrong Answer
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
m = min(a,b,c,d,e)
if n%m!=0:
  t = n//m +5
else:
  t = n/m +4
print(t)
# Judge status: Accepted
def main():
    n = int(input())
    d = {}
    for _ in range(n):
        s = input()
        d[s] = d.get(s, 0) + 1
    
    print('AC x ' + str(d.get('AC', 0)))
    print('WA x ' + str(d.get('WA', 0)))
    print('TLE x ' + str(d.get('TLE', 0)))
    print('RE x ' + str(d.get('RE', 0)))

    
if __name__ == '__main__':
    main()
# Judge status: Accepted
A, B = list(map(int,input().split()))
if A%3 == 0 or B%3 == 0 or (A+B)%3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Wrong Answer
s = input()
ACGT = ["A","C","G","T"]
ans = 0
ANS = [0]

for i in range(len(s)):
    if s[i] in ACGT:
        ans += 1
    else:
        ANS.append(ans)
        ans = 0
        
print(max(ANS))
# Judge status: Accepted
A,B,C = sorted(map(int, input().split()))
print(A+B+C*10)
# Judge status: Wrong Answer
s = input()

if s =='SUN':
    print(7)
elif s == 'SAT':
    print(1)
elif s == 'FRI':
    print(2)
elif s == 'THU':
    print(3)
elif s == 'WED':
    print(4)
elif s == 'TUS':
    print(5)
elif s == 'MON':
    print(6)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a%2==0 or b%2==0 or c%2==0:
  print(0)
else:
  x=[a,b,c]
  x.sort()
  print(x[0]*x[1])
# Judge status: Accepted
a, b = map(int, input().split())
c = [int(i)&1 for i in input().split()]
odd = sum(c)
val = 0
if odd:
    val = 2**(a-1)
else:
    val = 2**a*(1-b)
 
print(val)
# Judge status: Accepted
x=int(input())
ans=["NO","YES"][x==7 or x==5 or x==3]
print(ans)
# Judge status: Wrong Answer
N, M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort()

ans = 0
for i in range(N):
  #まだ足りないケース
  if M > AB[i][1]:
    ans += AB[i][0] * AB[i][1]
    M -= AB[i][1]
  else:
    ans += AB[i][0] * M
print(ans)
# Judge status: Accepted
S=input()
T=input()
c=0
for i in range(len(S)):
    if S[i] != T[i]:
        c+=1
print(c)
# Judge status: Accepted
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
score = 0

def rsp(hand: str) -> int:
  if hand == 'r':
    return p
  elif hand == 's':
    return r
  else:
    return s

for i in range(k):
  score += rsp(t[i])
  twice = True
  for j in range(i+k, n, k):
    if t[j] == t[j-k]:
      if twice:
        twice = False
      else:
        twice = True
        score += rsp(t[j])
    else:
      twice = True
      score += rsp(t[j])
      
print(score)
# Judge status: Wrong Answer
(n, m) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]

t = sum(a)

a = sorted(a)

chosen = a[-m:]

r = 1 / (4 * m) * t

c = ['Yes' if a >= r else 'No' for a in chosen]

c = set(c)

ans = 'Yes' if len(c) == 1 else 'No'

print(ans)
# Judge status: Accepted
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
day = day[::-1]
i = day.index(S)
print((i+1))
# Judge status: Accepted
n = int(input())
l = []
i = 1
while i<=n:
    a = input()
    l.append(a)
    i+=1
print("AC x "+ str(l.count("AC")))
print("WA x "+ str(l.count("WA")))
print("TLE x "+ str(l.count("TLE")))
print("RE x "+ str(l.count("RE")))
# Judge status: Accepted
a,b,c,d = map(int, input().split())
print(max(a*c,a*d,b*c,b*d))
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

r = [0]*N

now = 0
r[now]=1
for i in range(N):
  now = A[now]-1
  if r[now] == 0:
    r[now] = i+2
  else:
    x1 = r[now]
    x2 = i+1
    break
print(x1, x2)
print(r)
roop_num = x2 - x1 + 1
x = (K-x1+1) % roop_num
print(x)
if K < x1:
  print(r.index(K+1)+1)
else:
  print(r.index(x1 + x)+1)
# Judge status: Accepted
s = input()
if s[-1] == "s":
    print(s + "es")
else:
    print(s+"s")
# Judge status: Accepted
n, m, k = map(int, input().split())

for i in range(n + 1):
	for j in range(m + 1):
		if i * (m - j) + j *(n - i) == k:
			print("Yes")
			break
	else:
		continue
	break
else:
	print("No")
# Judge status: Accepted
import numpy as np

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

ans = a[0]

for i in range(1,len(a)):
    ans = np.gcd(a[i],ans)

print(ans)
# Judge status: Accepted
a, b = map(int,input().split())
s = input()
if len(s) == a + b + 1 and s[a] == '-' and s.count('-') ==1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x = int(input())
ans = (x // 11) * 2

if x % 11 > 6:
    ans += 2
elif x % 11 > 0:
    ans += 1
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
q=int(input())
dp=[0]*(10**5+1)
for i in range(1,10**5+1):
  dp[i]=a.count(i)

for j in range(min(q,1000)):
  b,c=map(int,input().split())
  ans+=(c-b)*dp[b]
  dp[c]+=dp[b]
  dp[b]=0
  print(ans)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
BS = 1
for i in range(N):
  if a[i] == BS:
    BS += 1
if a[i] == 1:
  print(-1)
else:
  print(N+1-BS)
# Judge status: Wrong Answer
X,N = map(int,input().split())
P = list(map(int,input().split()))

result = 0
if N == 0:
    result = X
else:
    list = [i for i in range(101)]
    for i in P:
        list.remove(i)
    if len(list) == 0:
        result  = 0
    else:
        min = 100
        for i in list:
            if min > abs(X-i):
                min = abs(X - i)
                result = i
print(result)
# Judge status: Accepted
n, m = map(int, input().split())
red = [1] + [0] * (n - 1)
num = [1] * n
for i in range(m):
    x, y = map(int, input().split())
    if red[x - 1] == 1:
        red[y - 1] = 1
        if num[x - 1] == 1:
            red[x - 1] = 0
    num[x - 1] -= 1
    num[y - 1] += 1
    
print(sum(red))
# Judge status: Accepted
a,b = map(int, input().split())

i = a
c = 1
while int(i) < int(b):
  i += int(a) - 1
  c += 1
if int(b) == 1:
  print(0)
else:
  print(c)
# Judge status: Wrong Answer
h,a=map(int,input().split())
x=h//a
print(x+1)
# Judge status: Accepted
n, m = map(int, input().split())

to = [[] for i in range(n + 1)]


for i in range(m):
    a, b = map(int, input().split())
    to[a].append(b)
    to[b].append(a)

ans = [-1] * (n+1)


import collections
q = collections.deque([1])

while q:
    now = q.popleft()
    for t in to[now]:
        if ans[t] == -1:
            q.append((t))
            ans[t] = now

if (-1) in ans[2:]:
    print('No')
else:
    print('Yes')
    for a in ans[2:]:
        print(a)
# Judge status: Wrong Answer
n,k = map(int,input().split())
left = 0
right = 10**19

while right - left >1:
  middle = (right + left)//2
  if middle < abs(middle - k) :
    left = middle
  else:
    right = middle
if n == 0:
  print(0)
elif k//n==2:
  print(n)
elif n % k == 0:
  print(0)
else:
  print(min(left,abs(n-k),n))
# Judge status: Accepted
def main():
    k = int(input())

    if k % 2:
        res = (k // 2) * (k - k // 2)
    else:
        res = (k // 2) ** 2

    print(res)

if __name__ == '__main__':
    main()
# Judge status: Accepted
s = list(str(input()))
for i in range(len(s)):
    if s[i] == '?':
        s[i] = 'D'
print(''.join(s))
# Judge status: Accepted
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    K, X = map(int, readline().split())
    print(*list(range(X - K + 1, X + K)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort(reverse = True)
if b>=a:
    print(0)
else:
    print(sum(arr[b:]))
# Judge status: Accepted
N = int(input())
ctr = 0
for i in range (1, N+1):
  if (i>0 and i<10) or (i>99 and i<1000) or (i>9999 and i<100000):
    ctr += 1
print(ctr)
# Judge status: Accepted
import fractions
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)
# Judge status: Accepted
n = int(input())
result = 1
limit = 10**9+7
for i in range(1, n+1):
    result = result*i % limit
print(result)
# Judge status: Accepted
# -*- coding: utf-8 -*-

#入力
N = int(input())

#処理
for i in range(N, 1000):
    if i%111==0:
        print(i)
        break
# Judge status: Accepted
p,q,r = map(int, input().split())

print(p + q + r - max(p,q,r))
# Judge status: Wrong Answer
n=list(map(int, input().strip().split()))

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=(int(n[a])+int(n[i]))
            lis1.append(str(z))

minscore='9999999999'
for i in range(0,len(lis1)):
    if float(minscore)>float(lis1[i]):
        minscore=lis1[i]

print(minscore)
# Judge status: Wrong Answer
def f(n):
    if n%2 == 0:
        return n//2
    else:
        return 3*n+1

s = int(input())
ans = 0
u = s
i = 1
t = [0]*1000010
t[0] = s
while 1:
    i += 1
    u = f(u)
    if t[u]!=0:
        ans = i
        break
    else:
        t[u] = 1
print(ans)
# Judge status: Wrong Answer
c1 = list(input())
c2 = list(input())

if c1[0] == c2[-1] and c1[-1] == c2[0]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
D = int(input())

for i in range(D):
    print((i+1) % 26)
# Judge status: Accepted
n,m=map(int,input().split())
print("Yes" if n==m else "No")
# Judge status: Wrong Answer
n = int(input())
l = sorted(map(int, input().split()))
a = 0
b = 0
for i in range(n):
  if i % 2 == 0:
  	a += l.pop()
  else:
    b += l.pop()
print(a)
# Judge status: Wrong Answer
def abstract(a, b):
    return abs(a - b)

N, K = [int(x) for x in input().split()]

A = N
min_temp = A

if N == 1 or K == 1:
    print(0)
elif N == 0:
    print(K)
elif N == 2 or K == 2:
    print(2)
else:
    while True:
        min_temp = abstract(A, K)
        if A < min_temp:
            break
        elif A == min_temp:
            break
        A = min_temp
    print(A)
# Judge status: Accepted
A,B = map(int,input().split())
cnt = 0
for i in range(A,B+1):
    a = str(i)
    b = a[::-1]
    if a==b:
        cnt += 1
print(cnt)