Harryxun/stf_run huggingface dataset:
N = int(input())
a = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
sky = 0
blue = 0
yellow = 0
orange = 0
red = 0
god = int(0)
for i in range(N-1):
    if a[i] < 400:
        gray = True
    elif a[i] < 800:
        brown = True
    elif a[i] < 1200:
        green = True
    elif a[i] < 1600:
        sky = True
    elif a[i] < 2000:
        blue = True
    elif a[i] < 2400:
        yellow = True
    elif a[i] < 2800:
        orange = True
    elif a[i] < 3200:
        red = True
    else:
        god+=1
if god > 0:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + god
    color_min = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + 1
else:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red)
    color_min = color_max
print(color_max, color_min)

### FIXED CODE ###

r, g, b = map(str, input().split())
if int(r+g+b, 10)%4==0:
    print("YES")
else:
    print("NO")
import numpy as np

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    mod = int(1e9+7)
    p = []
    m = []
    for a in A:
        if a >= 0:
            p.append(a)
        else:
            m.append(a)
    p.sort(reverse=True)
    m.sort(reverse=False)
    ans = 1
    if sum(np.sign(A)) == -N and K%2 == 1:
        A = sorted(A, reverse=True)
        for i in range(K):
            ans = (ans*A[i])%mod
        print(ans)
        return

    m_pair = []
    p_pair = []
    if K%2 == 1:
        ans *= p.pop(0)%mod
    for i in range(0, len(m), 2):
        if i+1 < len(m):
            m_pair.append(m[i]*m[i+1])
        # else:
        #     m_pair.append(m[i])
    for i in range(0, len(p), 2):
        if i+1 < len(p):
            p_pair.append(p[i]*p[i+1])
        # else:
        #     p_pair.append(p[i])
    pairs = m_pair[:]
    pairs.extend(p_pair)
    pairs.sort(reverse=True)
    for i in range(K//2):
        ans = (ans*pairs[i])%mod
    print(ans)

main()


### FIXED CODE ###

import numpy as np

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    mod = int(1e9+7)
    p = []
    m = []
    for a in A:
        if a >= 0:
            p.append(a)
        else:
            m.append(a)
    p.sort(reverse=True)
    m.sort(reverse=False)
    ans = 1
    if sum(np.sign(A)) == -N and K%2 == 1:
        A = sorted(A, reverse=True)
        for i in range(K):
            ans = (ans*A[i])%mod
        print(ans)
        return
    if N == K:
        for i in range(K):
            ans = (ans*A[i])%mod
        print(ans)
        return

    m_pair = []
    p_pair = []
    if K%2 == 1:
        ans *= p.pop(0)%mod
    for i in range(0, len(m), 2):
        if i+1 < len(m):
            m_pair.append(m[i]*m[i+1])
        # else:
        #     m_pair.append(m[i])
    for i in range(0, len(p), 2):
        if i+1 < len(p):
            p_pair.append(p[i]*p[i+1])
        else:
            p_pair.append(p[i])
    pairs = m_pair[:]
    pairs.extend(p_pair)
    pairs.sort(reverse=True)
    for i in range(K//2):
        ans = (ans*pairs[i])%mod
    print(ans)

main()
N = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse=True)
 
ans = 0
 
for i in range(n-2):
  j = i + 1
  k = n - 1
  while j < k:
    if l[i] < l[j] + l[k]:
    	ans += k - j
    	j += 1
  	else:
  		k -= 1
print(ans)

### FIXED CODE ###

N = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse=True)
 
ans = 0
 
for i in range(N-2):
  j = i + 1
  k = N - 1
  while j < k:
    if l[i] < l[j] + l[k]:
      ans += k - j
      j += 1
    else:
      k -= 1
print(ans)
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

def main():
    *s,=map(len,input().split("T"))
    x,y=map(int,input().split())
    start=s[0]
    n=s[2::2]
    m=s[1::2]
#    print(n,m)
#    print(start)
    dx=deque()
    dy=deque()
    dx.append(start)
    dy.append(0)
    for i in range(len(n)):
        tmp=deque()
        for j in dx.copy():
            tmp.appendleft(j+n[i])
            tmp.appendleft(j-n[i])
        dx=tmp
