Harryxun/stf_run huggingface dataset:
S = input()
2 print('Heisei' if S <= '2019/04/30' else 'TBD')


### FIXED CODE ###

S = input()
print('Heisei' if S <= '2019/04/30' else 'TBD')
x = input().split()
if x[1] == '+':
    y = int(x[0])+int(x[2])
    print(y)
elif x[1] == '-':
    y = int(x[0])-int(x[2])
    print(y)
elif x[1] == '*':
    y = int(x[0])*int(x[2])
    print(y)
elif x[1] == '/':
    y = int(x[0])//int(x[2])
    print(y)
elif x[1] == '?':

### FIXED CODE ###

while True:
    x = input().split()
    if x[1] == '+':
        y = int(x[0])+int(x[2])
        print(y)
    elif x[1] == '-':
        y = int(x[0])-int(x[2])
        print(y)
    elif x[1] == '*':
        y = int(x[0])*int(x[2])
        print(y)
    elif x[1] == '/':
        y = int(x[0])//int(x[2])
        print(y)
    elif x[1] == '?':
        break
import math
N = int(input())
flag = 0
while flag == 0:
  lst = []
  for i in range(1, math.ceil(N**0.5)):
    if N%i == 0:
      if i**2 = N:
        lst.append(i)
      else:
        lst.append(i)
        lst.append(N//i)
  if len(lst) == 2:
    flag = 1
  else:
    N += 1
print(N)

### FIXED CODE ###

import math
N = int(input())
flag = 0
while flag == 0:
  lst = []
  for i in range(1, math.ceil(N**0.5)):
    if N%i == 0:
      if i**2 == N:
        lst.append(i)
      else:
        lst.append(i)
        lst.append(N//i)
  if len(lst) == 2:
    flag = 1
  else:
    N += 1
print(N)
from collections import deque
H, W = map(int, input().split())
 
route = []
for _ in range(H):
  route.append(input())
  
wall = set()
start = []
for y, r in enumerate(route):
  for x, w in enumerate(r):
    if w == '#':
      wall.add((x, y))
    else:
      start.append((x, y))

score = -1
ssize = [(-1,0),(0,-1),(1,0),(0,1)]
for xy in start:
  d = deque()
  d.append((xy[0],xy[1],0))
  step = 0
  already = set() | wall
  while len(d) > 0:
    now = d.popleft()
    already.add(now[:-1])
    step = now[2]+1
    for xs, ys in ssize:
      x,y = now[0]+xs, now[1]+ys
      if (x, y) not in already and 0 =< x < W and 0 =< y < H:
        d.append((x, y, step))
  score = max(step-1, score)
  
print(score)

### FIXED CODE ###

from collections import deque
import copy
H, W = map(int, input().split())
 
route = []
for _ in range(H):
  route.append(input())
  
wall = set()
start = set()
for y, r in enumerate(route):
  for x, w in enumerate(r):
    if w == '.':
      start.add((x, y))

score = -1
ssize = [(-1,0),(0,-1),(1,0),(0,1)]
for xy in start:
  d = deque()
  d.append((xy+(0,)))
  step = 0
  can = copy.deepcopy(start)
  can.remove(xy)
  while len(d) > 0:
    now = d.popleft()
    step = now[2]
    for xs, ys in ssize:
      nxt = (now[0]+xs, now[1]+ys)
      if nxt in can:
        d.append(nxt+(step+1,))
        can.remove(nxt)
  score = max(step, score)
  
print(score)
from bisect import insort_left

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

  if M < N: 
    ans = sum(A[:N-M])
    A = A[N-M:]
  else: ans = 0

  if not len(A)-1: A[0] //= 2 ** M
  else:
    while M:
        a = A.pop(N-1)

        while a >= A[-1] and M:
            a //= 2
            M -= 1

        insort_left(A, a)

  print(ans + sum(A))

if __name__ == '__main__':
  main()

### FIXED CODE ###

from heapq import heappush, heappop, heapify

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

  if N == 1: A[0] = A[0] // 2 ** M
  else:
    for i in range(N): A[i] *= -1

    heapify(A)

    for i in range(M):
      a = heappop(A)
      heappush(A, -(-a//2))

  print(-sum(A))  
  
if __name__ == '__main__':
  main()
s = input()
n = len(s)
count = 0
halfn = int((n-1) / 2)
whalfn = int((n-1) / 4)
half = s[0:halfn]

if len(half) % 2 == 0:
  for i in range(len(half)+1):
    if half[i] != half[-i-1]:
      count += 1
      break
    else:
      pass
else:
  for i in range(len(half)):
    if half[i] != half[-i-1]:
      count += 1
      break
    else:
      pass
  
if count == 0:
  print('Yes')
else:
  print('No')
  

### FIXED CODE ###

s = input()
n = len(s)
count = 0
halfn = int((n-1) / 2)
whalfn = int((n-1) / 4)
half = s[0:halfn]

for i in range(len(s)):
    if s[i] != s[-i-1]:
      count += 1
      break
    else:
      pass

for i in range(len(half)):
  if half[i] != half[-i-1]:
    count += 1
    break
  else:
    pass

if count == 0:
  print('Yes')
else:
  print('No')
N, Z, W = map(int, input().split())
a = list(map(int, input().split()))

if N == 1:
    print(a[0] - W)
else:
    x = abs(a[-2] - a[-1])
    y = abs(a[-1] - W)
    z = min(abs(max(A) - A[-1]), abs(a[-2]-a[-1]))
    w = min(abs(min(A) - A[-1]), abs(a[-2]-a[-1]))
    
    ans = max(x, y)
    print(ans)


### FIXED CODE ###

N, Z, W = map(int, input().split())
a = list(map(int, input().split()))

if N == 1:
    print(abs(a[0] - W))
else:
    x = abs(a[-2] - a[-1])
    y = abs(a[-1] - W)
    
    ans = max(x, y)
    print(ans)
# -*- coding: utf-8 -*-
"""
Created on Tue Jul  9 23:16:22 2019

@author: gtoky
"""

a = int(input())
b = int(input())


if (a * b) % 2 == 0:
    print("Even")
else:
    print("Odd")
    

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Tue Jul  9 23:16:22 2019

@author: gtoky
"""

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
A = map(int, input().split(','))

N = int(input())
A = [int(i) for i in input().split(',')]

is_all_even = True
counter = 0
while True:
    for i in range(len(A)):
        if A[i] % 2 == 0:
            A[i] = int(A[i] // 2)
        else:
            is_all_even = False
    if is_all_even:
        counter += 1
    else:
        break
print(counter)


### FIXED CODE ###

i = input()
print(int(i[0] == '1') + int(i[1] == '1') + int(i[2] == '1'))
import fractions
from functools import reduce


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


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


A, B, C, D = map(int, input().split())
ans_b = B - (B // C) - (B // D) + (B // lcm_base(C, D))
ans_a = (A - 1) - ((A - 1) // C) - ((A - 1) // D) + ((A - 1) // lcm_(A - 1)ase(C, D))
print(ans_b - ans_a)


### FIXED CODE ###

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


def start(num: int) -> int:
    if A % num == 0:
        num_start = A + (A % num)
    else:
        num_start = A + (num - A % num)
    return num_start


def count_in_range(num_start: int, num: int) -> int:
    r = B - num_start
    return r // num + 1


def calc(num: int) -> int:
    return count_in_range(start(num), num)


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


c = calc
print((B - A + 1) - (calc(C) + calc(D) - calc(lcm(C, D))))
(a+b)*h/2

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2)
import math as m
n = int(input())
numbers = map(int,input().split())
order = []

for i in range(6):
  if numbers[i] == 0:
    a = 0
  else:
    a = m.floor(m.log(numbers[i],2))
  order.append(a)
print(min(order))

  

### FIXED CODE ###

N = int(input())
numbers =map(int,input().split())
ans = 10000
for i in numbers:
  count = 0
  while i % 2 == 0:
    i /= 2
    count += 1
  ans = min(ans,count)

print(ans)
S = input()
T = input()

if S.length == 0 || S.length >= 11:
    print("No" )
else:
    for i in range(S.length):
        if S[i] !=  T[i]:
            return print("No")
        
    if T.length == S.length + 1:
        print("Yes" )
  


### FIXED CODE ###

S = input()
T = input()

print("Yes" if S == T[:-1] else "No" )
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

L = []
for line in stdin:
    n = int(line)
    if not n:
        print(L.pop())
    else:
        L.append(n)

### FIXED CODE ###

from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

L = []
for line in stdin:
    if not line.strip():
        continue
    n = int(line)
    if not n:
        print(L.pop())
    else:
        L.append(n)
S= input()

if S.count('RRR') == 1:
    print(3)
elif S.count('RR') == 1:
    print(2)
elif S.count('RSR') == 1 or S.count('RSS') == 1 or S.count('SRS') == 1 or S.count('SSR') == 1
    print(1)
else:
    print(0)


### FIXED CODE ###

S= input()

if S.count('RRR') == 1:
    print(3)
elif S.count('RR') == 1:
    print(2)
elif S.count('RSR') == 1 or S.count('RSS') == 1 or S.count('SRS') == 1 or S.count('SSR') == 1:
    print(1)
else:
    print(0)
N = int(input())
P = list(map(int, input().split()))

ntk = 0
l = []
for i in P:
	l.append(i)
	if i = min(l):
		cnt += 1
print(cnt)

### FIXED CODE ###

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

cnt = 0
mi = P[0]
for i in range(N):
	if P[i] <= mi:
		mi = P[i]
		cnt += 1
print(cnt)
import math

a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1,a2,a3]

m = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
b = []
for i in range(n) :
    b = int(input())
    for j in range(3) :
        for k in range(3) :
            if a[j][k] == b :
                m[j][k] = 1


### FIXED CODE ###

import math
n = int(input())
print (math.ceil(n/2))
N, X = map(int, input().split())
pat = [0 for _ in range(N+1)]
mai = [0 for _ in range(N+1)]
pat[1] = 1
mai[1] = 1
for i in range(2, N+1):
  mai[i] = 2 * mai[i-1] + 3
  pat[i] = 2 * pat[i-1] + 1

def cnt_pat(x, n):
  if n == 1:
    return 1
  if x == 1:
    return 0
  if x <= mai[n] // 2:
    return cnt_pat(x-1, n-1)
  if x == mai[n] // 2 + 1:
    return pat[n-1] + 1
  if x < mai[n]:
    return pat[n-1] + 1 + cnt_pat(x-mai[n]//2-1, n-1)
  if x == n:
    return pat[n]
  
print(cnt_pat(X, N))

### FIXED CODE ###

N, X = map(int, input().split())
pat = [1 for _ in range(N+1)]
mai = [1 for _ in range(N+1)]
for i in range(1, N+1):
  mai[i] = 2 * mai[i-1] + 3
  pat[i] = 2 * pat[i-1] + 1

def cnt_pat(x, n):
  if n == 0:
    return 1
  if x == 1:
    return 0
  if x <= mai[n] // 2:
    return cnt_pat(x-1, n-1)
  if x == mai[n] // 2 + 1:
    return pat[n-1] + 1
  if x < mai[n]:
    return pat[n-1] + 1 + cnt_pat(x-mai[n]//2-1, n-1)
  if x == mai[n]:
    return pat[n]
  
print(cnt_pat(X, N))
I=input;I();t=[int(i)for i in I().S()]
for i in' '*int(input()):p,x=map(int,I().split());print(sum(t)+x-t[p-1])

### FIXED CODE ###

I=input
I()
t=[int(i)for i in I().split()]
for i in' '*int(input()):p,x=map(int,I().split());print(sum(t)+x-t[p-1])
import math
N,K = map(int,input().split())
ans = 0
for i in range(1,N+1):
      X = K / i
      Y = math.log(X,2)
      if int(Y) * 10 % 10 !== 0:
        Y_int = int(Y) + 1
      else:
        Y_int = int(Y)
      if i < K:
        Z = 1 / N * (0.5 ** Y_int)
        ans += Z
      else:
        ans += 1 / N

print(ans)


### FIXED CODE ###

import math
N,K = map(int,input().split())
ans = 0
for i in range(1,N+1):
      X = K / i
      Y = math.log(X,2)
      if Y * 10 % 10 == 0.0:
        Y_int = int(Y)
      else:
        Y_int = int(Y) + 1
      if i < K:
        Z = 1 / N * (0.5 ** Y_int)
        ans += Z
      else:
        ans += 1 / N

print(ans)
import math
import decimal

def main():
  a, b = input().split()
  a = int(a)
  b = decimal(b)
  c = int(b)
  d = (b - c) * 100
  ans_a = a * c
  ans_b = (a * d) // 100
  ans = math.floor(ans_b) + ans_a
  print(ans)
 
 
if __name__ == '__main__':
  main()

### FIXED CODE ###

import math

def main():
  a, b = input().split()
  a = int(a)
  b = b[0] + b[2]+ b[3]
  c = int(b)
  ans = a * c // 100
  ans = math.floor(ans)
  print(ans)
 
 
if __name__ == '__main__':
  main()
a,b=[int(x) for x in input().split()]
if (a=="H" and b="D") or (a=="D" and b=="H"):
    print("D")
else:
    print("H")

### FIXED CODE ###

a,b=[x for x in input().split()]
if (a=="H" and b=="D") or (a=="D" and b=="H"):
    print("D")
else:
    print("H")
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
dist = 10**9


for i, j in ab:
    for k in range(n):
        dist1 = abs(i - cd[k][0]) + abs(j - cd[k][1])
        if dist1 < dist:
            dist = dist1
            ch = k + 1
    print(ch)
    dist = 10**9

### FIXED CODE ###

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
dist = 10**9


for i, j in ab:
    for k in range(m):
        dist1 = abs(i - cd[k][0]) + abs(j - cd[k][1])
        if dist1 < dist:
            dist = dist1
            ch = k + 1
    print(ch)
    dist = 10**9
#!/usr/bin/env python3
#ABC147 E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w = LI()
a = [LI() for _ in range(h)]
b = [LI() for _ in range(h)]

lst = [[0]*w for _ in range(h)]
m = 0
for i in range(h):
    for j in range(w):
        lst[i][j] = abs(a[i][j] - b[i][j])
        m = max(m,abs(a[i][j] - b[i][j]))

dp = [[[0]*(h+w)*m for _ in range(w)] for _ in range(h)]
dp[0][0][lst[0][0]] = 1
for i in range(h):
    for j in range(w):
        for k in range(m*(h+w)):
            if dp[i][j][k]:
                if i+1 < h:
                    if k+lst[i+1][j] < m*(h+w):
                        dp[i+1][j][k+lst[i+1][j]] = 1
                    dp[i+1][j][abs(k-lst[i+1][j])] = 1
                if j+1 < w:
                    if k+lst[i][j+1] < m*(h+w):
                        dp[i][j+1][k+lst[i][j+1]] = 1
                    dp[i][j+1][abs(k-lst[i][j+1])] = 1

ans = 10**10
for i in range(m*(h+w)):
    if dp[-1][-1][i]:
        ans = min(ans,i)
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
#ABC147 E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w = LI()
a = [LI() for _ in range(h)]
b = [LI() for _ in range(h)]

dp = [[0 for _ in range(w)] for _ in range(h)]
lst = [[0]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        lst[i][j] = abs(a[i][j] - b[i][j])

dp[0][0] |= 1 << (6400+lst[0][0])
dp[0][0] |= 1 << (6400-lst[0][0])
for i in range(h):
    for j in range(w):
        t = dp[i][j]
        if i+1 < h:
            dp[i+1][j] |= t << lst[i+1][j]
            dp[i+1][j] |= t >> lst[i+1][j]
        if j+1 < w:
            dp[i][j+1] |= t << lst[i][j+1]
            dp[i][j+1] |= t >> lst[i][j+1]

x = dp[-1][-1]
for i in range(6401)[::-1]:
    if (x >> i) & 1:
        print(6400 - i)
        break
a = input()
if (a >= 'a' and a <= 'z'):
    print(A)
elif(a >= 'A' and a <= 'Z'):
    print(a)


### FIXED CODE ###

a = input()
if a.isupper():
    print('A')
else:
    print('a')
# coding: utf-8

n = int(input())
a = [int(x) for x in input().split()]

count = 0

for i in range(0, n):
    if not result_bool:
        result_bool = True
        continue
    for j in range(i, n):
        xor_result = 0
        sum_result = 0
        result_bool = True
        for x in a[i:j+1]:
            if sum_result & x != 0:
                result_bool = False
                break
            xor_result ^= x
            sum_result += x
        if not result_bool:
            break
        if xor_result == sum_result and result_bool:
            count += 1

print(count)

### FIXED CODE ###

# coding: utf-8

n = int(input())
a = [int(x) for x in input().split()]

count = 0
xor_result = 0
sum_result = 0
r = 0

for l in range(0, n):
    while r < n:
        x = a[r]
        if sum_result & x != 0:
            break
        xor_result ^= x
        sum_result += x
        r += 1
    count += r - l
    xor_result ^= a[l]
    sum_result -= a[l]

print(count)
class unionFind:
    parent = []
    nums = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.nums = [1]*N

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.nums[y] += self.nums[x]
            self.nums[x] = 0
            return


N, M = map(int, input().split())
G = unionFind(N)
ans = [0]*M
ab = [tuple(map(int, input().split())) for i in range(M)]

tmp = (N * (N-1)) // 2
for i, x in enumerate(reversed(ab)):
    a, b = x[0], x[1]
    ans[M-1-i] = tmp
    a = G.root(a-1)
    b = G.root(b-1)
    if a == b:
        continue
    else:
        tmp -= G.nums[a] * G.nums[b]
        G.parent[a] = b
        G.nums[b] += G.nums[a]
        G.nums[a] = 0


for i in range(M):
    print(ans[i])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)


class unionFind:
    parent = []
    nums = []

    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.nums = [1]*n

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.nums[y] += self.nums[x]
            self.nums[x] = 0
            return


N, M = map(int, input().split())
G = unionFind(N)
ans = [0]*M
ab = [tuple(map(int, input().split())) for i in range(M)]

tmp = (N * (N-1)) // 2
for i, x in enumerate(reversed(ab)):
    a, b = x[0], x[1]
    ans[M-1-i] = tmp
    a = G.root(a-1)
    b = G.root(b-1)
    if a == b:
        continue
    else:
        tmp -= G.nums[a] * G.nums[b]
        G.parent[a] = b
        G.nums[b] += G.nums[a]
        G.nums[a] = 0


for i in range(M):
    print(ans[i])
s = input()
s[3] = 8
print(s)

### FIXED CODE ###

s = input()
l = list(s)
l[3] = '8'
s = "".join(l)
print(s)
a,s=input().split()
print(a/s)

### FIXED CODE ###

a,s=map(int,input().split())
print(a/s)
from sys import stdin
from collections import deque
import numpy as np

N, M = [int(x) for x in stdin.readline().rstrip().split()]
AB = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(N)]
AB.sort(key=lambda x: (x[0], -x[1]))
work = [deque([]) for _ in range(M + 1)]

for ab in AB:
    if ab[0] <= M:
        work[ab[0]].append(ab[1])

ans = 0
day = 1
max_work = np.array([])
while day <= M:
    w = 0
    tmp = 0
    max_work = max_work.tolist()
    if len(work[day]) > 0:
        max_work.append(work[day][0])
    else:
        max_work.append(-1)
    max_work = np.asarray(max_work)
    a = np.argmax(max_work) + 1
    if max_work[a - 1] > 0:
        ans += max_work[a - 1]
        work[a].popleft()
        if len(work[a]) > 0:
            max_work[a - 1] = work[a][0]
        else:
            max_work[a - 1] = -1
    day += 1

print(ans)

### FIXED CODE ###

from sys import stdin
from collections import deque
import heapq


N, M = [int(x) for x in stdin.readline().rstrip().split()]
AB = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(N)]
AB.sort(key=lambda x: (x[0], -x[1]))
work = [deque([]) for _ in range(M + 1)]

for ab in AB:
    if ab[0] <= M:
        work[ab[0]].append(ab[1])

ans = 0
day = 1
available_work = []
while day <= M:
    for w in work[day]:
        heapq.heappush(available_work, -w)
    if len(available_work) > 0:
        ans += heapq.heappop(available_work)
    day += 1

print(-ans)
S = input()
cnt=0
ans = 0
sets = set([A,T,C,G])
for s in S:
  if s in sets:
    cnt += 1
  else:
    ans = max(ans,cnt)
    cnt = 0
print(ans)


### FIXED CODE ###

S = input()
cnt=0
ans = 0
sets = {"A","T","C","G"}
for s in S:
  if s in sets:
    cnt += 1
  else:
    ans = max(ans,cnt)
    cnt = 0
ans = max(ans,cnt)
print(ans)
a,b=map(int,input().split())
if a<10 and b <10:
	print(a*b)
elif:
    print(-1)

### FIXED CODE ###

a,b=map(int,input().split())
if a<10 and b <10:
    print(a*b)
else:
    print(-1)
import numpy as np

def napsack(n,weight,weights,values):
  dp=[[0]*(n+1) for i in range(weight+1)]
  for i in range(1,n+1):
    for j in range(weight+1):
      if j-weights[i-1]>=0:
        dp[j][i]=np.maximum(dp[j][i],dp[j-weights[i-1]][i-1]+values[i-1])
      else:
        dp[j][i]=np.maximum(dp[j][i-1],dp[j][i])

  return  dp[weight][n]
     
n,w=map(int,input().split())
items=[list(map(int,input().split())) for i in range(n)]
W=[items[i][0] for i in range(n)]
V=[items[i][1] for i in range(n)]
print(napsack(n,w,W,V))




### FIXED CODE ###

import sys
input=sys.stdin.readline

n,W=map(int,input().split())
items=[list(map(int,input().split())) for i in range(n)]
import numpy as np

dp=np.zeros([n+1,W+1],dtype=np.int64)
for i in range(n):
  w=items[i][0]
  v=items[i][1]
  dp[i+1][:w]=dp[i][:w]
  dp[i+1][w:]=np.maximum(dp[i][w:],dp[i][:-w]+v)
print(dp[-1][-1])
Sa=input()
Sb=input()
Sc=input()
card=Sa[0]
Sa=Sa[1:]
while True:
  if card=='a':
    card=Sa[0]
    Sa=Sa[1:]
  if card=='b':
    card=Sb[0]
    Sb=Sb[1:]
  if card=='c':
    card=Sc[0]
    Sc=Sc[1:]
  if (Sa=='' and Sb=='') or (Sb=='' and Sc=='') or (Sc=='' and Sa==''):
    break
  
if card=='a' and Sa=='':
  print('A')
elif card=='b' and Sb=='':
  print('B')
elif card=='c' and Sc=='':
  print('C')

### FIXED CODE ###

Sa=input()
Sb=input()
Sc=input()

ia,ib,ic=1,0,0
card=Sa[0]

while True:
  if card=='a':
    if ia==len(Sa):
      print('A')
      break
    card=Sa[ia]
    ia+=1
  if card=='b':
    if ib==len(Sb):
      print('B')
      break
    card=Sb[ib]
    ib+=1
  if card=='c':
    if ic==len(Sc):
      print('C')
      break
    card=Sc[ic]
    ic+=1
A, B, C = map(int, input().split(' '))
ymd = tuple(map(int, input().split('/')))

if ymd <= (2019, 4, 30):
    print('Heisei')
else:
    print('TBD')


### FIXED CODE ###

ymd = tuple(map(int, input().split('/')))

if ymd <= (2019, 4, 30):
    print('Heisei')
else:
    print('TBD')
def factorize(n):
    b = 2
    fct = []
    fct.append(1)
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
 
N = int(input())
listN = factorize(N)
x = 0
y = 0
mini = 10**12
if len(listN) == 1:
    x = N
    y = 1
else:
    for i in range(1,len(listN)):
        tmp = list(itertools.combinations(listN,i))
        tmp = list(set(tmp))
        for j in range(len(tmp)):
            x0,y0 = 1,1
            for k in range(len(tmp[j])):
                x0 *= tmp[j][k]
                y0 = N//x0
                if mini > abs(x0+y0):
                    mini = abs(x0+y0)
                    x = x0
                    y = y0
print(x-1+y-1)

### FIXED CODE ###

import sys
import os

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

    # divisors.sort()
    return divisors

N = int(input())
listN = make_divisors(N)
mini = 10**12
if len(listN) == 1:
    x = N
    y = 1
else:
    for i in range(len(listN)):
        x = listN[i]
        y = N//x
        mini = min(x+y,mini)
print(x-1+y-1)