Harryxun/stf_run huggingface dataset:
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    s = 0
    if a <= b:
        s = a
        if b <= c:
            s += b
        else:
            s += c
    else:
        s = b
        if a <= c:
            s += a
        else:
            s += b
    print(s)

if __name__ == "__main__":
    main()

### FIXED CODE ###

a = [int(x) for x in input().split()]
s = 0
if a[0] <= a[1]:
    s = a[0]
    if a[1] <= a[2]:
        s += a[1]
    else:
        s += a[2]
else:
    s = a[1]
    if a[0] <= a[2]:
        s += a[0]
    else:
        s += a[2]
print(s)
A, B, C, X = [int(input()) for i in range(4)]
print(sum(500*a + 100*b + 50*c == X for a in range(A+1) and b in range(B+2) and c in range(C+1)))

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
print(sum(500*a+100*b+50*c==X for a in range(A+1) for b in range(B+1) for c in range(C+1)))
N = int(input())
A = list(map(int, input().split()))
ans = 0
index = [0] * N
max = 0
temp = [0] * (10**9 + 1)
for i in range(N):
    for d in range(1, int(A[i]/2)):
        if A[i] % d == 0:
            temp[d] += 1
    temp[A[i]+ 1] += 1
for i in range(N-1, 0, -1):
    if N - 1 <= temp[i]:
        ans = i
        break
print(ans)


### FIXED CODE ###

from fractions import gcd
N = int(input())
A = [int(s) for s in input().split()]
ans = 0
L = [0] * (N)
R = [0] * (N)
for n in range(0, N):
    if n != N-1:
        L[n+1] = gcd(A[n], L[n])
        R[-(n+2)] = gcd(A[-(n+1)], R[-(n+1)])
for n in range(0, N):
    temp = gcd(L[n], R[n])
    ans = max(temp, ans)
print(ans)
import math
print(2*math.pi()*int(input()))

### FIXED CODE ###

print(2*(22/7)*int(input()))
n = int(input())

return (n**3 )

### FIXED CODE ###


if (__name__ == '__main__'):
    n = int(input())
    print(n**3)
import os
import sys


n = input()
a = []
for i in range(n):
    a.append(input())

print(len(set(a)))

### FIXED CODE ###

import os
import sys


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

print(len(set(a)))
s = input().split()
s = [float(i) for i in s]

#delete numbers under 0.001 order
tmp = int((s[0] * int(s[1]*100) /100)
print(tmp)

### FIXED CODE ###

a, b = input().split()
a = int(a)
b_new = int(b.replace('.',''))
ans = (a * b_new)// 100
print(ans)
import sys

args = sys.argv
a = int(args[1])
b = int(args[2])

print(a*b)
print(2*a+2*b)

### FIXED CODE ###

t = input()
t = t.split()
a = int(t[0])
b = int(t[1])

def P(x,y):
 print(x*y,2*(x+y))
 return 0

P(a,b)
x = int(input())
a = []
for i in range(2,34):
	n = i**2
	while n <= x:
		a.append(n)
		n = n*i

print(max(a))
    

### FIXED CODE ###

x = int(input())
if x != 1:
  a = []
  for i in range(2,34):
      n = i**2
      while n <= x:
          a.append(n)
          n = n*i

  print(max(a))
else:
  print(1)
import sys


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


def main():
    size = int(input())
    array = []
    dp = [0] * size
    for _ in range(size):
        z = (list(map(int, input().split())))
        newDp = [0] * size
        for i in range(3):
            for j in range(3):
                if j != i:
                    newDp[j] = max(newDp[j], dp[i] + z[j])
        dp = newDp
    print(max(dp[0],dp[1],dp[2]))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


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


def main():
    size = int(input())
    dp = [0] * 3
    for _ in range(size):
        z = (list(map(int, input().split())))
        newDp = [0] * 3
        for i in range(3):
            for j in range(3):
                if j != i:
                    # import pdb
                    # pdb.set_trace()
                    newDp[j] = max(newDp[j], dp[i] + z[j])
        dp = newDp
    print(max(dp[0],dp[1],dp[2]))


if __name__ == "__main__":
    main()
n = int(input())
a = list(map(int, input().split()))
count = 0
i = 0
while i <= (n-1):
    if a[i] == i+1 and a[i+1] == i+2:
        count += 1
        i += 2
    elif a[i] == i+1:
        count += 1
        i += 1
    else:
        i += 1

print(count)



### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
count = 0
i = 0
while i <= (n-1):
    if i == n-1:
        if a[i] == i+1:
            count += 1
            print(count)
            exit()
        else:
            break
    if a[i] == i+1 and a[i+1] == i+2:
        count += 1
        i += 2
    elif a[i] == i+1:
        count += 1
        i += 1
    else:
        i += 1

print(count)
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k]
for i in range(k,n):
    a = p[i] - p[i-k]
    print(a)
    if a > mx:
        mx = a
        