#    print(dx)
    for i in range(len(m)):
        tmp=deque()
        for j in dy.copy():
            tmp.appendleft(j+m[i])
            tmp.appendleft(j-m[i])
        dy=tmp
#    print(dy)
    if x in dx and y in dy:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

### FIXED CODE ###

#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

def main():
    *s,=map(len,input().split("T"))
    x,y=map(int,input().split())
    start=s[0]
    n=s[2::2]
    m=s[1::2]
#    print(n,m)
    dx={start}
    dy={0}
#    print(dx)
    for i in n:
        dx={r+j for j in dx for r in{-i,i}}
#        print(dx)
    for i in m:
        dy={r+j for j in dy for r in{-i,i}}
#        print(dy)
    if x in dx and y in dy:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
A,B = map(int,input().split())
if (A-B)%2 == 1:
    print("IMPOSSIBLE")
else:
    print(int((A-B)/2)

### FIXED CODE ###

A,B = map(int,input().split())
if (A-B)%2 == 1:
    print("IMPOSSIBLE")
else:
    print(int((A+B)/2))
N = int(input())
ans = 0
if N%1000 != 0:
    ans = 1000 - int(str(N)[1:])
    print(ans)
else:
    print(int(ans))

### FIXED CODE ###

N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = ((N//1000) + 1)*1000 - N
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)
N = int(input())
S, T = map(list, input().split())

out = []
for i in range(N):
    #print(f"i = {i} {type(out)} S[i] = {S[i]}")
    #print(f"Output => {out}")
    out.append(S[i])
    out.append(T[i])

out = "".join(out)

print(f"{out}")

### FIXED CODE ###

N = int(input())
S, T = input().split()
 
ans = "".join([S[i] + T[i] for i in range(N)])
print(ans)
# E - ∙ (Bullet)
import sys
from collections import defaultdict

readline = sys.stdin.readline
MOD = 1000000007
N = int(readline())

# イワシの傾きをA/Bとする。
# A/Bは予めgcdで割って約分し、同じ傾きのものを揃えておく。
# このとき、仲の悪い組合せは(A, B)に対して(B, -A)となるもの。 
# 前者をS、後者をTとして考える。
d_S = defaultdict(int)
d_T = defaultdict(int)

def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y%x, x)

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

zeros = 0
for i in range(N):
    A, B = map(int, readline().split())
    # (0, 0)のイワシは他の全てのイワシと仲が悪いため、
    # 1匹のみでしか選ぶことができない。最後にこの数を足す。
    if A == 0 and B == 0:
        zeros += 1
    # (?, 0),(0, ?)のイワシは、?がどのような数字であろうとも
    # この組合せであれば仲が悪い。一律、(1,0)(0,-1)として考える。
    elif A == 0:
        d_S[(1, 0)] += 0
        d_T[(0, -1)] += 1
    elif B == 0:
        d_S[(1, 0)] += 1
        d_T[(0, -1)] += 0
    else:
        g = gcd(A, B)
        A //= g
        B //= g
        # いずれもマイナスの場合、傾きはプラスになる
        if A < 0 and B < 0:
            A *= -1
            B *= -1
        if A * B > 0:
            d_S[(A, B)] += 1
            d_T[(B, -A)] += 0
        # 片方がマイナスの場合、必ずAがマイナスになるよう揃える
        else:
            if A > B:
                A, B = B, A
            d_S[(-A, B)] += 0
            d_T[(B, A)] += 1

ans = 1
for (si, sj), s_cnt in d_S.items():
    t_cnt = d_T[(sj, -1*si)]
    tmp = 0
    tmp += pow2_mod[s_cnt] - 1 # Sから1匹以上選ぶ組合せ
    tmp += pow2_mod[t_cnt] - 1 # Tから1匹以上選ぶ組合せ
    tmp += 1 # どちらも選ばない組合せ
    ans = (ans * tmp)%MOD

ans -= 1 # 最終的に1匹も選ばない組合せ
ans += zeros # (0, 0)のイワシの数

print(ans%MOD)

### FIXED CODE ###

# E - ∙ (Bullet)
import sys
from collections import defaultdict

readline = sys.stdin.readline
MOD = 1000000007
N = int(readline())

# イワシの傾きをA/Bとする。
# A/Bは予めgcdで割って約分し、同じ傾きのものを揃えておく。
# このとき、仲の悪い組合せは(A, B)に対して(B, -A)となるもの。 
# 前者をS、後者をTとして考える。
d_S = defaultdict(int)
d_T = defaultdict(int)

def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y%x, x)

