Harryxun/stf_run huggingface dataset:
import math

# N = 4
# HRR = [10, 30, 40, 20]
# N = 2
# HRR = [10, 10]

N = int(input())
HRR = list(map(int,input().split()))
result = []


def calculate(pos, n, hrr, cost):
    if pos == n-1:
        result.append(int(cost))

    if pos + 1 <= n-1:
        calculate(pos + 1, n, hrr, cost + math.fabs(hrr[pos + 1] - hrr[pos]))

    if pos + 2 <= n-1:
        calculate(pos + 2, n, hrr, cost + math.fabs(hrr[pos + 2] - hrr[pos]))


calculate(0, N, HRR, 0)
print(min(result))

### FIXED CODE ###

# N = 4
# HRR = [10, 30, 40, 20]
# N = 2
# HRR = [10, 10]

N = int(input())
HRR = list(map(int,input().split()))
result = []
for i in range(N):
    if i == 0:
        result.append(0)
    elif i == 1:
        s1 = result[i - 1] + abs(HRR[i] - HRR[i - 1])
        result.append(s1)
    else:
        s1 = result[i - 1] + abs(HRR[i] - HRR[i - 1])
        s2 = result[i - 2] + abs(HRR[i] - HRR[i - 2])
        result.append(min(s1, s2))

print(result[-1])
#りゅうせいの解答1 実行時間超過、実行時エラー発生
# N = int(input())
# task_list = [list(map(int,input().split())) for i in range(N)]
#
# task_list.sort(key= lambda task_list: task_list[1])
# time = 0
#
# while(len(task_list)):
#     x = task_list.pop(0)
#     time += x[0]
#     if time > x[1]:
#         print("No")
#         exit(1)
#
#     else:
#         continue
#
# print("Yes")

#りゅうせいの解答2　ソートしない
N = int(input())
task_list = [list(map(int,input().split())) for i in range(N)]

time = 0

while(len(task_list)):
    idx = task_list.index(min(task_list,key = lambda task_list:task_list[1]))
    x = task_list.pop(idx)
    time += x[0]
    if time > x[1]:
        print("No")
        exit(1)

    else:
        continue

print("Yes")

### FIXED CODE ###

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

task_list.sort(key=lambda task_list: task_list[1])
time = 0
flag = True

for i in range(N):
    x = task_list[i]
    time += x[0]
    if time > x[1]:
        flag = False
        break

if flag:
    print("Yes")

else:
    print("No")




#りゅうせいの解答1　実行時エラー、実行時間超過
# N = int(input())
# task_list = [list(map(int,input().split())) for i in range(N)]
#
# task_list.sort(key= lambda task_list: task_list[1])
# time = 0
#
# while(len(task_list)):
#     x = task_list.pop(0)
#     time += x[0]
#     if time > x[1]:
#         print("No")
#         exit(1)
#
#     else:
#         continue
#
# print("Yes")
# coding:utf-8
import readline
h1 = input()
m1 = input()
h2 = input()
m2 = input()
k = input()

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline

h1, m1, h2, m2, k = map(int, readline().split())
print(60 * (h2 - h1) + m2 - m1 - k)
from sys import stdin
n,k=[int(x) for x in stdin.readline().rstrip().split()]
data=[int(x) for x in stdin.readline().rstrip().split()]

tmp=[]
cnt=0
for i in range(len(data)):
    for j in range(len(data)-i):
        tmp.append(((sum(data[i:1+i+j]))))
        cnt+=1
beat_v=sorted(tmp)
tmp2 = list(map(lambda x: len(bin(x)), beat_v))

#同じ桁のbit列がK個以上あるか探索
cnt2=0
maxbit=tmp2[-1]
res=0
for l in reversed(tmp2):
    if maxbit==l:
        cnt2+=1
    maxbit=l
    if cnt2==k:
        res=maxbit
        break
cnt3=0
for m in reversed(tmp2):
    if m != res:
        cnt3+=1
    else :
        break
        