print(mx)

### FIXED CODE ###

n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k-1]
for i in range(k,n):
    a = p[i] - p[i-k]
    if a > mx:
        mx = a
        
print(mx)
#abc106c
import sys

s=raw_input()
k=int(raw_input())
if s.count('1')==len(s):
 print '1'
 sys.exit()
for i in xrange(k):
 if s[i]!='!':
  print s[i]
  sys.exit()


### FIXED CODE ###

#abc106a

a,b=map(int,raw_input().split())
print a*b-a-b+1
dat = int(input().split())

dat.sort(reverse=True)

asum=0
bsun=0

for i in range(len(dat):
	if i%2==0:
		asum = asum + dat[i]
	else:
		bsum bsum + dat[i]
		
print(asum-bsum)

### FIXED CODE ###

n = int(input())
dat = list(input().split())

dat = list(map(int,dat))

dat.sort(reverse=True)

asum = 0
bsum = 0

for i in range(n):
	if i % 2 == 0:
		asum = asum + dat[i]
	else:
		bsum = bsum + dat[i]
		
print(asum-bsum)
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N-1)]
adj = [[] for _ in range(N)]
for i in range(N-1):
    adj[AB[i][0]-1].append([AB[i][1]-1,i])
    adj[AB[i][1]-1].append([AB[i][0]-1,i])


col = [0]*(N-1)
visited = [False] * N
visited[0] = True
def dfs(v, color):
    child = adj[v]
    ctmp = 1
    for u,idx in child:
        if not(visited[u]):
            if ctmp == color:
                ctmp += 1
            col[idx] = ctmp
            visited[u] = True
            dfs(u,ctmp)
            ctmp += 1
    return 
            
    
    
    

dfs(0,0)
K = max(col)
print(K)
for k in col:
    print(k)


    

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)


N = int(input())
AB = [list(map(int,input().split())) for _ in range(N-1)]
adj = [[] for _ in range(N)]
for i in range(N-1):
    adj[AB[i][0]-1].append([AB[i][1]-1,i])
    adj[AB[i][1]-1].append([AB[i][0]-1,i])


col = [0]*(N-1)
visited = [False] * N
visited[0] = True
def dfs(v, color):
    child = adj[v]
    ctmp = 1
    for u,idx in child:
        if not(visited[u]):
            if ctmp == color:
                ctmp += 1
            col[idx] = ctmp
            visited[u] = True
            dfs(u,ctmp)
            ctmp += 1
    return 
            
    
    
    

dfs(0,0)
K = max(col)
print(K)
for k in col:
    print(k)
from datetime import datetime
input_date = datetime.datetime.strptime(input(), "%Y%m%d")

heisei = datetime.datetime(2019,4,30)
if input_date < heisei:
    print('Heisei')
else:
    print('TBD')





### FIXED CODE ###