zeros = 0
for i in range(N):
    A, B = map(int, readline().split())
    # (0, 0)のイワシは他の全てのイワシと仲が悪いため、
    # 1匹のみでしか選ぶことができない。最後にこの数を足す。
    if A == 0 and B == 0:
        zeros += 1
    # (?, 0),(0, ?)のイワシは、?がどのような数字であろうとも
    # この組合せであれば仲が悪い。一律、(1,0)(0,-1)として考える。
    elif A == 0:
        d_S[(1, 0)] += 0
        d_T[(0, -1)] += 1
    elif B == 0:
        d_S[(1, 0)] += 1
        d_T[(0, -1)] += 0
    else:
        g = gcd(A, B)
        A //= g
        B //= g
        # いずれもマイナスの場合、傾きはプラスになる
        if A < 0 and B < 0:
            A *= -1
            B *= -1
        if A * B > 0:
            d_S[(A, B)] += 1
            d_T[(B, -A)] += 0
        # 片方がマイナスの場合、必ずAがマイナスになるよう揃える
        else:
            if A > B:
                A, B = B, A
            d_S[(-A, B)] += 0
            d_T[(B, A)] += 1

ans = 1
for (si, sj), s_cnt in d_S.items():
    t_cnt = d_T[(sj, -1*si)]
    tmp = 0
    tmp += pow(2, s_cnt, MOD) - 1
    tmp += pow(2, t_cnt, MOD) - 1
    tmp += 1
    ans = (ans * tmp)%MOD

ans -= 1
ans += zeros

print(ans%MOD)
s=list(input())
t=list(input())
dp=[[0]*(30) for j in range(30)]
ans=[]
memo=-1
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
             dp[i+1][j+1] = dp[i][j]+1
             if memo < i:
                 ans.append(t[j])
                 memo = i

        else:
            dp[i+1][j+1] =max(dp[i][j+1],dp[i+1][j])

#print(dp[len(s)][len(t)])
answer=[]
i,j=len(s),len(t)
d=dp[i-1][j-1]
while i!=0 and j!=0:
    if dp[i-1][j-1]!=dp[i][j]:
        answer.append(s[i-1])
        i-=1
        j-=1
    elif dp[i-1][j]==dp[i][j]:
        i-=1
    else:
        j-=1
print("".join(reversed(answer)))

### FIXED CODE ###

s=list(input())
t=list(input())
dp=[[0]*(3030) for j in range(3030)]
ans=[]
memo=-1
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
             dp[i+1][j+1] = dp[i][j]+1
             if memo < i:
                 ans.append(t[j])
                 memo = i

        else:
            dp[i+1][j+1] =max(dp[i][j+1],dp[i+1][j])

#print(dp[len(s)][len(t)])
answer=[]
i,j=len(s),len(t)
d=dp[i-1][j-1]
while i>=0 and j>=0:

    if dp[i-1][j]==dp[i][j]:
        i-=1
    elif dp[i][j-1]==dp[i][j]:
        j-=1
    else:
        answer.append(s[i - 1])
        i -= 1
        j -= 1
print("".join(reversed(answer)))
a,b,c = int(input().split())
ans = 0
for i in range(c):
    b = b - a
    if b < 0:
        break
    ans += 1

print(c)

### FIXED CODE ###

a,b,c = map(int, input().split())
d = b // a
print(min(d,c))
import math
import functools
import operator