res_=list(reversed(beat_v))[cnt3:cnt3+k]
result=res_[0]
for g in res_:
    result=result&g
print(result)

### FIXED CODE ###

from sys import stdin
N=int(stdin.readline().rstrip())
data=[int(x) for x in stdin.readline().rstrip().split()]
from statistics import mean
data_mean=mean(data)
def calc_(n):
    return abs(n-data_mean)
 
data2 = list(map(calc_, data))
data3=list(data2)
result=data3.index(min(data3))
print(result)
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i range(N):
  l = V[i] - C[i]
  R.append(l)
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)
  


### FIXED CODE ###

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i in range(N):
  l = V[i] - C[i]
  R.append(l)
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)
while True:
    text = input()
    a = {}
    for x in range(ord('a'), ord('z') + 1):
        a[chr(x)] =  list(text.lower()).count(chr(x))
        print(chr(x), ':', a[chr(x)])

### FIXED CODE ###

a = {x:0 for x in range(ord('a'), ord('z') + 1)}

while True:
    try:
        text = input()
        for x in text:
            if ord('a') <= ord(x) <= ord('z') or ord('A') <= ord(x) <= ord('Z'):
                a[ord(x.lower())] += 1
    except EOFError:
        break

for x in range(ord('a'), ord('z') + 1):
    print(chr(x), ':', a[x])
antenna = []
for i in range(5):
  antenna.append(int(input()))
K = int(input())

d = True
for i in range(5):
  if d:
  for j in range(i,5):
    if antenna[j]-antenna[i] > K:
      print(':(')
      d = False
      break
if d:
  print('Yay!')

### FIXED CODE ###

antenna = [int(input()) for i in range(5)]
k = int(input())
judge = ''
i,j = 1,1
for i in range(5):
  for j in range(i+1,5):
    if abs(antenna[i]-antenna[j]) > k:
      judge = ':('
      break

if judge==':(':
  print(':(')
else:
  print('Yay!')
N, M = map(int, input().split())
list = list(map(int, input().split()))
m=0
for i in range (0, len(list)):
	m=m+list[i]
if N-m>=0:
print(N-m)
else:
print(-1)

### FIXED CODE ###

N, M = map(int, input().split())
list = list(map(int, input().split()))
 
m=0
for i in range (0, len(list)):
	m=m+list[i]
if N-m>=0:
	print(N-m)
elif N-m<0:
	print(-1)
a=[]
while True:
 n=input()
 if n=='0 ? 0':break
 a.append(n)