import datetime
s=input()

input_date = datetime.datetime.strptime(s, "%Y/%m/%d")
heisei = datetime.datetime(2019,4,30)

if input_date <= heisei:
    print('Heisei')
else:
    print('TBD')
import math
import numpy as np
N, M = (int(i) for i in input().split())  

arr = np.array([[0] * N] * N)

for _ in range(M):
  A, B = (int(i) for i in input().split())  
  arr[A-1][B-1] = 1
  arr[B-1][A-1] = 1

lis = [-1] * (N-1)
def recur(bef, visit_list):
  all_visited = True
  #print(bef, visit_list)
  for i, x in enumerate(arr[bef-1]):
    if x and i+1 not in visit_list:
      recur(i+1, visit_list + [bef])
      lis[i+1 - 2] = bef
      all_visited = False
      
  if all_visited:
    return
  
recur(1, [])
if -1 in lis:
  print('No')
else:
  print('Yes')
  for x in lis:
    print(x)

### FIXED CODE ###

from collections import deque, defaultdict
N, M = map(int, input().split())
D = defaultdict(list)
for i in range(M):
    s, t = map(int, input().split())
    D[s].append(t)
    D[t].append(s)
    
q = deque()
q.append(1)
d = defaultdict(lambda: float("inf"))
d[1] = 0

while q:
  u = q.popleft()
  
  for v in D[u]:
    if d[v] == float("inf"):
      d[v] = u
      q.append(v)
      
if len(d) == N:
  print("Yes")
else:
  print("No")
  exit()
  
for i in range(2, N+1):
  print(d[i])
import math
n,k = map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,k+1):
    ans = (combinations_count(n-k+1,i)*combinations_count(k-1,i-1))%((10**9)+7)
    print(ans)

### FIXED CODE ###

import math

n,k = map(int,input().split())

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



for i in range(1,k+1):
    if n-k+1>=i:
        ans = (combinations_count(n-k+1,i)%(10**9+7)*combinations_count(k-1,i-1)%(10**9+7))
        print(ans%(10**9+7))
    else:
        print(0)
def calc(n):
  s=n+n**2+n**3
  res=int(s)
  return res
for i in range(int(input())):
  n=int(input())
  print(calc(n))
  

### FIXED CODE ###

a=int(input())
s=a+a**2+a**3
res=int(s)
print(res)
import sys
S = list(input())
# S = "Atcoder"
# S = list(S)

if S[0] != "A":
    print("WA")
    sys.exit()
elif S[1].isupper():
    print("WA")
    sys.exit()
elif S[-1].isupper():
    print("WA")
    sys.exit()
elif "C" in S[2:-1]:
    S.remove("C")
    S.remove(0)
    S = str(S)
    if S.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

### FIXED CODE ###

import sys
S = list(input())
# S = "Atcoder"
# S = list(S)

if S[0] != "A":
    print("WA")
    sys.exit()
elif S[1].isupper():
    print("WA")
    sys.exit()
elif S[-1].isupper():
    print("WA")
    sys.exit()
elif "C" in S[2:-1]:
    S.remove("C")
    del S[0]
    S = str(S)
    if S.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")
n, k = map(int, input().split())

li = [0]
li.extend(list(map(int, input().split())))

def search(town, times):
  if times <= 0:
    return town
  else:
    nextTown = li[town]
    return search(nextTown, times-1)

tuita = [0]*(n+1)
cnt = 0
town = 1

while True:
  town = li[town]
  cnt += 1
  if tuita[town] == 0:
    tuita[town] = cnt
  else:
    if k < tuita[town]:
      print(search(1, k))
    elif k == tuita[town]:
      print(town)
    else:
      print(search(town, (k - tuita[town]) % (cnt - tuita[town])))
    break

### FIXED CODE ###

n, k = map(int, input().split())

li = [0]
li.extend(list(map(int, input().split())))
tuita = [0]*(n+1)
cnt = 0
town = 1