def prime_factorization_2(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = {}
        for prime in prime_list:
            while num % prime == 0:
                if prime in dict_counter:
                    dict_counter[prime] += 1
                else:
                    dict_counter[prime] = 1
                num //= prime
        if num != 1:
            if num in dict_counter:
                dict_counter[num] += 1
            else:
                dict_counter[num] = 1

        return dict_counter

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]



n,p=map(int,input().split())
if n>=p:
    print(1)
elif n==1:
    print(p)
else:
    pdic=prime_factorization_2(p)
    plist=[]
    plsit2=[]
    for k in pdic:
        plist.append(k)

    for i in range(len(plist)):
        value=int(pdic[plist[i]])
        if value>=n:
            tmp=value//n
            plsit2.append(plist[i]*tmp)
result = functools.reduce(operator.mul, plsit2)
print(result)

### FIXED CODE ###

import math
import functools
import operator

def prime_factorization_2(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = {}
        for prime in prime_list:
            while num % prime == 0:
                if prime in dict_counter:
                    dict_counter[prime] += 1
                else:
                    dict_counter[prime] = 1
                num //= prime
        if num != 1:
            if num in dict_counter:
                dict_counter[num] += 1
            else:
                dict_counter[num] = 1

        return dict_counter

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]



n,p=map(int,input().split())
if n>=p:
    print(1)
elif n==1:
    print(p)
else:
    pdic=prime_factorization_2(p)
    plist=[]
    plsit2=[]
    result=1
    for k in pdic:
        plist.append(k)

    for i in range(len(plist)):
        value=int(pdic[plist[i]])
        if value>=n:
            tmp=value//n
            plsit2.append(plist[i]**tmp)
    for i in plsit2:
        result=result*i        
 
    
    print(result)
x, y = map(int, input())
if (y-x) > =x:
  print "Yes"
else:
  print "No"

### FIXED CODE ###

x, y = map(int, input().split())
if y%2 == 1:
  print("No")
  exit()
b = y//2 -x
a = x - b
if (a >= 0) & (b >= 0):
  print("Yes")
else:
  print("No")
def dfs(node,w):
  weight = w
  for l in tree[node]:
    if color[l[0]] > -1:
      continue
    if l[1]%2 == 0:
      color[l[0]] = color[node]
    else:
      color[l[0]] = int(not color[node])
    dfs(l[0],l[1])
    


N = int(input())
tree = {}
color = [-1]*(N+1)

for i in range(1,N+1):
  tree[i] = []
for i in range(N-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])
  
color[1] = 0
dfs(1,0)
color = [c  if c>-1 else 0 for c in color]
print('\n'.join(map(str,color[1:])))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100001)

def dfs(node,w):
  weight = w
  for l in tree[node]:
    if color[l[0]] > -1:
      continue
    if l[1]%2 == 0:
      color[l[0]] = color[node]
    else:
      color[l[0]] = int(not color[node])
    dfs(l[0],l[1])
    


N = int(input())
tree = {}
color = [-1]*(N+1)

for i in range(1,N+1):
  tree[i] = []
for i in range(N-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])
  
color[1] = 0
dfs(1,0)
color = [c  if c>-1 else 0 for c in color]
print('\n'.join(map(str,color[1:])))
h,w = map(int,input().split())
s = [input() for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            if s[i-1][j]=='#' or s[i+1][j]=='#' or s[i][j-1]=='#' or s[i][j+1]=='#':
                continue
            else:
                print('No')
                exit()
print('Yes')

### FIXED CODE ###

h,w = map(int,input().split())
s = ['.'*(w+2)]+['.'+input()+'.' for _ in range(h)]+['.'*(w+2)]
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j]=='#':
            if s[i-1][j]=='#' or s[i+1][j]=='#' or s[i][j-1]=='#' or s[i][j+1]=='#':
                continue
            else:
                print('No')
                exit()
print('Yes')
import math

num = [input() for _ in range(5)]
num2 = sorted([list(i)[-1] for i in num],reverse = False)

num3 = [n for n in num2 if n != "0" ]



C = 0

for i in num:
	j = list(i)[-1]
  
	if j == num3[0]:
		C += int(i)
		
        
        
	else:
		if int(j) >= 5 or int(j) == 0:
			C += round(int(i),-1)
			#print(round(C))
			
                  
		elif 0< int(j) < 5:
			C += round(int(i),-1)+10	
		#	print(round(C))


