peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x, y = map(int, input().split())
ans = 0

while x <= y:
    x *= 2
    ans += 1

print(ans)
# Judge status: Wrong Answer
s = input()
ans = 0

if 'RRR' in s:
  ans == 3
elif 'RR' in s:
  ans = 2
elif 'R' in s:
  ans = 1
else:
  ans = 0

print(str(ans))
# Judge status: Wrong Answer
a, b = map(int, input().split())

ans = 0
for i in range(a, b+1):
    s = str(i)
    sl = len(s) // 2
    if s[:sl] == s[sl+1:]: ans += 1
print(ans)
# Judge status: Accepted
S = input()[::-1]
T = input()[::-1]

flag = False
for i in range(len(S) - len(T) + 1):
    matched = True

    for j in range(len(T)):

        if S[i + j] != "?" and S[i + j] != T[j]:
            matched = False
            break
    
    if matched:
        S = S[:i] + T + S[i + len(T):]
        flag = True
        break

if flag:
    print(S.replace("?", "a")[::-1])
else:
    print("UNRESTORABLE")
# Judge status: Wrong Answer
N = int(input('整数を入力してね>'))
X = int(800 * N)
Y = int(int(N/15)*200)
print(X - Y)
# Judge status: Accepted
N, M = map(int, input().split())

l = list()

for a in range(0, N):
    L = list(map(int, input().split()))
    L.pop(0)
    l.append(L)

count = [0]*(M)

for a in l:
    for b in a:
        count[b-1] += 1

print(len(list(filter(lambda x: x == N, count))))
# Judge status: Wrong Answer
N, K = map(int,input().split())
if N >= K :
    print(N % K)
else :
    print(1)
# Judge status: Accepted
#!/usr/bin/env python3
def main():
    N, K = map(int, input().split())
    H = [int(x) for x in input().split()] + [0] * 200

    INF = 10 ** 10
    dp = [INF] * 10 ** 6
    dp[0] = 0
    for i in range(N):
        for k in range(1, K + 1):
            dp[i + k] = min(dp[i + k], dp[i] + abs(H[i] - H[i + k]))
    print(dp[N - 1])


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, M = map(int, input().split(" "))
ans = [-1 for i in range(N)]
is_conflict = False

for i in range(M):
    s, c = map(int, input().split(" "))
    if ans[s - 1] == -1:
        ans[s - 1] = c
    else:
        is_conflict |= (ans[s - 1] != c)

for i in range(N):
    if i == 0 and ans[i] == -1:
        ans[i] = 1
    elif ans[i] == -1:
        ans[i] = 0

if len(str(int(''.join([str(a) for a in ans])))) != N or is_conflict:
    print(-1)
else:
    print(''.join([str(a) for a in ans]))
# Judge status: Accepted
n,m = (int(x) for x in input().split())
if n%2 != m%2:
  print('IMPOSSIBLE')
else:
  print(int((n+m)/2))
# Judge status: Accepted
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    count_negative = 0
    for i in range(n):
        if a[i] < 0:
            count_negative += 1
    a = [abs(x) for x in a]
    answer = sum(a)
    if count_negative % 2:
        answer -= 2 * min(a)
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
n = input()
a = [int(i) for i in input().split()]
ans = 1
if 0 in a:
  print("0")
  sys.exit()  

for aa in a:
  ans = ans * aa
  if ans > 10**18:
    print("-1")
    sys.exit()
print(ans)
# Judge status: Accepted
N, X, Y = map(int, input().split())
count = [0] * N
a = 0
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        a = min(j - i, abs(X - i) + abs(Y - j) + 1)
        count[a] += 1

for i in range(1, N):
    print(count[i])
# Judge status: Wrong Answer
N, M, K = map(int, input().split())

black = 0
for n in range(N+1):
    black += M*n
    for m in range(M+1):
        black -= n*m
        black += (N-n)*m
        if black==K:
            print('Yes')
            exit()