lastTown = 1
while True:
  town = li[town]
  cnt += 1
  if tuita[town] == 0:
    tuita[town] = cnt
  else:
    if k < tuita[town]:
      lastTown = 1
      times = k
    elif k == tuita[town]:
      lastTown = town
      times = 0
    else:
      lastTown = town
      times = (k - tuita[town]) % (cnt - tuita[town])
    break

town = lastTown
while times > 0:
  if times <= 0:
    break
  times -= 1
  town = li[town]
print(town)
list=[1,2,3]

A=input()
B=input()

C=list.remove(A).remove(B)

print(C[0])


### FIXED CODE ###

list=["1","2","3"]

A=input()
B=input()

list.remove(A)
list.remove(B)

print(list[0])
a,b,c = map(int, raw_input().split)

count=0
for x in range(a,b+1):
    if  c%x == 0:
       count += 1
print('count')     
     

### FIXED CODE ###

a,b,c = map(int, raw_input().split())

count=0
for x in range(a,b+1):
    if  c%x == 0:
       count += 1
print(count)
def solve():
    N, M = map(int, input().split())
    WAnum = 0
    ACnum = 0
    WA = [0]*max(N, M)
    AC = [False]*max(N, M)

    for _ in range(M):
        p, S = map(str, input().split())
        p = int(p)
        if AC[p]:
            continue
        if S == 'AC':
            AC[p] = True
            ACnum += 1
            WAnum += WA[p]
        elif S == 'WA':
            WA[p] += 1
        #print(AC, WA)
    #print(AC,WA)
    print(ACnum, WAnum)

solve()

### FIXED CODE ###

def solve():
    N, M = map(int, input().split())
    WAnum = 0
    ACnum = 0
    WA = [0]*(N+1)
    AC = [False]*(N+1)

    for _ in range(M):
        p, S = map(str, input().split())
        p = int(p)
        if AC[p] == True:
            continue
        if S == 'AC':
            AC[p] = True
            ACnum += 1
            WAnum += WA[p]
        elif S == 'WA':
            WA[p] += 1
        #print(AC, WA)
    #print(AC,WA)
    print(ACnum, WAnum)

solve()
A, B, C, K = list(map(int, input().split( )))
     
  if(K < A):
    score = K
    elif(K >= A and K <= A+B):
      score = A
    else:
      score = A - (K - A - B)
     
    print(score)

### FIXED CODE ###

A, B, C, K = list(map(int, input().split( )))
     
if(K < A):
      score = K
elif(K >= A and K <= A+B):
      score = A
else:
     score = A - (K - A - B)
     
print(score)
#import sys
#sys.setrecursionlimit(100)
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
H, W = map(int, input().split())
S = [input() for _ in range(H)]

dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]

def dfs(x, y, count, i):
	nx = x + dx[i]
	ny = y + dy[i]
	if nx >= 0 and nx < H and ny >= 0 and ny < W and S[nx][ny] == '.':
		return dfs(nx, ny, count + 1, i)
	else:
		return count
		
ans = 0

for sx in range(H):
	for sy in range(W):
		if S[sx][sy] == '.':
			tmp = 1
			for i in range(4):
				tmp += dfs(sx, sy, 0, i)
				
			if tmp > ans:
				ans = tmp
				
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
H, W = map(int, input().split())
S = [input() for _ in range(H)]
R = [[0] * W for _ in range(H)]
L = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]

for i in range(H):
	for j in range(W):
		if S[i][j] == '.':
			if j > 0:
				L[i][j] = L[i][j - 1] + 1
			elif j == 0:
				L[i][j] = 1
				
			if i > 0:
				U[i][j] = U[i - 1][j] + 1
			elif i == 0:
				U[i][j] = 1
		
		if S[i][W - j - 1] == '.':
			if j > 0:
				R[i][W - j - 1] = R[i][W - j] + 1
			elif j == 0:
				R[i][W - j - 1] = 1
		
		if S[H - i - 1][j] == '.':
			if i > 0:
				D[H - i - 1][j] = D[H - i][j] + 1
			elif i == 0:
				D[H - i - 1][j] = 1
			