print(C)

### FIXED CODE ###

num = [int(input()) for _ in range(5)]
num2 = [n if n % 10 == 0 else n - (n%10) + 10  for n in num]

c = []
for i, j  in enumerate(num):
    n = j
    for k,l in enumerate(num2):
        if  k == i:
            continue
        else:
            n += l
    c.append(n)

print(int(min(c)))
n = input()
a_list = input().split(" ")

def count_divide(number, max_cnt=-1):
  count = 0
  mod = -1
  while mod != 1:
    q, mod = divmod(number, 2)
    if mod == 1:
      return count
    count += 1
    if max_cnt != -1 and count >= max_cnt:
      return max_cnt
    number = q
  return count

result = -1
for a in a_list:
  result = count_divide(int(a), result)
print(result)


### FIXED CODE ###

in_str = input()
count = 0
for ch in in_str:
  if ch == "1":
    count += 1
print(count)
s=input()
ans=[]
for i in range(len(s)-2):
    ans = min(ans , abs(753-int(s[i:i+3])))
print(min(ans))

### FIXED CODE ###

s=input()
ans=999
for i in range(len(s)-2):
    ans = min(ans , abs(753-int(s[i:i+3])))
print(ans)
import numpy as np
ins = [int(input()) for _ in range(5)] 

times = []
for num in ins:
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    #print(num)

tmp = np.asarray(ins) % 10
tmp = tmp[tmp >= 1]
yobun = np.min(tmp)

if yobun == 0:
    yobun = 10

all_time = np.sum(times) - (10-yobun)
print(all_time)

### FIXED CODE ###


times = []
#for num in ins:
tmp = []
for _ in range(5):
    num = int(input())
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    tm = num % 10
    if tm >= 1:
        tmp.append(tm)
    #print(num)

if len(tmp) == 0:
    tmp = [0]

yobun = min(tmp)
if yobun == 0:
    yobun = 10

all_time = sum(times) - (10-yobun)
print(all_time)
# input
N = int(input())
A = list(map(int, input().split()))

l, r, sum, ans = 0, 0, 0, 0
 
while r < N:
    if num + A[r] == num ^ A[r]:
        num += A[r]
        ans += r - l + 1
        r += 1
    else:
        num -= A[l]
        l += 1
 
print(ans)

### FIXED CODE ###

# input
N = int(input())
A = list(map(int, input().split()))

l, r, sum, ans = 0, 0, 0, 0
 
while r < N:
    if sum + A[r] == sum ^ A[r]:
        sum += A[r]
        ans += r - l + 1
        r += 1
    else:
        sum -= A[l]
        l += 1
 
print(ans)
n,m=map(int,input().split())
if n==1:
        print(m)
else:
        max=1
        for i in range(1,m//n+1):
        if m%i==0:
                max=i
        print(max)

### FIXED CODE ###

import math

n,m=map(int,input().split())
if n==1:
        print(m)
else:
        l=[]
        for i in range(1,math.floor(m**0.5)+1):
           if m%i==0 and i<=m//n:
                l.append(i)
                if m//i<=m//n:
                        l.append(m//i)
        l.sort()
        print(l[-1])
n = int(input())
r = 1
for i in range(n):
	r = r * (i + 1)
r = r / (10**9 + 7)
print(r)

### FIXED CODE ###

n = int(input())
r = 1
for i in range(n):
	r = (r * (i + 1)) % (10**9 + 7)
print(r)
x=int(input())
if x == 7 or x == 5 or x == 3:
print("YES")
else:
print("NO")

### FIXED CODE ###

x=int(input())
if x == 7 or x == 5 or x == 3:
	print("YES")
else:
	print("NO")
n, p = map(int,input().split())
D = input()
count = [0] * p
out = 0

if 10 % p == 0:
    for i in range(n):
        if int(D[i]) % p == 0:
            out += i + 1
else:
    ten = 1
    count[0] = 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * ten) % p
        count[mod] += 1
        ten *= 10
    for c in count:
        out += (c * (c - 1)) // 2
print(out)

### FIXED CODE ###

n, p = map(int,input().split())
D = input()
out = 0


if 10 % p == 0:
    for i in range(n):
        if int(D[i]) % p == 0:
            out += i + 1
else:
    mod = 0
    count = [0] * p
    ten = 1
    count[mod] += 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * ten) % p
        ten = ten * 10 % p
        count[mod] += 1
    for c in count:
        out += (c * (c - 1)) // 2