for s in a:
 t=s.split()
 if t[1]=="/":
  print(t[0]//t[2])
 else:
  print(eval(''.join(t)))

### FIXED CODE ###

while 1:
 a=input()
 if'?'in a:break
 print(int(eval(a)))
# (d1+d2)/2 == n1, (d2+d3)/2 == n2... が矛盾なくなるようにする
# にぶたんを使う
# なんかしらんけど3問がWAで駄目だな...

n = int(input())
dum = list(map(int, input().split()))
count = 0
l, r = -1, (10 ** 9 + 1000000) // 2

while True:
    mid = (l + r) // 2
    # print(l, r, mid)
    rain = [0 for _ in range(n)]
    rain[0] += mid * 2
    for i in range(1, n):
        next_amount = (dum[i - 1] - (rain[i - 1] // 2)) * 2
        rain[i] += next_amount
    # print(rain)

    if dum[-1] == (rain[-1] + rain[0]) // 2:
        rain = list(map(str, rain))
        print(" ".join(rain))
        exit()
    if (rain[0] + rain[-1]) // 2 < dum[-1]:
        # 最初に決めたやつが小さすぎた
        # print("{} は小さすぎた".format(rain[0]))
        l = mid + 1
    else:
        # 最初に決めたやつが大きすぎた
        # print("{} は大きすぎた".format(rain[0]))
        r = mid

    # セーフティネット 必要ないけど
    if count > 50:
        t = 5 / 0
        break
    count += 1

"""
7
110 50 53 50 11 36 88

11
38 7 15 15 9 31 23 1 5 55 81
"""


### FIXED CODE ###

# (d1+d2)/2 == n1, (d2+d3)/2 == n2... が矛盾なくなるようにする
# にぶたんを使う
# なんかしらんけど3問駄目だな...

n = int(input())
dum = list(map(int, input().split()))
count = 0
l, r = 0, (10 ** 10) // 2

while l < r:
    mid = (l + r) // 2
    # print(l, r, mid)
    rain = [0 for _ in range(n)]
    rain[0] += mid * 2
    for i in range(1, n):
        next_amount = (dum[i - 1] - (rain[i - 1] // 2)) * 2
        rain[i] += next_amount
    # print(rain)

    if dum[-1] == (rain[-1] + rain[0]) // 2:
        rain = list(map(str, rain))
        print(" ".join(rain))
        exit()
    if (rain[0] + rain[-1]) // 2 < dum[-1]:
        # 最初に決めたやつが小さすぎた
        # print("{} は小さすぎた".format(rain[0]))
        l = mid + 1
    else:
        # 最初に決めたやつが大きすぎた
        # print("{} は大きすぎた".format(rain[0]))
        r = mid

    # セーフティネット 必要ないけど
    if count > 50:
        t = 5 / 0
        break
    count += 1

"""
7
110 50 53 50 11 36 88

11
38 7 15 15 9 31 23 1 5 55 81
"""
a,b,c,d = map(int,input().split())
import math
lcm = c * d // math.gcd(c, d)
def num_of_complements(x,c,d):

    num = x + x//lcm - x//c - x//d
    return num

ans = num_of_complements(b,c,d) - num_of_complements(a-1,c,d)
print(int(ans))


### FIXED CODE ###

a,b,c,d = map(int,input().split())
from fractions import gcd
lcm = c * d // gcd(c, d)
def num_of_complements(x,c,d,lcm):
    num = x + x//lcm - x//c - x//d
    return num

ans = num_of_complements(b,c,d,lcm) - num_of_complements(a-1,c,d,lcm)
print(ans)
#include<stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define cnt 1000000000000000000
int main(){
  int N;
  long int A[1000000];
  long long int sum=1;
  scanf("%d", &N);
  for (int i = 0; i <N; i++){
    scanf("%ld",&A[i]);
    sum *= A[i];

  }

  
  if(sum >cnt){
    printf("-1\n");
  }else{
    printf("%lld\n", sum);
  }
  return 0;
}

### FIXED CODE ###

#from operator import mul
#from functools import reduce
#cnt = 1000000000000000000
ans =1
N = int(input())
nums = list(map(int, input().split()))

if 0 in nums:
        print(0)
        exit()
for num in nums:
    ans *= num
    if ans > 10**18 :
        print(-1)
        exit()
print(ans)
from collections import Counter
 
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
S = sum(A)
 
for _ in range(int(input())):
    p, q = map(int, input().split())
    k = count[p]
    count[p] = 0
    count[q] += k
    S += (q - p) * k
    print(S)

### FIXED CODE ###

from collections import Counter
 
N = int(input())
A = list(map(int, input().split()))
count = Counter(A)
S = sum(A)
 
for _ in range(int(input())):
    b, c = map(int, input().split())
    k = count[b]
    count[b] = 0
    count[c] += k
    S += (c - b) * k
    print(S)
N = int(input())

n = 1000 - N
if N == 2000 or N == 3000 or N == 4000 or N ==5000 or N == 6000 or N == 7000 or N == 8000 or N == 9000 or N == 10000or N == 0:
  print(0)
elif 1000 < N:
  m = n * (-1)
  print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)

### FIXED CODE ###

N = int(input())

n = 1000 - N
if N == 2000 or N == 3000 or N == 4000 or N ==5000 or N == 6000 or N == 7000 or N == 8000 or N == 9000 or N == 10000or N == 0:
  print(0)
elif 1000 < N:
  m = n * (-1)
  if m < 10:
    print(1000-m)
  elif m < 100:
    print(1000-(int(str(m)[-2])*10) + (int(str(m)[-1])))
  else:
    print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)
S = input()
N = len(S)
A = (N - 1) // 2
B = ((N + 3) // 2)
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

### FIXED CODE ###

S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')
mycnt = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        mycnt += 1

if len(set(S)) == 1:
    print(len(S)*K//2)

elif S[0] != S[-1]:
    
    print(mycnt * K)

else:
    myleft = 1
    myright = 0
    mys = S[0]
    i = 1
    while S[i] == mys:
        myleft += 1
        i += 1
    
    myright = 0
    i = -1
    while S[i] == mys:
        myright += 1
        i -= 1
    print( (mycnt * K) - ( myleft//2 + myright//2 - (myright + myleft)//2 ) * ( K - 1 ) )
    

### FIXED CODE ###

S = input()

#K = 1
K = int(input())

mycnt = 0
mynum = 1
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        mynum += 1
        
    else: 
        mycnt += mynum//2
        mynum = 1
    #print('mycnt=', mycnt)
if mynum > 1:
    mycnt += mynum//2 

if len(set(S)) == 1:
    print(len(S)*K//2)

elif S[0] != S[-1]:
    
    print(mycnt * K)

else:
    myleft = 1
    myright = 0
    mys = S[0]
    i = 1
    while S[i] == mys:
        myleft += 1
        i += 1
    
    myright = 0
    i = -1
    while S[i] == mys:
        myright += 1
        i -= 1
    #print(myleft, myright)
    print( (mycnt * K) - ( myleft//2 + myright//2 - (myright + myleft)//2 ) * ( K - 1 ) )
n=int(input())
a=list(map(int,input().split()))
bs=[0 for _ in range(n)]
for x in a:
    bs[x-1]+=1


for x in bs:
    print(x)



### FIXED CODE ###

r=int(input())





print(2*r*3.14159265)
A, B = map(int, input().split())
print(max(A+B, A-B, A*B)

### FIXED CODE ###

A, B = map(int, input().split())
print(max(A+B, A-B, A*B))
import copy
 
h, w = map(int, input().split())
S_outer = [input() for _ in range(h)]
 
 
def get_shortest_steps(S_inner, visited, i_inner, j_inner, steps):
    if i_inner == -1 or i_inner == h or j_inner == -1 or j_inner == w:
        return sys.maxsize
    if visited[i_inner * 20 + j_inner]:
        return sys.maxsize
    if S_inner[i_inner][j_inner] == "#":
        return sys.maxsize
    visited[i_inner * 20 + j_inner] = True
    if shortest_steps_map[i_inner * 20 + j_inner] > steps:
        shortest_steps_map[i_inner * 20 + j_inner] = steps
    get_shortest_steps(S_inner, copy.copy(visited), i_inner + 1, j_inner, steps + 1)
    get_shortest_steps(S_inner, copy.copy(visited), i_inner, j_inner + 1, steps + 1)
    get_shortest_steps(S_inner, copy.copy(visited), i_inner - 1, j_inner, steps + 1)
    get_shortest_steps(S_inner, copy.copy(visited), i_inner, j_inner - 1, steps + 1)
    return
 
 
result = -1
for i_outer in range(h):
    for j_outer in range(w):
        visited_outer = [False] * (h * 20 + w + 1)
        shortest_steps_map = [500] * (h * 20 + w + 1)
        get_shortest_steps(S_outer, copy.copy(visited_outer), i_outer, j_outer, 0)
 
        for i in range(len(shortest_steps_map)):
            if shortest_steps_map[i] == 500:
                shortest_steps_map[i] = 0
 
        if max(shortest_steps_map) > result:
            result = max(shortest_steps_map)
print(result)

### FIXED CODE ###

import sys
import numpy as np
from collections import deque

h, w = map(int, input().split())
maze = [list(input()) for _ in range(h)]
direction = [(1, 0), (0, 1), (-1, 0), (0, -1)]

max_step = 0
for i in range(h):
    for j in range(w):
        largest_step = 0
#        print("start: ", i, j)
        if maze[i][j] == "#":
            continue
        visited = [[False] * w for _ in range(h)]
        distance = [[-1] * w for _ in range(h)]
        plan = deque()
        step = 0
        plan.appendleft((i, j, step))
        distance[i][j] = step
        visited[i][j] = True
        while plan:
            y, x, step = plan.pop()
#            print(" ", x, y, step)
            # if step > largest_step:
            #     largest_step = step
            for next_direction in direction:
                next_y = y + next_direction[0]
                next_x = x + next_direction[1]
                if -1 == next_x or next_x == w or -1 == next_y or next_y == h or maze[next_y][next_x] == "#" or visited[next_y][next_x]:
                    continue
                distance[next_y][next_x] = distance[y][x] + 1
                visited[next_y][next_x] = True
                plan.appendleft((next_y, next_x, step + 1))
#        print(largest_step)
        # if largest_step > max_step:
        #     max_step = largest_step
        max_step = max(max_step, np.max(np.array(distance)))

print(max_step)
#AGC007 A
'''
問題
縦H行で横W列の盤面がある
コマははじめ左上隅のマスに置かれており，右下隅に移動した
駒は1マスずつ上下左右に動ける
駒が通ったことのあるマスが提示されるので，駒が常に右または下にしか動いていなかったどうか判定せよ
ただし通ったことのあるマスは'#',一度も通らなかったマスは'.'で与えられる

考察
各行0,1,...,i,...,H-1に対して'#'のマスが存在する範囲を[ai,bi]とする。ただし0<=ai<=bi<=W-1
このとき各0,1,...,j,...,H-2について b_j == a_(j+1) であればよい
'''

import re

H,W = map(int,input().split(' '))
A = []

ans = ''
answers = ('Possible','Impossible')

r = re.compile(r'\.*#+\.*')

for i in range(H):
	s = input()
	if len(r.findall(s)) == 1:
		A.append(s)
	else:
		#'#'が2箇所以上にわかれていたらその時点でアウト
		ans = answers[1]
		break
		
for i in range(H-1):
	if A[i].rfind('#') == A[i+1].find('#'):
		continue
	else:
		ans = answers[1]
		break

if ans == '':
	ans = answers[0]

print(ans)

### FIXED CODE ###

#AGC007 A
'''
問題
縦H行で横W列の盤面がある
コマははじめ左上隅のマスに置かれており，右下隅に移動した
駒は1マスずつ上下左右に動ける
駒が通ったことのあるマスが提示されるので，駒が常に右または下にしか動いていなかったどうか判定せよ
ただし通ったことのあるマスは'#',一度も通らなかったマスは'.'で与えられる

考察
各行0,1,...,i,...,H-1に対して'#'のマスが存在する範囲を[ai,bi]とする。ただし0<=ai<=bi<=W-1
このとき各0,1,...,j,...,H-2について b_j == a_(j+1) であればよい
'''

import re

H,W = map(int,input().split(' '))
A = []

ans = ''
answers = ('Possible','Impossible')

r = re.compile(r'\.*#+\.*')

for i in range(H):
	s = input()
	if len(r.findall(s)) == 1:
		A.append(s)
	else:
		#'#'が2箇所以上にわかれていたらその時点でアウト
		ans = answers[1]
		break

if ans == '':
	for i in range(H-1):
		if A[i].rfind('#') == A[i+1].find('#'):
			continue
		else:
			ans = answers[1]
			break

if ans == '':
	ans = answers[0]

print(ans)
a = int(input())

if 0 < a < 10;
  a = a 
elif 9 < a < 100;
  a = a % 10
else;
  a = a % 100
  
if a = 3;
  print("bon")
elif a = 0 or a = 1 or a = 6 or a = 8;
  print("pon")
else;
  print("hon")

  

### FIXED CODE ###

N = int(input())
n = N % 10
 
if n in [2, 4, 5, 7, 9]:
  print("hon")
elif n in [0, 1, 6, 8]:
  print("pon")
else:
  print("bon")
def resolve():
  s = input()
  if s == 'Sunny':
    print('Cloudy')
  elif s == 'Cloudy':
    print(Rainy)
  else:
    print('Sunny')

  return

if __name__ == "__main__":
  resolve()


### FIXED CODE ###

import sys

def resolve():
  s = input()
  if s == 'Sunny':
      print('Cloudy')
  elif s == 'Cloudy':
      print('Rainy')
  else:
      print('Sunny')

if __name__ == "__main__":
    resolve()
N=int(input())
print((N+1/2)

### FIXED CODE ###

print((int(input())+1)//2)
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i]]
  if　a[i]-a[i-1]==1:
    p+=c[i]
print(p)
  


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
p=0
for i in range(n):
  p+=b[a[i]-1]
  if i>=1 and a[i]-a[i-1]==1:
    p+=c[a[i-1]-1]
print(p)
a,b,x=map(int,input().split())
print(len(list(range(a,b+1,x)))-(a==b

### FIXED CODE ###

a,b,x=map(int,input().split())
print(b//x-a//x+(a%x==0))
print(A+input()[8]+C)


### FIXED CODE ###

print("A"+input()[8]+"C")
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            n, m, a = map(int, raw_input().split())
            if n == 0 and m == 0 and a == 0:
                break
            adj = [[] for i in range(m)]
            for i in range(m):
                h, p, q = map(int, raw_input().split())
                adj[h].append((p, q))

            for e in reversed(adj):
                for p, q in e:
                    if p == a:
                        a = q
                    elif q == a:
                        a = p
            print a
                    
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

### FIXED CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            n, m, a = map(int, raw_input().split())
            if n == 0 and m == 0 and a == 0:
                break
            adj = []
            for i in range(m):
                h, p, q = map(int, raw_input().split())
                adj.append((h, p, q))
            adj.sort(reverse=True)
            # print adj
            for h, p, q in adj:
                if p == a:
                    a = q
                elif q == a:
                    a = p
            print a
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()
s=list(input())
k=int(input())
for i in range(len(s)):
    if k>=ord("z")-ord(s[i])+1:
        k-=(ord("z")-ord(s[i])+1)
        s[i]="a"

if k>0:
    if ord("z")-(ord(s[-1])+k)<=0:
        k-=ord("z")-ord(s[-1])+1
        k%=26
        s[-1]=chr(ord("a")+k)
    else:
        s[-1]=chr(ord(s[-1])+k)

print("".join(s))


### FIXED CODE ###

s=list(input())
s.insert(4," ")
print("".join(s))
dataset = map(int, input().split(\n))
for i in range(len(dataset)):
	if dataset[i] == 0:
		break
	else:
		print("Case %d: %d", i, dataset[i])

### FIXED CODE ###

count = 0
while True:
	count += 1
	x = int(input())
	if x == 0:
		break
	else:
		print("Case %d: %d" % (count, x))
n, k, x, y = [map(int(input()), for i in range(4))]
print(x*n - (x - y)*max(0, n - k)


### FIXED CODE ###

n,k,x,y=[int(input()) for i in range(4)]
print(n*x-(x-y)*max(n-k,0))
N = input().int()
A = map(int,input().split())
B = map(bin,A)
def Y(x):
  y = len(x)-x.rfind("1")-1
  return y
C = map(Y,B)
print(min(C))


### FIXED CODE ###

import math 
N = int(input())
A = map(int,input().split())
B = map(bin,A)
def Y(x):
  y = len(x)-x.rfind("1")-1
  return y
C = map(Y,B)
print(min(C))
import sys
sys.setrecursionlimit(10 ** 9)

N, M = map(int, input().split())
root = [-1] * N

def parent(x):
    if root[x] < 0:
        return x
    return parent(root[x])


def union(x, y):
    x_parent = parent(x)
    y_parent = parent(y)
    if x_parent == y_parent:
        return
    root[x_parent] += root[y_parent]
    root[y_parent] = x


def size(x):
    return -root[x]
    

for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    union(a, b)
    print(root)


max_size = 0
for i in range(N):
    max_size = max(size(i), max_size)

print(max_size)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n

def r(x):
    if root[x] < 0:
        return x
    else:
        root[x] = r(root[x])
        return root[x]
    

def unite(x, y):
    x = r(x)
    y = r(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
    

def size(x):
    x = r(x)
    return -root[x]


for i in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    unite(x,y)

"""
max_size = 0
for i in range(n):
    max_size = max(size(i), max_size)
"""
max_size = max(map(size, range(n)))

print(max_size)
import math
(a, b, x) = map(int, input().split())

theta = 0
if x < (a ** 2) * b / 2:
  theta = math.pi / 2 - math.atan(2 * x / a / b ** 2)
else:
  theta = math.pi / 2 - math.atan(a ** 3 / 2 / (a ** 2 * b - x))
print(theta * 180 / math.pi)


### FIXED CODE ###

import math
(a, b, x) = map(int, input().split())

theta = 0
if x < (a ** 2) * b / 2:
    theta = math.pi / 2 - math.atan(2 * x / a / b ** 2)
else:
    if a ** 2 * b == x:
        theta = 0
    else:
        theta = math.pi / 2 - math.atan(a ** 3 / 2 / (a ** 2 * b - x))
print(theta * 180 / math.pi)
s = input()
n = len(s)
X = x*n
print("X")

### FIXED CODE ###

s = input()
n = len(s)
X = "x" *n
print(X)
import sys

inf = 1<<30

def solve():
    while 1:
        e = int(sys.stdin.readline().rstrip())

        if e == 0:
            return

        ans = inf

        for z in range(int(e**(1/3)) + 10):
            if e - z**3 < 0:
                break

            for y in range(int((e - z**3)**0.5) + 10):
                x = e - z**3 - y**2

                if x < 0:
                    break

                ans = min(ans, x + y + z)

        print(ans)

if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys

inf = 1<<30

def solve():
    while 1:
        e = int(sys.stdin.readline().rstrip())

        if e == 0:
            return

        ans = inf

        for z in range(int(e**(1/3)) + 10):
            rest = e - z**3

            if rest < 0:
                break
                
            y = int((rest)**0.5)
            x = rest - y**2

            ans = min(ans, x + y + z)

        print(ans)

if __name__ == '__main__':
    solve()
# -*- coding: utf-8 -*-
import math

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

tmp= math.ceil(math.sqrt(n))

for i in range(0,tmp):
	if(n%(tmp-i)==0):
		break

#print(tmp-i)
ansn=n//(tmp-i)
#print(ansn)
ans=math.floor(math.log10(ansn-1)) + 1

print(ans)



### FIXED CODE ###

# -*- coding: utf-8 -*-
import math

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

tmp= math.ceil(math.sqrt(n))
#print(n)
#print(tmp)
for i in range(0,tmp):
	if(n%(tmp-i)==0):
		break

#print(tmp-i)
ansn=n//(tmp-i)
#print(ansn)
#print(math.log10(ansn))
#print(max(ansn,tmp-i))
#print(math.floor(0.9))
ans=math.floor(math.log10(max(ansn,tmp-i))) + 1

print(ans)
s=input()
a=a[0]+str(len(s)-2)+a[len(s)-1]
print(a)

### FIXED CODE ###

s=input()
a=s[0]+str(len(s)-2)+s[len(s)-1]
print(a)