ans = 0
for i in range(H):
	for j in range(W):
		tmp = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
		if tmp > ans:
			ans = tmp
			
print(ans)
print("YES" if sorted(input().split())==["5","5","7"] else "NO"]

### FIXED CODE ###

print("YES" if sorted(input().split())==["5","5","7"] else "NO")
A,B=map(int, input().split())
if A-B>=2:
  print(2*A-1)
elif A=B:
  print(A+B)
else:
  print(2*B-1)

### FIXED CODE ###

A,B=map(int, input().split())
if A-B>=1:
  print(2*A-1)
elif A==B:
  print(A+B)
else:
  print(2*B-1)
H, W, A, B = map(int, input().split())

ans = 0 
MOD = 10**9 + 7
N = H + W - 2
fac = [1] * N
inv = [1] * N

# 階乗
for i in range(1, N):
    fac[i] = (fac[i - 1] * i) % MOD
 
# 逆元
inv[N - 1] = pow(fac[N - 1], mod - 2, mod)
for i in range(N - 1, 0, -1):
    inv[i - 1] = (inv[i] * i) % MOD
 
 
def f(x, y):
    ans = fac[x + y] * inv[x] * inv[y] % MOD
    return ans
 

for x in range(B, W):
    ans += f(x, H - A - 1) * f(W - 1 - x, A - 1)
    ans %= MOD
    
print(ans % MOD)

### FIXED CODE ###

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

ans = 0 
MOD = 10**9 + 7
N = H + W - 2
fac = [1] * N
inv = [1] * N

# 階乗
for i in range(1, N):
    fac[i] = (fac[i - 1] * i) % MOD
 
# 逆元
inv[N - 1] = pow(fac[N - 1], MOD - 2, MOD)
for i in range(N - 1, 0, -1):
    inv[i - 1] = (inv[i] * i) % MOD
 
 
def f(x, y):
    ans = fac[x + y] * inv[x] * inv[y] % MOD
    return ans
 

for x in range(B, W):
    ans += f(x, H - A - 1) * f(W - 1 - x, A - 1)
    ans %= MOD
    
print(ans % MOD)
N, K = map(int, input().split())
H = []
for i in range(N):
    h = int(input())
    H.append(h)
H = H.sorted()
mi = 10**9
for i in range(N-K+1):
    _ = H[i+K] - H[i]
    if mi > _:
        mi = _
print(mi)

### FIXED CODE ###

N, K = map(int, input().split())
H = []
for i in range(N):
    h = int(input())
    H.append(h)
H = sorted(H)
mi = 10**9
for i in range(N-K+1):
    _ = H[i+(K-1)] - H[i]
    if mi > _:
        mi = _
print(mi)
import numpy as np

R, C, K = map(int, input().split())
rcvs = [list(map(int, input().split())) for _ in range(K)]

rcvs = np.array(rcvs, dtype = "int16")

for i in range(len(rcvs)):
    rcvs[i][0] -= 1
    rcvs[i][1] -= 1

rewards = np.array([[0 for _ in range(C)] for _ in range(R)], dtype="int16")


for rcv in rcvs:
    rewards[rcv[0],rcv[1]] = rcv[2]

dp = [[[0 for _ in range(4)] for _ in range(C+1)] for _ in range(R+1)]
dp = np.array(dp)
answer = 0