print(out)
import numpy as np
n = int(input())

factor_a = 0
for i in reversed(range(1, int(np.sqrt(n)))):
    if n % i == 0:
       factor_a = i
       break

factor_b = n // factor_a

print(factor_a - 1 + factor_b - 1)

### FIXED CODE ###

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

factor_a = 0
for i in range(1, int(np.sqrt(n)) + 1):
    if n % i == 0:
       factor_a = i
       
factor_b = n // factor_a

#print(factor_a)
#print(num, factor_b)
print(factor_a - 1 + factor_b - 1)
if A[0] >= 1:
  print(-1)
else:
  print(1)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)

if A[0] >= 2:
  print(-1)
  exit()

ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)
import re
import numpy as np

H,W,K = map(int,input().split())
grid = []
for i in range(H):
  S = input()
  grid.append( [S[i] for i in range(W) ])
grid = np.array(grid,dtype='int64')

min_cnt = 1000*10+1
#横の区切りを作る
for j in range(2**(H-1)):
  cnt = 0
  #二進数の文字列を取得
  bin_str = format(j,"0{}b".format(H-1)) 
  #区切りのインデックスリスト
  l_p =[0]+[ x.start()+1 for x in re.finditer("1",bin_str) ] +[H]

  #cntに区切りの分だけ付け加える
  cnt = cnt + len(l_p)-2
  
  #決めた行の区切りに対して、列ごとの和の配列を取得
  L = np.empty((0,W),int)
  for i in range(len(l_p)-1):
    slice_wa = [np.sum(grid[l_p[i]:l_p[i+1],:],axis=0)]
    L = np.append(L, slice_wa ,axis=0)

  tate = np.zeros( len(l_p)-1 ,dtype='int64')
  for w in range(W):#k以上の要素があるか
    n_tate = tate + L[:,w]
    if True in (n_tate > K):
      cnt = cnt + 1
      tate = np.zeros( len(l_p)-1 ,dtype='int64')+L[:,w]   
    else:
      tate = n_tate
  min_cnt = min(cnt,min_cnt)   
###
print(min_cnt)

### FIXED CODE ###

import re

H,W,K = map(int,input().split())
grid = [[0 for i in range(W+1)]]
for i in range(H):
  S = input()
  grid.append([0]+[ int(S[i]) for i in range(W) ])

#累積和gridの作成
#行について
for i in range(H+1):
  for j in range(W):
    grid[i][j+1] += grid[i][j]
#列について
for j in range(W+1):
  for i in range(H):
    grid[i+1][j] += grid[i][j]   

min_cnt = (H-1)*(W-1)
#横の区切りを作る
for h in range(2**(H-1)):
  cnt = 0
  #二進数の文字列を取得
  bin_str = format(h,"0{}b".format(H-1)) 
  #区切りのインデックスリスト
  l_p =[1]+[ x.start()+2 for x in re.finditer("1",bin_str) ] +[H+1]

  #cntに区切りの分だけ付け加える
  cnt = cnt + len(l_p) - 2
  
  ws = 0
  for w in range(1,W+1):
    for k in range(len(l_p)-1):
      if grid[l_p[k+1]-1][w]-grid[l_p[k+1]-1][w-1] > K:
        min_cnt=(H-1)*(W-1)+1
      if grid[l_p[k+1]-1][w]- (grid[l_p[k]-1][w]+grid[l_p[k+1]-1][ws]-grid[l_p[k]-1][ws]) > K:
        cnt = cnt + 1
        ws = w-1
        break    
  min_cnt = min(min_cnt,cnt)

###
print(min_cnt)