peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
s = sorted(input())

if len(set(s)) == 2 and s[0] == s[1] and s[2] == s[3]:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
N = int(input().strip())
def hoge(N, r):  # 1-Nのrの倍数の和
  R = N-(N%r)  # N以下の一番大きいrの倍数を知りたい
  n = R//r
  return n*(n+1)//2*r

ans = hoge(N,1) - hoge(N,3) - hoge(N,5) + hoge(N,15)
print(ans)
# Judge status: Accepted
import sys
from fractions import gcd
import math

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

A = []
for a in AA:
    A.append(a//2)

def f(x):
    c = 0
    while x%2 == 0:
        c += 1
        x //= 2
    return c

a0 = f(A[0])
for a in A:
    if f(a) != a0:
        print(0)
        sys.exit()

def lcm(x,y):
    return x*y//gcd(x,y)

l = A[0]
for a in A:
    l = lcm(l,a)

ans = M//l
print((ans+1)//2)
# Judge status: Accepted
import math
n = int(input())
print(math.factorial(n) % (10 ** 9 + 7))
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
print(max(10*a+b+c, a+10*b+c))
# Judge status: Accepted
X = input()
stack = []
for e in X:
    if e == 'S':
        stack.append(e)
    else:
        if len(stack) == 0 or stack[-1] == 'T':
            stack.append(e)
        else:
            stack.pop()
print(len(stack))
# Judge status: Accepted
from math import ceil
n = int(input())
lst = [list(map(int,input().split())) for _ in range(n-1)]
for i in range(n-1):
    ans = lst[i][0]+lst[i][1]
    for j in range(i+1, n-1):
        k = max(0, ceil((ans-lst[j][1])/lst[j][2]))
        ans = lst[j][1]+k*lst[j][2]+lst[j][0]
    print(ans)
print(0)
# Judge status: Accepted
import math
a,b,c,d=list(map(int,input().split()))
a-=1
def calculation(x,c,d):
	x=x-(x//c)-(x//d)+(x//((c*d)//math.gcd(c,d)))
	return x
	
print(calculation(b,c,d)-calculation(a,c,d))
# Judge status: Accepted
A,B,X=map(int,input().split())

if X>=A and X<=A+B:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=0
dist=100
for i in range(n):
  d=abs(t-h[i]*0.006-a)
  if d<=dist:
    dist=d
    ans=i+1
print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
kakuritu=0
for i in range(1,n+1):
  if i>=k:
    kakuritu+=1
  else:
    kaisu=k//i
    count=0
    while kaisu>1:
      kaisu=kaisu/2
      count+=1
    kakuritu+=0.5**count
print(kakuritu/n)
# Judge status: Wrong Answer
l = list(input())
n = l.count('N')
w = l.count('W')
s = l.count('S')
e = l.count('E')
if (n + s) % 2 == 0 and (w + e) % 2 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
H, N = input().split()
H = int(H)
N = int(N)
a = []
b = []
con = 1
while con <= N:
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)
    con += 1
print(sum(b))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a+b > c:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import sys
def main():
    x, y = map(int, input().split())
    
    for i in range(0, 3):
        for j in range(0, 3-i):
            res = i * 2 + j * 4
            if y == res:
                print('Yes')
                sys.exit()
                
    print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
import statistics
def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	seq = []
	for i in range(1, n+1):
		seq.append(i-a[i-1])
	seq = sorted(seq)
	m = int(statistics.median(seq))
	ans = 0
	for i in seq:
		ans += abs(i-m)
	print(ans)
resolve()
# Judge status: Accepted
num = int(input())
index = list(map(int, input().split()))
point = list(map(int, input().split()))
add = list(map(int, input().split()))


total = 0
for i in range(num):
  total += point[index[i]-1]

for j in range(num-1):
  if index[j+1] == index[j]+ 1:
    total += add[index[j]-1]

print(total)
# Judge status: Accepted
N = int(input())
A = []

for i in range(N):
    A.append(int(input()))

B = A
maxim = max(A)
max_i = A.index(maxim)
B.remove(maxim)
second = max(B)

for i in range(N):
    if (i == max_i):
        print(second)
    else:
        print(maxim)
# Judge status: Accepted
h, a = map(int, input().split())
i = 0
while h > 0:
    h -= a
    i += 1

print(i)
# Judge status: Wrong Answer
s = input()
s.replace("2017","2018")
print(s)
# Judge status: Accepted
n,m = map(int,input().split())

from operator import mul
from functools import reduce

def bb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
if m==1 and n==1:
    print(0)
    exit()

if m>1 and n>1:
    print(bb(n,2)+bb(m,2))
elif m>1:
    print(bb(m,2))
else:
    print(bb(n,2))
# Judge status: Wrong Answer
A,B=map(int,input().split())
if (A>=13):
  print(B)
elif(12>=A>=6):
  print(B/2)
else:
  print(0)
# Judge status: Accepted
n,k=map(int,input().split())
 
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

x10=n
x2=Base_10_to_n(x10, k)
print(len(x2))
# Judge status: Accepted
def resolve():
    '''
    code here
    '''
    x, y = [int(item) for item in input().split()]
    res = 0

    if x < 0 and abs(y) - abs(x) >= 0:
        res += 1
    elif x > 0 and abs(y) - abs(x) <= 0:
        res += 1

    res += abs(abs(x) - abs(y))


    if y > 0 and abs(y) - abs(x) < 0:
        res += 1
    elif y < 0 and abs(y) - abs(x) > 0:
        res += 1

    print(res)

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
a,b,c = map(int,(input().split()))
num = [] 
num.append(a)
num.append(b)
num.append(c)
num.sort(reverse=True)
print(num[0]*10+num[1]+num[2])
# Judge status: Accepted
N = int(input())
primetable = []

i = 2
while i* i <= N:
  if(N % i == 0):
    j = 0
    while N % i == 0:
      N/= i
      j+= 1
    primetable.append((i, j))
  i+= 1
if(N != 1):
  primetable.append((int(N), 1))
  
Ans = 0  
for i in primetable:
  ans = 0
  n = 1
  while 1/ 2* n* (n+ 1)<= i[1]:
    ans = n
    n+= 1
  Ans+= ans  
  
print(Ans)
# Judge status: Wrong Answer
def hi(name):
    print("Hello,", name)

def f(x):
    return x * x

hi("Alice")
hi("Bob")

print( f(2) )
print( f(8) )
# Judge status: Accepted
def solve():
  ans = 1
  N = int(input())
  A = list(map(int, input().split()))
  ud = 0
  for i in range(N-1):
    a = A[i+1]-A[i]
    if a*ud<0:
      ans += 1
      ud = 0
    elif ud==0:
      ud = a
  return ans
print(solve())
# Judge status: Wrong Answer
H, W = map(int, input().split())
if H % 2 == 0 or W % 2 == 0:
  print(W * H // 2)
else:
  total = H * (W//2) + H//2 + 1
  print(total)
# Judge status: Accepted
S = input()
ret = 'No'
if S[2] == S[3]:
    if S[4] == S[5]:
        ret = 'Yes'
print(ret)
# Judge status: Accepted
import sys
import itertools
readline = sys.stdin.buffer.readline

n = int(readline())
ans = 0
for i in range(1,n+1):
    ans += i
print(ans)
# Judge status: Accepted
n = int(input())
if n <= 99:
  print(0)
  exit()
if 100 <= n <= 105:
  print(1)
  exit()
dp = [True] + [False] * n
for i in range(100, n + 1):
  if dp[i - 100] or dp[i - 101] or dp[i - 102] or dp[i - 103] or dp[i - 104] or dp[i - 105]:
    dp[i] = True
print([0, 1][dp[n]])
# Judge status: Accepted
k, s = map(int,input().split(' '))
count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - (x+y)
        if 0 <= z and z <= k:
            count += 1

print(count)
# Judge status: Wrong Answer
n=int(input())
count=[[0]*9 for _ in range(9)]
for i in range(1,n+1):
  if i%10>0:
    i=str(i)
    if int(i[::-1])<=n:  
      x,y=int(i[0])-1,int(i[-1])-1
      count[x][y]+=1
ans=0
for i in count:
  for j in i:
    ans+=j**2
print(ans)
# Judge status: Wrong Answer
import re

try:
  s = input()
except:
  print("No")
  
s = s.replace('hii', '')
print(s)
if "hii" in s:
  print("No")
else:
  if "hi" in s:
    print("Yes")
  else: print("No")
# Judge status: Wrong Answer
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

n = int(input())
A = list(map(int, input().split(' ')))
lcm_A = 1
for a in A:
  lcm_A = lcm(lcm_A, a)

B_sum = 0
for a in A:
  B_sum += lcm_A // a
  B_sum %= 100000000 + 7

print(B_sum)
# Judge status: Accepted
N = list('0'+input())
l = len(N)
ans = 0
i = l-1
while i > 0:
    if int(N[i])>=6 or (int(N[i]) == 5 and int(N[i-1])>=5):
        ans+=10-int(N[i])
        i-=1
        while N[i] == '9':
            i-=1
        N[i] = str(int(N[i])+1)
    else:
        ans+=int(N[i])
        i-=1
ans+=int(N[0])
print(ans)
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())
print(h2*60+m2-h1*60-m1-k)
# Judge status: Wrong Answer
A, B, T = map(int, input().split())

print( (T+1//A) * B)
# Judge status: Accepted
def main():
    n, c, k, *t = map(int, open(0).read().split())
    t.sort()
    u = tuple(t)

    cnt = 1
    p, l = 0, u[0] + k
    for v in t:
        if v <= l and p < c:
            p += 1
        else:
            cnt += 1
            p = 1
            l = v + k
    print(cnt)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
from fractions import gcd


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


n = int(input())
t = [int(input()) for _ in range(n)]
ans = t[0]
for i in range(1, n):
    ans = lcm(ans, t[i])
print(int(ans))
# Judge status: Wrong Answer
a = input()
num = len(a)
print('*'*num)
# Judge status: Accepted

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if a == b:
    print('YES')
    exit()
if b - a > 0:
    if (v - w) * t >= b - a:
        print('YES')
        exit()
    else:
        print('NO')
        exit()
else:
    if (v - w) * t >= a - b:
        print('YES')
        exit()
    else:
        print('NO')
        exit()

print('NO')
# Judge status: Wrong Answer
K,A,B = map(int,input().split())
if B-A-2 <= 0:
  print(K+1)
  exit()

if K-1 <= A:
  print(K+1)
  exit()
  
K -= (A-1)
num = K//2
nokori = K%2
#print(K,num,nokori)
ans = A+num*(B-A)+nokori
print(ans)
# Judge status: Wrong Answer
def MinorChange():

    str1 = str(input())
    str2 = str(input())

    data = []

    for num in range(len(str1)):
        if str1[num] != str2[num]:
            data.append(str1[num])

    print(list(set(data)))

if __name__ == '__main__':
    MinorChange()
# Judge status: Accepted
a,b,c=map(int,input().split())
K=int(input())

# B > A
# C > B
import sys
for i in range(K+1):
    A=a
    B=b*(2**i)
    C=c*(2**(K-i))
    #print(i,K-i,A,B,C)
    if B>A and C>B:
        print('Yes')
        sys.exit()
else:
    print('No')
# Judge status: Accepted
N = int(input())
x = N // 100
y = N % 100
if y <= 5 * x:
  print(1)
else:
  print(0)
# Judge status: Accepted
# https://atcoder.jp/contests/abc140/tasks/abc140_d
n, k = map(int, input().split())

s = input()
block = 0
start = 0
seg = []
block = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        block += 1

ans = min(n - 1, block + k * 2)
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
ships = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    ships[a-1].append(b-1)
    ships[b-1].append(a-1)

if set(ships[0]) & set(ships[-1]) == set():
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')
# Judge status: Accepted
from fractions import gcd
n,m=map(int,input().split())
a=list(map(int,input().split()))
wa=[]
for i in range(n):
    p=a[i]
    f=0
    while p%2==0:
        p=p//2
        f+=1
    wa.append(f)
if max(wa)!=min(wa):
    print(0)
    exit()
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // gcd(ans, a[i])
g=ans//2
kai=m//g
kai=-(-kai//2)
print(kai)
# Judge status: Wrong Answer
n = int(input())
H = list(map(int, input().split()))
H = [0] + H
count = 0

for a in range(1, n+1):
    for b in range(1, n+1):
        if a >= b :
            continue
        if abs(a - b) == H[a] + H[b]:
            print(a, b, a-b)
            count+=1
print(count)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))
    result = [abs((T - h * 0.006) - A) for h in H]
    print(result.index(min(result)) + 1)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
A = []
for i in range(N+1):
    if i % 3 != 0 and i % 5 != 0:
        A.append(i)
print(sum(A))
# Judge status: Wrong Answer
l=list(map(int,input().split()))
NN=int(input())
ans=10**30
size=[0.25,0.5,1,2]
for i in range(2**4):
  tmp=[]
  for j in range(4):
    if (i>>j)&1:
      tmp.append(j)
  ans2=0
  N=NN
  while N!=0 and len(tmp)!=0:
    v=tmp.pop(-1)
    S=size[v]
    M=l[v]
    v2=N//S
    N-=v2*S
    ans2+=v2*M
  if N==0:
    ans=min(ans,ans2)
print(int(ans))
# Judge status: Wrong Answer
n, m, x = map(int, input().split())
ce = list(list(map(int, input().split())) for _ in range(n))
cst = []
for i in range(2**n):
    kn = [0 for _ in range(m)]
    for j in range(n):
        if i >> j & 1:
            kn = [kn[k] + ce[j][k] for k in range(m)]
    if all(kn[i] >= x for i in range(1, m)):
        cst.append(kn[0])
print(-1 if cst == [] else min(cst))
# Judge status: Accepted
N="0"+input()
N=N[::-1]
DP=[[0,0]for i in range(len(N))]

DP[0][0]=int(N[0])
DP[0][1]=10-int(N[0])

#print(DP)
#print(N)
for i in range(1,len(N)):
    DP[i][0]=min(DP[i-1][0]+int(N[i]),DP[i-1][1]+int(N[i])+1)
    DP[i][1]=min(DP[i-1][0]+10-int(N[i]),DP[i-1][1]+10-(int(N[i])+1))
#print(DP)
print(min(DP[-1]))
# Judge status: Accepted
def isPalindrome(st): 
    for i in range(0, int(len(st)/2)):  
        if st[i] != st[len(st)-i-1]: 
            return False
    return True
st = input()
if isPalindrome(st):
	n1 = int((len(st) - 1)/2)
	n2 = int((len(st) + 3)/2) - 1
	if isPalindrome(st[0:n1]):
		if isPalindrome(st[n2:]):
			print("Yes")
		else:
			print("No")
	else:
		print("No")
else:
	print("No")
# Judge status: Accepted
h,a=map(int,input().split())

print(-(-h//a))
# Judge status: Accepted
N = int(input())
x = 800 * N
y = 200 * (N//15)
print(x - y)
# Judge status: Accepted
N = int(input())
h = list(map(int, input().split()))

dp_table = [float("inf")]*N # 0~N-1まで
dp_table[0] = 0

for i in range(N-1): # 0~N-1までだが+1して扱う(1~N)
    dp_table[i+1] = min(dp_table[i]+abs(h[i]-h[i+1]), dp_table[i+1])
    if i-1>=0:
        dp_table[i+1] = min(dp_table[i-1]+abs(h[i-1]-h[i+1]), dp_table[i+1])
        
print(dp_table[N-1])
# Judge status: Wrong Answer
N = list(map(int,input().split()))
n = N[0]
k = N[1]

X = list(map(int,input().split()))

#----
#max_val = 0
#max_st = 0
#for i in range(0,n-k):
#  tmp_val = X[i] + X[i+1] + X[i+2]
#  if tmp_val >= max_val :
#    max_st = i
#    max_val = tmp_val

#max_p = (1+X[i])/2 + (1+X[i+1])/2 + (1+X[i+2])/2
#print(max_p)
#---

X.sort()
max_p = 0
for i in range(1,k+1):
  max_p += (1+X[n-i])/2
  
print(max_p)
# Judge status: Accepted
n, m = map(int, input().split())
if n == m:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N, K = map(int,input().split())
P = N % K
if P != 0:
    print(1)
else:
    print(0)
# Judge status: Accepted
N = int(input())
lsa = list(map(int,input().split()))
a = 1
for i in range(N):
    if lsa[i] == a:
        a += 1
if a == 1:
    ans = -1
else:
    ans = N-(a-1)
print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
ans=0
for i in range(n):
    if n>=1:
        n=n/k
        ans+=1
    else:
        print(ans)
        break
# Judge status: Accepted
n = int(input())
ans = 0
for j in range(1, n + 1):
    y = n // j
    ans += y * (y + 1) * j // 2
print(ans)
# Judge status: Wrong Answer
import sys
input=sys.stdin.readline

N,K=(int(x) for x in input().rstrip('\n').split())
L = list(input())
now = L[0]
change = 0
for x in L:
  if x != now:
    change += 1
    now = x
ok = 0
for i in range(K):
  if change == 0:
    ok += 1
    print(N-1)
    break
  elif change==1:
    change -= 1
  else:
    change -= 2
if ok == 0:
  print(N-1-change)
# Judge status: Wrong Answer
N = int(input())
B = list(map(int,input().split()))

A = [B[i] for i in range(N-1)]
A = [B[0]] + A

for i in range(2,N-1):
    if max(A[i],A[i+1]) > B[i]:
        A[i] = B[i]

print(sum(A))
# Judge status: Accepted
n='a'
d={'a':input(),'b':input(),'c':input()}
while True:
    t=d[n]
    if len(t) ==0:
        print(n.upper())
        break
    d[n]=d[n][1:]
    n=t[0]
# Judge status: Accepted
n, k=map(int,input().split())

c=[0]*n

for i in range(k):
    d = int(input())
    a=list(map(int,input().split()))
    for i in range(len(a)):
        c[a[i]-1]+=1

print(c.count(0))
# Judge status: Accepted
import sys

k = int(input())

ans = [0]*(k+1)
ans[0] = 7 % k

if ans[0] == 0:
    print(1)
    
else:
    for i in range(k):
        ans[i+1] = (ans[i]*10 + 7) % k
        
        if ans[i+1] == 0:
            print(i+2)
            sys.exit()
            
    print(-1)
# Judge status: Wrong Answer
from sys import stdin
def I(): return int(stdin.readline().rstrip())
def LI(): return list(map(int,stdin.readline().rstrip().split()))

n = I()
a = LI()

tmp = 1
for i in range(n):
    if pow(10,18)<tmp*a[i]:
        print(-1)
        exit()
    else:
        tmp *= a[i]

print(tmp)
# Judge status: Wrong Answer
x,y=map(int,input().split())
if (2*y-x)%3==0 and(2*x-y)%3==0:
    a=(2*y-x)//3
    b=(2*x-y)//3
    numerator=1
    denominator=1
    for i in range(a):
        numerator=(numerator*(a+b-i))%(10**9+7)
        denominator=(denominator*(a-i))%(10**9+7)
    print((numerator*pow(denominator,10**9+5,10**9+7))%(10**9+7))
else:
    print(0)
# Judge status: Accepted
import math
n,k=map(int,input().split());print(math.ceil((n-1)/(k-1)))
# Judge status: Accepted
import math
n = int(input())
for i in reversed(range(n+1)):
    if round(math.sqrt(i))**2 == i:
        print(i)
        break
# Judge status: Accepted
from sys import stdin
def S(): return stdin.readline().rstrip()

a = S()
strl = ['dream','dreamer','erase','eraser']
t = ''
for i in range(len(a)-1,-1,-1):
    if 7<len(t):
        print('NO')
        exit()
    else:
        t = a[i]+t
        if t in strl:
            t = ''

print('YES')
# Judge status: Accepted
a,b,c=map(int,input().split())
if a==b==c or b!=c and b!=a and c!=a:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
N = int(input())
S = list(input())
num = 0
for i in range(N):
  if S[i - 1] == '#' and S[i] ==".":
    num += 1
print(num)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = input().rstrip()

li = ['0'] * len(s)
for i in range(len(s)):
    li[i] = s[i]

ans = 0
for i in range(1, len(s)):
    if li[i-1] != li[i]:
        continue
    else:
        if li[i] == '1':
            li[i] = '0'
        else:
            li[i] = '1'
        ans += 1
print(ans)
# Judge status: Accepted
D = int(input())
day_dict = {22:"Christmas Eve Eve Eve",
            23:"Christmas Eve Eve",
            24:"Christmas Eve",
            25:"Christmas"}

print(day_dict[D])
# Judge status: Accepted
import math
import string


def readints():
    return list(map(int, input().split()))


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


n, r = map(int, input().split())
print(r+100*(10-n) if n < 10 else r)
# Judge status: Wrong Answer
from sys import stdin
N,M= list(map(int,stdin.readline().strip().split()))
H=[int(x) for x in input().split()]
road=[]
hig=[-1]*N
ans=[]
kari=[]
count=[0]*N
for i in range(M):
    road.append(list(map(int,input().split())))
for i,j in road:
    hig[i-1]=max(i,j)
    hig[j-1]=max(i,j)
if -1 in hig:
    print(len(set(hig))-1)
else:print(len(set(hig)))

#print(len(set(road)))
# Judge status: Accepted
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    S = {s: list(input()) for s in 'abc'}
    x = 'a'
    while S[x]:
        # S[x]のindex0を削除し、削除した要素を取得してxに代入している！
        x = S[x].pop(0)

    print(x.upper())  # 大文字にして出力


resolve()
# Judge status: Wrong Answer
n, k, s = map(int, input().split())
ans = [s + 1] * n
for i in range(k):
    ans[i] = s
for num in ans:
    print(num, end = " ")
print()
# Judge status: Accepted
n,k,s=map(int,input().split())
if s==10**9:
    for i in range(k):
        print(s)
    for i in range(k,n):
        print(1)
else:
    for i in range(k):
        print(s)
    for i in range(k,n):
        print(s+1)
# Judge status: Accepted
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())

    for i in range(1,n+1):
        if i*i>n:
            break
        if n%i==0:
            m=i
            l=n//i

    print(m-1+l-1)
    
if __name__=="__main__":
    main()
# Judge status: Wrong Answer

a, b, c = map(int, input().strip().split())
a_temp = a

for i in range(b):
    if a_temp % b == c:
        print('Yes')
        break
    a_temp += a
else:
    print('No')
# Judge status: Accepted
def is_bad_nums(j: int, d: []) -> bool:
    while j:
        if j % 10 in d:
            return True
        j //= 10
    return False


def answer(n: int, k: int, d: []) -> int:
    for i in range(n, 100000):
        if is_bad_nums(i, d):
            continue
        return i


def main():
    n, k = map(int, input().split())
    d = list(map(int, input().split()))
    print(answer(n, k, d))


if __name__ == '__main__':
    main()
# Judge status: Accepted
a = input()
numbers = a.split()
print("{} {} {}".format(numbers[2], numbers[0], numbers[1]))
# Judge status: Accepted
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    sx, sy, tx, ty = input_int_list()
    dx, dy = tx - sx, ty - sy
    ans = "R" * dx + "U" * dy + "L" * dx + "D" * dy + "L" + "U" * (dy + 1) + "R" * (dx + 1) + "DR" + "D" * (dy + 1) + "L" * (dx + 1) + "U"
    print(ans)
    return


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
from collections import deque

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

t = A - T
if t >= 0:
    print(t, B)
else:
    print(0, B+t)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a+b>=c:print("Yes")
else:print("No")
# Judge status: Wrong Answer
s = str(input())

print('Yes') if (s[0]==s[1] and s[2]==s[3]) or (s[0]==s[2] and s[1]==s[3]) or (s[0]==s[3] and s[1]==s[2]) else print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

count = 1
is_up = False
is_down = False
for i in range(1, n):
    if a[i] < a[i-1] and is_up:
        count += 1
        is_up = False
    elif a[i] > a[i-1] and is_down:
        count += 1
        is_down = False
    elif a[i] < a[i-1]:
        is_down = True
    elif a[i] > a[i-1]:
        is_up = True
print(count)
# Judge status: Wrong Answer
A=int(input())
B=int(input())
C=int(input())
X=int(input())

count = 0
for a in range(min([A,X//500+1])):
  for b in range(min([B,(X-500*a)//100+1])):
#    print(a*500,b*100)
    if (X-500*a-100*b) % 50 == 0 and (X-500*a-100*b) / 50 <= C:
      count = count + 1

print(count)
# Judge status: Wrong Answer
print('Yes' if input() == input()[::-1] else 'No')
# Judge status: Wrong Answer
import re
result_list = []
S = input()
T = list(input())
result = 0
for i in range(len(T)+1):
  for j in range(len(T)):
    if i+j<=len(T):
      temp_word = ''.join(T[j:j+i])
      if temp_word in S:
        result = len(T) - len(temp_word)
print(result)
# Judge status: Accepted
K, N = map(int, input().split())
A = [int(x) for x in input().split()]
B = [A[i] - A[i-1] for i in range(1, N)]
B.append(K - A[-1] + A[0])
ans = sum(B) - max(B)
print(ans)
# Judge status: Accepted
K = int(input())
res = 0
for i in range(1,K+1):
  if i % 2 == 0:
    for j in range(i+1,K+1):
      if j%2 !=0:
        res+=1
  else:
    for j in range(i+1,K+1):
      if j%2 ==0:
        res+=1
        
print(res)
# Judge status: Accepted
C = [input() for i in range(2)]

if C[0][0] == C[1][2] and C[0][1] == C[1][1] and C[0][2] == C[1][0] and C[1][0] == C[0][2] and C[1][1] == C[0][1] and C[1][2] == C[0][0]:
    print("YES")
else:
    print("NO")