print('No')
# Judge status: Accepted
kn = input().split()
a = input().split()

al = [int(i) for i in a]
k = int(kn[0])
n = kn[1]

ml = k - abs(al[len(al)-1] - al[0])


for i in range(len(al)-1):
	ml = max(ml,abs(al[i]-(al[i+1])))


print(k-ml)
# Judge status: Accepted
from math import gcd

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

if N == 1:
  print(abs(X-x[0]))
  exit()

diff = [abs(X-x[i]) for i in range(N)]

for i in range(1,N):
  if i == 1:
    total_gcd = gcd(diff[i],diff[i-1])
  else:
    total_gcd = gcd(diff[i],total_gcd)
    
print(total_gcd)
# Judge status: Wrong Answer
N,M=map(int,input().split())
s=[list(map(int,input().split())) for i in range(M)]


t=[i+1 for i in range(N)]

for j in range(M):
  for k in range(len(t)):
    if s[j][0]>t[k]:
      t[k]=0
    if s[j][1]<t[k]:
      t[k]=0
t=set(t)
print(len(t)-1)
# Judge status: Accepted
n, m = map(int, input().split())
list_score = [ list(map(int,input().split(" "))) for i in range(m)]

left = 1
right = n
for i in range(m):
    k = list_score[i]
    if left < k[0]:
        left = k[0]
    if right > k[1]:
        right = k[1]

if left > right:
    print(0)
else:
    print(right-left+1)
# Judge status: Accepted
N,T=map(int,input().split())
l=[list(map(int,input().split())) for i in range(N)]
c=[i[0] for i in l if i[1]<=T]
print(min(c) if c else "TLE")
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
s = list(input())
ans = []
alpha = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

for i in s:
    ans.append(alpha[(alpha.index(i)+n)%26])
print(''.join(ans))
# Judge status: Accepted
n, k = (int(i) for i in input().split())
flag = True

n = n % k
ans = n

if(ans > abs(n-k)):
    ans = abs(n-k)

print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
a1, a2 = sorted(A)[::-1][:2]
for a in A:
    if a != a1:
        print(a1)
    else:
        print(a2)
# Judge status: Wrong Answer
x,n=map(int,input().split())
p=list(map(int,input().split()))
q=list(range(-1,101))
for i in range(n):
    q.remove(p[i])
ans=0
for i in q:
    if abs(x-i)==abs(x-ans):
        ans=min(i,ans)
    elif abs(x-i)<abs(x-ans):
        ans=i
print(ans)
# Judge status: Accepted

s=list(input())

for i in range(len(s)):
    if s[i]=='?':
        s[i]='D'

L=[str(a) for a in s]
L="".join(L)
print(L)
# Judge status: Wrong Answer
import math
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T  = input()
G =  []
for i in range(K):
  G.append([])