for i in range(R):
    for j in range(C):
        reward = rewards[i][j]
        dp[i+1,j+1,0] = max(dp[i,j+1])
        dp[i+1,j+1,1] = dp[i+1,j+1,0] + reward
        
        for k in range(4): # move downside without selecting
            candidate = dp[i+1,j,k]
            dp[i+1,j+1,k] = max(dp[i+1,j,k], dp[i+1,j+1,k])
        if reward > 0:
            for k in range(3):
                dp[i+1,j+1,k+1] = max(dp[i+1,j,k]+reward,dp[i+1,j+1,k+1])
print(max(dp[-1,-1]))


### FIXED CODE ###

import sys
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
import sys

R, C, K = map(int, input().split())
rcvs = [list(map(int, input().split())) for _ in range(K)]
rcvs = np.array(rcvs, dtype=np.int64)

@njit(i8(i8[:,:]), cache=True)
def main(rcvs):
    rewards = np.zeros((R, C), dtype=np.int64)
    
    for i in range(len(rcvs)):
        rewards[rcvs[i][0]-1][rcvs[i][1]-1] = rcvs[i][2]
    
    dp = np.zeros((R+1, C+1, 4), dtype=np.int64)
    
    for i in range(R):
        for j in range(C):
            reward = rewards[i][j]
            dp[i+1][j+1][0] = max(dp[i][j+1])
            dp[i+1][j+1][1] = dp[i+1][j+1][0] + reward
            
            for k in range(4): # move downside without selecting
                dp[i+1][j+1][k] = max(dp[i+1][j][k], dp[i+1][j+1][k])
            if reward > 0:
                for k in range(3):
                    dp[i+1][j+1][k+1] = max(dp[i+1][j][k]+reward,dp[i+1][j+1][k+1])
    return max(dp[-1][-1])

print(main(rcvs))
#cording: utf-8

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

ct = [], []
for i in range(N):
    ct.append(map(int, input().split()))

if len(c) != 0:
    print(min(c))
else:
    print('TEL')


### FIXED CODE ###

#cording: utf-8

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

ct = []
for i in range(N):
    ct.append(list(map(int, input().split())))

c_min = 1001
for i in range(N):
    if (ct[i][1] <= T) and (ct[i][0] <= c_min):
        c_min = ct[i][0]

print(c_min if c_min != 1001 else 'TLE')
N = int(input())
A = list(map(int,input().split()))
if N == 0:
    print(1 if A[0] == 1 else -1)

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

nodeM = nodeS[0]-A[0]

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

laS[-1] = A[-1]
for i in range(N):
    laS[-2-i] = A[-2-i] + laS[-1-i]


for i in range(N):
    nodeS[i+1] = nodeM*2
    nodeM = nodeS[i+1] - A[i+1]
    if nodeS[i] >= laS[i]:
        j = i
        break
    if i == N-1:
        if nodeS[i+1] >= laS[i+1]:
            j = i+1
        else:
            print(-1)
            exit()

for i in nodeS:
    if i < 0:
        print(-1)
        exit()

ans = sum(nodeS[:j]) + sum(laS[j:])
print(ans)



### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
if N == 0:
    print(1 if A[0] == 1 else -1)
    exit()

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

nodeM = nodeS[0]-A[0]

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

laS[-1] = A[-1]
for i in range(N):
    laS[-2-i] = A[-2-i] + laS[-1-i]


for i in range(N):
    nodeS[i+1] = nodeM*2
    nodeM = nodeS[i+1] - A[i+1]
    if nodeS[i] >= laS[i]:
        j = i
        break
    if i == N-1:
        if nodeS[i+1] >= laS[i+1]:
            j = i+1
        else:
            print(-1)
            exit()

for i in nodeS:
    if i < 0:
        print(-1)
        exit()

ans = sum(nodeS[:j]) + sum(laS[j:])
print(ans)
n = int(input())
p = list(map(int, input().split()))

cnt = 1
min_p = p[0]

if n == 1:
    print(n)
else:
    for i in range(1, n):
        if p[i] < min_p:
            min_p = p[i]
            cnt += 1
    print(cnt)