for i in range(len(T)):
  G[i % K].append(T[i])
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
sl=sorted(l)
if sl[-1]<sum(sl[:-1]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
H, W = map(int, input().split())

if H > 1 and W > 1:
    if H % 2 == 0:
        result = W * (H // 2)
    else:
        if W % 2 == 0:
            result = W * (H // 2) + (W // 2)
        else:
            result = W * (H // 2) + (W // 2) + 1
else:
    result = 1

print(result)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
q=int(input())
dic={}
for i in range(len(a)):
    dic.setdefault(a[i],1)
    dic[a[i]]+=1
answer=sum(a)
for i in range(q):
    b,c=map(int,input().split())
    dic.setdefault(b,0)
    dic.setdefault(c,0)
    dic[c]+=dic[b]
    answer=answer+dic[b]*c-dic[b]*b
    dic[b] = 0
    print(answer)
# Judge status: Accepted
a,b,c = map(int, input().split())
print('YES' if (a+c)/2 == b else 'NO')
# Judge status: Wrong Answer
import math

def gcd(A,B,C):
    output = 1
    maxi = max(A,B,C)
    maximum = math.sqrt(maxi)
    maxim = round(maximum)+1
    for i in range(maxim,1,-1):
        if ((A%i == 0) and (B%i == 0) and (C%i == 0)):
            output = i
            break
    return output

K = int(input())
sum = 0
for A in range(1,K+1):
    for B in range(1,K+1):
        for C in range(1,K+1):
            sum = sum + gcd(A,B,C)
print(sum)
# Judge status: Accepted
import re
S = input()
ACGT = re.findall('[ACGT]+',S)
if len(ACGT) > 0:
    print(max([len(s) for s in ACGT]))
else:
    print(0)
# Judge status: Accepted
n=int(input())
luc=[0]*87
luc[0]=2
luc[1]=1
for i in range(2,87):
    luc[i]=luc[i-1]+luc[i-2]
print(luc[n])
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
cnt = Counter(a)
ans = 0
for i in cnt.items():
    dif = i[1] - i[0]
    delete = i[1]
    ans += min(dif ,delete)
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
m=min(a,b,c)
M=max(a,b,c)
n=a+b+c-m-M
print(M*10+n+m)
# Judge status: Accepted
n=int(input())
a=input()
L=[]
for i in range(26):
    L.append(chr(65+i))
news=''
for i in range(len(a)):
  news+=L[L.index(a[i])+n-26]
print(news)
# Judge status: Accepted
print(['Christmas Eve Eve Eve','Christmas Eve Eve','Christmas Eve','Christmas'][int(input())-22])
# Judge status: Accepted
N, M = map(int, input().split())
liners = {}

for i in range(M):
    a, b = map(int, input().split())
    liners.setdefault(a, [])
    liners[a].append(b)

ans = "IMPOSSIBLE"

for i in liners[1]:
    if i in liners and N in liners[i]:
        ans = "POSSIBLE"
        break

print(ans)
# Judge status: Wrong Answer
K,N=map(int,input().split())
cnt=0
def souatari(K,N):
    ans=0
    if 2*K<N:
        return 0
    elif 2*K>=N and K<N:
        return 2*K-N+1
    elif K>=N:
        return N+1

for i in range(K+1):
    cnt+=souatari(K,N-i)

print(cnt)
1,9
2,8
3,7
4,6
5,5

2,9
3,8
4,7
5,6

0,10
1,9
2,8
3,7
4,6
5,5
# Judge status: Wrong Answer
data = [int(i) for i in input().split()]

count = 0
for i in range(len(data)):
  for j in range(i+1, len(data)):
    if (data[i] == data[j]):
      count += 1
    else:
      continue
print(count)
# Judge status: Accepted
import sys

stdin = sys.stdin

mod = 1000000007
inf = 1 << 60

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n = ni()
w = na()

ans = inf
s = sum(w)
p = 0
for i in range(n):
	p += w[i]
	ans = min(ans, abs(s - p - p))

print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-

s, w = map(int, input().split(' '))

if s > w:
    print('safe')
else:
    print('unsafe')
# Judge status: Wrong Answer
X = int(input())
def hoge(X):
    if ((X%100)%5) + 1 <= X//100:
        return 1
    else:
        return 0
print(hoge(X))
# Judge status: Accepted
import math

N = int(input())

print(math.factorial(N)%(10**9+7))
# Judge status: Accepted
n=int(input())
csf=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n-1):
    ans=0
    for j in range(i,n-1):
        c = csf[j][0]
        s = csf[j][1]
        f = csf[j][2]
        if j==i:
            ans+=s+c
        else:
            if ans<s:
                ans=s+c
            else:
                ans+=(f-(ans-s)%f)%f+c
    print(ans)
print(0)
# Judge status: Wrong Answer
n = int(input())
s = input()

ans = []
x = 0

for i in range(n):
  if s[i] == "I":
    x +=1
    ans.append(x)
    
  elif s[i] == "D":
    x -=1
    ans.append(x)
    
ans.sort(reverse=True)

print(ans[0])
# Judge status: Accepted
from collections import Counter as CC
N = int(input())
a = list(map(int, input().split()))
b = CC(a)
X1, X2, X3 = 0, b[min(b)], b[min(b)+1]
count = X1 + X2 + X3
ans = count
for i in range(min(b) + 2, max(b) + 1):
  count -= X1
  X1, X2, X3 = X2, X3, b[i]
  count += X3
  ans = max(ans, count)
else:
  print(ans)
# Judge status: Wrong Answer
def main():
    n = int(input())
    word_lst = [""] * n
    previous_word = input()
    ok = True
    for i in range(1,n):
        now_word = input()
        if not (now_word[0] == previous_word[-1]):
            ok = False
            break
        previous_word = now_word

    print("Yes" if ok else "No")






if __name__ == '__main__':
    main()
# Judge status: Accepted
n, m = map(int,input().split())
students = [None]*n
points = [None]*m
for i in range(n):
  students[i] = tuple(map(int,input().split()))
for i in range(m):
  points[i] = tuple(map(int,input().split()))

ans = []
for s in students:
  tmp = []
  for p in points:
    tmp.append(abs(s[0] - p[0]) + abs(s[1] - p[1]))
  ans.append(tmp.index(min(tmp)) + 1)
for i in range(n):
  print(ans[i])
# Judge status: Accepted
a,b,c= map(int,input().split())
 
if b//a >= c:
    print(c)
else:
    print(b//a)
# Judge status: Accepted
n,m = map(int,input().split())
min = 1
max = n

for i in range(m):
    l,r = map(int,input().split()) 
    if min<l: min=l
    if max>r: max=r 

if min>max:
    print(0)
else:
    print(max-min+1)
# Judge status: Accepted
input()
a = list(map(int, input().split()))
dp = [float('inf')]*len(a)
dp[0] = 0
for i in range(len(a)-1):
    dp[i+1] = min(dp[i+1], dp[i] + abs(a[i+1] - a[i]))
    if i < len(a)-2:
        dp[i+2] = dp[i] + abs(a[i+2] - a[i])
print(dp[-1])
# Judge status: Wrong Answer
import math
n, a, b = map(int,input().split())
try:
    ans = math.ceil(n / (a + b) * a)
except Exception as e:
    ans = 0
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
f = [False]*N
l = 0
r = N+1
for i in range(M):
    l += 1
    r -= 1
    while True:
        if N % 2 == 0:
            if r-l == N//2:
                r -= 1
                continue
        if f[min(r-l, N-(r-l))]:
            r -= 1
            continue
        break
            
    f[min(r-l, N-(r-l))] = True
    print(l, r)
# Judge status: Accepted
N=int(input())
c=input()
count=0

if 'WR' in c:
    x=c.count('R')
    y=c.count('R',0,x)
    count=x-y
print(count)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sb = sum(b)

for i in range(n):
    for j in range(i, i+2):
        t = a[j] - b[i]
        if t >= 0:
            a[j] = t
            b[i] = 0
        else:
            a[j] = 0
            b[i] = abs(t)

print(sb if sb - sum(b) == 0 else sb - sum(b))
# Judge status: Wrong Answer
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = []
for i in range(N):
	b.append(int(input()))
	
yoko = A
tate = [[], [], []]
for row in A:
	for i in range(3):
		tate[i].append(row[i])
naname = [[A[0][0], A[1][1], A[2][2]]]

all = yoko + tate + naname


chk = 0
for kumi in all:
	for i in range(3):
		if kumi[0] in b:
			chk += 1
	if chk == 3:
		print("Yes")
		break

if chk != 3:
	print("No")
# Judge status: Wrong Answer
A, B, K = map(int, input().split())

A_after = 0
B_after = 0

if A - K >= 0:
  A_after = A - K

elif A + B - K >= 0:
  B_after = B - (K - A)
  
print(A_after, B_after)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
co,coo=0,0
while a>0:
    a=a-d
    co+=1
while c>0:
    c-=b
    coo+=1
print("No" if coo>co else "Yes")
# Judge status: Wrong Answer
n,k=map(int,input().split())
print(k+100*(10-k) if n<10 else k)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))

    A_sum = sum(A)
    tmp = 0

    result = []

    for a in A:
        tmp += a
        result.append(abs(A_sum - tmp * 2))
    print(min(result[:-1]))


if __name__ == "__main__":
    main()
# Judge status: Accepted
def resolve():
    X,Y=map(int,input().split())
    cnt=0
    while X<=Y:
        X=X*2
        cnt+=1
    print(cnt)

resolve()
# Judge status: Accepted
def f():
    s = input()
    for i in range(len(s)):
        if i%2 == 1:
            if s[i] == "L" or s[i] == "U" or s[i] == "D":
                continue
            else:
                return "No"
        else:
            if s[i] == "R" or s[i] == "U" or s[i] == "D":
                continue
            else:
                return "No"
    return "Yes"
print(f())
# Judge status: Accepted
n = int(input())
g = map(int, input().split())
a = [v-(i+1) for i,v in enumerate(g)]
a.sort()
b = a[len(a)//2]
print(sum(map(lambda x:abs(x-b), a)))
# Judge status: Wrong Answer
l = [int(input()) for _ in [0] * 6]
#print(l)
k=l.pop()
#print(l)
#print(k)
for i in range(5):
    for j in range(5):
        if abs(l[j] - l[i]) > k:
            print(':(')
            break
    break
else:
    print('Yay!')
# Judge status: Wrong Answer
N,B,R = input().split()
N = int(N)
B = int(B)
R = int(R)
X = B + R
Z = N // X
Y = N % X
if B == 0:
    print(0)
elif  X == N:
    print(B)
elif X < N:
    if Y < B:
        print(B*Z + Y)
    elif Y == B:
        print(B*Z + B)
    elif Y > B:
        print(B*Z + B)
# Judge status: Accepted
def resolve():
	n, k = map(int, input().split())
	x = list(map(int, input().split()))
	ans = float('inf')
	for i in range(n-(k-1)):
		if abs(x[i] - x[i+(k-1)]) == (abs(x[i]) + abs(x[i+(k-1)])):
			v = abs(x[i] - x[i + (k - 1)]) + min(abs(x[i]), abs(x[i + (k - 1)]))
			ans = min(ans, v)
		else:
			v = max(abs(x[i]), abs(x[i + (k - 1)]))
			ans = min(ans, v)
	print(ans)
resolve()
# Judge status: Accepted
import sys
input = sys.stdin.readline
N = int(input())
SR = []
for i in range(1,N+1):
    s, r = input().split()
    SR.append((s,-int(r),i))

SR.sort(key=lambda x: (x[0],x[1]))
for ans in SR:
    print(ans[2])
# Judge status: Wrong Answer
n = int(input())
a = int(input())

if n%500 <= a:
    print('Yse')
else:
    print('No')
# Judge status: Accepted
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, m = Input()
    max_l = 0
    min_r = 1e6
    for i in range(m):
        l, r = Input()
        max_l = max(max_l, l)
        min_r = min(min_r, r)

    ans = min_r - max_l + 1
    ans = max(ans, 0)
    print(ans)

main()
# Judge status: Wrong Answer
X,Y,Z = map(int, input().split())
print(X // (Y+Z))
# Judge status: Accepted
import sys
N = int(input())
d = [list(map(int,input().split())) for l in range(N)]
d.insert(0,[0,0,0])
#print(N)
#print(d)

def get_length(l1,l2):
    return abs(l1[1] - l2[1]) + abs(l1[2] - l2[2])

for cnt in range(N):
    length = get_length(d[cnt],d[cnt+1])
    time = abs(d[cnt][0]-d[cnt+1][0])
    if length <= time and abs(time - length) % 2 == 0:
        pass
    else:
        print("No")
        sys.exit(0)

print("Yes")
# Judge status: Accepted
N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

sum1 = 0
sum2 = 0
for i in range(N):
    if a[i] > b[i]:
        sum1 += a[i] - b[i]
    else:
        sum2 += (b[i] - a[i])//2
if sum1 <= sum2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
N = len(S)
A = [int(S[i]) for i in range(N)]
A = A[::-1]

MOD = 2019

p10 = [1] * N
for i in range(1, N):
	p10[i] = (p10[i - 1] * 10) % MOD

for i in range(N):
	A[i] = (A[i] * p10[i]) % MOD

cumsum = [A[0]] * N
for i in range(1, N):
	cumsum[i] = (cumsum[i - 1] + A[i]) % MOD

cnt = [0] * MOD
cnt[0] = 1
for i in range(N):
	cnt[cumsum[i]] += 1

ans = 0
for i in range(MOD):
	ans += cnt[i] * (cnt[i] - 1) // 2

print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
A=[[""]*N for i in range(N)]
B=[[""]*M for i in range(M)]
for y in range(N):
  A[y]=list(input())
for y in range(M):
  B[y]=list(input())
exist=False
for ly in range(N):
  for lx in range(N):
    if ly+M-1>=N or lx+M-1>=N:
      continue
    match=True
    for y in range(M):
      for x in range(M):
        if A[ly+y][lx+x]!=B[y][x]:
          match=False
    if match==True:
      exist=True
print("Yes" if exist==True else "No")
# Judge status: Accepted
a, b, c, x = map(int, [input() for i in range(4)])
cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                cnt += 1
print(cnt)
# Judge status: Accepted
import math
S=[int(input()) for i in range(6)]
ans=math.ceil(S[0]/min(S[1:]))+4
print (ans)
# Judge status: Accepted
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
asum = [0]*(n+1)
bsum = [0]*(m+1)
for i in range(n):
	asum[i+1] = a[i] + asum[i]
for j in range(m): 
	bsum[j+1] = b[j] + bsum[j]
j = m
res = 0
for i in range(n+1):
	if asum[i] > k:
		break
	while asum[i] + bsum[j] > k:
		j-=1
	res = max(res,i+j)
print(res)
# Judge status: Accepted
n=int(input())
a=[]
ans=0
for _ in range(n):
  x,y=map(int,input().split())
  for i,j in a:
    ans+=((i-x)**2+(j-y)**2)**.5
  a.append((x,y))
print(ans*2/n)
# Judge status: Accepted
n,k=map(int,input().split())

ret=0
for i in range(1,n+1):
    tmp=1/n
    now=i
    while now<k:
        now*=2
        tmp/=2
    ret+=tmp

print(ret)
# Judge status: Accepted
S = str(input())
vertical,side = ['N', 'S'], ['W', 'E']

ans1,ans2 = 0,0

for l in vertical:
  if l in S:
    ans1 += 1
for l in side:
  if l in S:
    ans2 += 1
if ans1 >= 2 and ans2 >= 2:
  print('Yes')
elif ans1 >= 2 and ans2 == 0:
  print('Yes')
elif ans1 == 0 and ans2 >= 2:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import bisect

x = int(input())

s = {1}
for a in range(2, 1000):
    for b in range(2, 11):
        c = a ** b
        if c > 1000:
            break
        s.add(c)
s = sorted(s, reverse=True)
for a in s:
    if a <= x:
        print(a)
        exit(0)
# Judge status: Accepted
def resolve():
    a,b,c=map(int, input().split())
    print(min(c,b//a))
resolve()
# Judge status: Accepted
x = list(input().split())

for i in range(len(x)):
    if x[i] == '0':
        print(i+1)
# Judge status: Accepted
sx,sy,tx,ty=map(int,input().split())

s='U'*(ty-sy)
s+='R'*(tx-sx)
s+='D'*(ty-sy)
s+='L'*(tx-sx+1)
s+='U'*(ty-sy+1)
s+='R'*(tx-sx+1)
s+='DR'
s+='D'*(ty-sy+1)
s+='L'*(tx-sx+1)
s+='U'

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

def ROTN(tmp, n):
    tmp = ord(tmp) + n
    if tmp > 0x5a:
        tmp -= 26
    return chr(tmp)


ans = []
for i in range(len(s)):
    tmp = s[i]
    ans.append(ROTN(tmp, n))

for i in range(len(ans)):
    print(ans[i], end="")
# Judge status: Accepted

T = [int(_) for _ in input().split()]

x = sorted(T)
if x[0] == 5 and x[1] == 5 and x[2] == 7:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import sys
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()

def main():
    S = list(input())
    T = list(input())

    memo = defaultdict(lambda: defaultdict(str))

    for s, t in zip(S, T):
        for key, (a, b) in {'s': (s, t), 't': (t, s)}.items():
            if memo[key][a] and memo[key][a] != b:
                print('No')
                exit()
            else:
                memo[key][a] = b
    print('Yes')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
N, Y = map(int, input().split())

if 10000 * N < Y:
    print(-1, -1, -1)

for x in range(N, -1, -1):
    for y in range(N-x, -1, -1):
        for z in range(N-x-y, -1, -1):
            if (10000*x)+(5000*y)+(1000*z) == Y:
                print(x, y, x)
                sys.exit()
            
print(-1, -1, -1)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
import math

N = int(input())
# print(N)
ai = input().split(' ')
# print(ai)
num = 0
for i in range(math.floor(N/2)):
    if int(ai[i]) % 2 == 1:
        num += 1

print(num)
# Judge status: Accepted
n,w=map(int,input().split())
P=[]
for _ in range(n):
  iw,iv=map(int,input().split())
  P.append([iw,iv])
INF=float('inf')

dp=[[0 for i in range(w+1)] for j in range(n+1)]

for i in range(1,n+1):
  for j in range(1,w+1):
    if j-P[i-1][0]>=0:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-P[i-1][0]]+P[i-1][1])
    else:
      dp[i][j]=dp[i-1][j]
print(dp[n][w])
# Judge status: Accepted
x,y = map(int,input().split())
count = 0
while x <= y:
  x = 2*x
  count += 1
print(count)
# Judge status: Accepted
a=int(input())
b=list(map(int,input().split()))
dp=[0]
dp.append(abs(b[0]-b[1]))
for i in range(2,len(b)):
    h1=abs(b[i]-b[i-1])+dp[i-1]
    h2=abs(b[i-2]-b[i])+dp[i-2]
    dp.append(min(h1,h2))
print(dp[a-1])
# Judge status: Accepted
A, B, T = map(int, input().split())
print(B*int((T+0.5)/A))
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))

l.sort()
ans = (l[0]+l[1])/2

for i in range(2,n):
    ans = (ans+l[i])/2

print(ans)
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]

res = 0
n = 0
for a in A:
    if a == 0:
        res += n // 2
        n = 0
    n += a

res += n // 2

print(res)
# Judge status: Accepted
N=int(input())
c=[0]*100002
a=list(map(int,input().split()))
for i in a:
    c[i]+=1
    if(i-1>=0):
        c[i-1]+=1
    c[i+1]+=1
print(max(c))
# Judge status: Accepted
n = int(input())
a = map(int, input().split())
b = map(int, input().split())

d = 0
c = 0
for x, y in zip(a, b):
  if x < y:
    d += (y - x) // 2
  else:
    c += x - y

print('Yes' if d >= c else 'No')