### FIXED CODE ###

n, m = map(int, input().split())

if n == m:
    print("Yes")
else:
    print("No")
import math
tan, tyou, hour, minute = input()
tan_rad = 30 * hour + 0.5 * minute
tyou_rad = 6 * minute
if tan_rad == tyon_rad:
  answer = abs(tyou - tan)
else:
  rad = abs(tan_rad - tyou_rad)
  if rad > 180:
    rad = 360 - rad
  answer = math.sqrt((tan ** 2) + (tyou ** 2) - 2 * tan * tyou * math.cos(rad))
print(answer)

### FIXED CODE ###

import math
ji, hun, H, M = input().split()
ji = int(ji)
hun = int(hun)
H = int(H)
M = int(M)
ji_rad = 30 * H + 0.5 * M
hun_rad = 6 * M
diff = abs(ji_rad - hun_rad)
if diff == 0:
  answer = abs(ji - hun)
elif diff == 180:
  answer = ji + hun
else:
  if diff > 180:
      diff = abs(360 - diff)
  answer = math.sqrt((ji ** 2) + (hun ** 2) - 2 * ji * hun * math.cos(math.radians(diff)))
print(answer)
from collections import deque
n,k=map(int, input().split())

A = deque(map(int, input().split()))
li = []
li2 = [0]*n
li.append(1)

next = 0
li2[next] = 1
t=0
rep = False

for i in range(n):
    li.append(A[next])
    li2[next] = 1
    next = A[next]-1

    if li2[next] == 1:
        li.pop()
        t = li.index(next+1)
        rep = True
        break

if rep == True:
    tmp = (k%len(li[t:])) - len(li[0:t])
    g=li[t:]
    print(g[tmp])
elif len(li) > k:
    print(li[k-1])
else:
    tmp = k%len(li[t:])
    print(li[tmp])

### FIXED CODE ###

from collections import deque
n,k=map(int, input().split())

A = deque(map(int, input().split()))
li = []
li2 = [0]*n
li.append(1)

next = 0

t=0
rep = False

for i in range(k):
    if i == k:
        print(next+1)
        exit()

    if li2[next] == 1:
        t = li.index(next+1)
        rep = True
        li.pop()
        break

    li.append(A[next])
    li2[next] = 1
    next = A[next]-1


tmp = (k-t)%len(li[t:])
print(li[tmp+t])
3
5 2 4

### FIXED CODE ###

import math

n,k =  map(int,input().split())
lis = []
for i in range(n):
    if i+1 >= k:
        lis.append(0)
    else:
        lis.append(math.ceil(math.log2((k/(i+1)))))

#print(lis)


ans = []
for i in range(n):
    ans.append(1/n * (1/2)**lis[i])

print(sum(ans))
N, K = map(int, input().split())

if N % K == 0:
  print(0)

if N > K:
  b = N % K
  print(int(K/b))

res = [N]
if N < K:
  while True:
    res.append(abs(N - K))
    N = abs(N - K)
    if N in res:
      break
print(min(res))

### FIXED CODE ###

N, K = map(int, input().split())
cand1 = N % K
cand2 = K - (N % K)
print(min(cand1, cand2))
while True:
        try:
            a, b = (int(x) for x in input().split())
            print(len(str(a+b)))
        except EOFError:
            break


### FIXED CODE ###

def main():
    while True:
        try:
            a, b = (int(x) for x in input().split())
            print(len(str(a+b)))
        except EOFError:
            break
main()
n = int(input())

a = []
for i in range(1, n//2):
    q, mod = divmod(n, i)
    if mod == 0:
        a.append((i,q))

max = max(a)

print(sum(max)-2)

### FIXED CODE ###

import numpy as np
n = int(input())

ans = 10**18

for i in range(1, int(np.sqrt(n))+1):
    if n % i == 0:
        j = n//i
        ans = min(ans, i+j-2)

print(ans)