Harryxun/stf_run huggingface dataset:
A, B, C, D = input()

op = ['+', '-']

for i in op:
    tmp = A + i + B
    for j in op:
        tmp += j + C
        for k in op:
            tmp += k + D
            if eval(tmp) == 7:
                print(tmp + '=7')
                exit()

### FIXED CODE ###

def main():
    A = list(map(int,str(input())))

    s1 = "+"
    s2 = "+"
    s3 = "+"    

    if A[0] + A[1] + A[2] + A[3] == 7:
        s1 = "+"
        s2 = "+"
        s3 = "+"
    elif A[0] + A[1] + A[2] - A[3] == 7:
        s1 = "+"
        s2 = "+"
        s3 = "-"
    elif A[0] + A[1] - A[2] + A[3] == 7:
        s1 = "+"
        s2 = "-"
        s3 = "+"
    elif A[0] - A[1] + A[2] + A[3] == 7:   
        s1 = "-"
        s2 = "+"
        s3 = "+"
    elif A[0] + A[1] - A[2] - A[3] == 7:   
        s1 = "+"
        s2 = "-"
        s3 = "-"
    elif A[0] - A[1] + A[2] - A[3] == 7:   
        s1 = "-"
        s2 = "+"
        s3 = "-"
    elif A[0] - A[1] - A[2] + A[3] == 7:   
        s1 = "-"
        s2 = "-"
        s3 = "+"
    elif A[0] - A[1] - A[2] - A[3] == 7:   
        s1 = "-"
        s2 = "-"
        s3 = "-"

    print(str(A[0]) + s1 + str(A[1]) + s2 + str(A[2]) + s3 + str(A[3]) + "=7")


if __name__ == "__main__":
    main()
N,P = map(int,input().split())
i = 2
table = []
while i * i <= P:
  while P % i == 0:
    P /= i
    table.append(i)
  i += 1
if P > 1:
  table.append(P)
            
c = Counter(table)
temp = [i[0] for i in c.items() if i[1] >= N]
if temp == []:
  temp.append(1)
print(int(reduce(lambda x,y:x*y,temp)))

### FIXED CODE ###

N,P = map(int,input().split())
i = round(P**(1/N))
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  for i in range(i,0,-1):
    if P%i**N==0:
      print(i)
      break
import asyncio


async def main(input: list):
    possible575 = sorted(input) == [5, 5, 7]
    print(possible575)


input = list(map(int, input().split()))
asyncio.run(main(input))


### FIXED CODE ###

def main(input: list):
    possible575 = sorted(input) == [5, 5, 7]
    print("YES" if possible575 else "NO")


input = list(map(int, input().split()))
main(input)
N, K = map(int, input().split())
A_list = list(map(int, input().split()))
tmp = [1] * (N+1)

for i in range(K, N+1):
    tmp[i] = sum(A_list[i-K:i])

for i in range(K+1, K+1+N-K):
    if tmp[i] > tmp[i-1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

X = int(input())

if 400 <= X <=599:
    print(8)
elif 600 <= X <= 799:
    print(7)
elif 800 <= X <= 999:
    print(6)
elif 1000 <= X <= 1199:
    print(5)
elif 1200 <= X <= 1399:
    print(4)
elif 1400 <= X <= 1599:
    print(3)
elif 1600 <= X <= 1799:
    print(2)
elif 1800 <= X <= 1999:
    print(1)
N,K = map(int,input().split())
mod_num = 10**9+7

ans = N-K+1
ans %= mod_num
print(ans)

for i in range(1,K):
    if N-K+1-i>0:
        ans = ans*(K-i)*(N-K+1-i)%mod_num   
        ans = ans*pow(b,mod_num-2)%mod_num
        print(ans)
    else:
        print(1)


### FIXED CODE ###

N,K = map(int,input().split())
mod_num = 10**9+7

def mul(a,b):
    return ((a % mod_num) * (b % mod_num)) % mod_num

def power(x,y):
    if y==0:                 
        return 1     
    elif y==1:                    
        return x % mod_num
    elif y%2 == 0:
        return power(x, y//2)**2 % mod_num
    else:
        return power(x, y//2)**2 * x % mod_num
    
def div(a,b):
    return mul(a, power(b, mod_num-2))


ans = N-K+1
ans %= mod_num
print(ans)

for i in range(1,K):
    if N-K+1-i>0:
        ans = mul(ans,K-i)
        ans = mul(ans,N-K+1-i)
        ans = div(ans,i)
        ans = div(ans,i+1)
        print(ans)
    else:
        print(0)
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5+1))] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s-1] = 1
	arr[ch-1][t] = -1

for i in range(c):
	for j in range(1,(10**5+1)):
		arr[i][j] += arr[i][j-1]



ans = 0
for i in range(((10**5+1))):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans



### FIXED CODE ###

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

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)
N=int(input())
S=input()
print(S.count('ABC'))

### FIXED CODE ###

a,b = map(int,input().split())
sum=int(a)*500
if sum>=b:
    print("Yes")
else:
    print("No")
print(input().lower().replace("a","T").replace("t","A")replace("c","G")replace("g","C"))

### FIXED CODE ###

print({"A":"T","T":"A","G":"C","C":"G"}[input()])
N = int(input())
X = list(map(int, input().strip().split()))
total = 0
points = 0 
for i in X:
  total += i
avg = int(round(total/N))
for i in X:
  points += (a-avg)^^2
print(points)

### FIXED CODE ###

N = int(input())
X = list(map(int, input().strip().split()))
total = 0
points = 0
for i in X:
  total += i
avg = int(round(total/N))
for i in X:
  points += (i-avg)**2
print(points)
N = int(input())
cnt = 0
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
N1_yakusu = make_divisors(N-1)
N_yakusu = make_divisors(N)
cnt += len(N1_yakusu)
for s in N_yakusu:
    new_N = s
    while(new_N%K==0):
        new_N = new_N//K
    if(new_N%K == 1):
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
cnt = 0
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.pop(0)
    return divisors
N1_yakusu = make_divisors(N-1)
N_yakusu = make_divisors(N)
cnt += len(N1_yakusu)
for K in N_yakusu:
    new_N = N
    while(new_N%K==0):
        new_N = new_N//K
    if(new_N%K == 1):
        cnt += 1
print(cnt)
#bA
import collections
N = int(input())
S = [input() for i in range(N)]
s = collections.Counter(S) #出現回数をまとめた辞書型作成

maximum = max(S.values())
list = sorted(key for key,value in s.items() if value==maximum)
#sを利用して、出現回数が最大のものを辞書順に並べたリストを作成

for i in list:
    print(i)

### FIXED CODE ###

#bA
import collections
N = int(input())
S = [input() for i in range(N)]
s = collections.Counter(S) #出現回数をまとめた辞書型作成

maximum = max(s.values()) #
list = sorted(key for key,value in s.items() if value==maximum)
#sを利用して、出現回数が最大のものを辞書順に並べたリストを作成

for i in list:
    print(i)
from collections import defaultdict
d = defaultdict(int)
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
     'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

S = input()
if S == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
    exit()

if len(S) < 26:
    for x in S:
        d[x] += 1
    for x in a:
        if d[x] == 0:
            print(S+x)
            exit()
else:
    b = 25
    for i in range(24, 0, -1):
        if S[i] > S[i+1]:
            b = i-1
            break
    ss = sorted(list(S[b-1:]))
    t = S[b-1]
    print(S[:b-1] + ss[ss.index(t)+1])


### FIXED CODE ###

from collections import defaultdict
d = defaultdict(int)
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
     'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

S = input()
if S == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
    exit()

if len(S) < 26:
    for x in S:
        d[x] += 1
    for x in a:
        if d[x] == 0:
            print(S+x)
            exit()
else:
    i = 25
    while S[i-1] > S[i]:
        i -= 1
    ss = sorted(list(S[i-1:]))
    t = S[i-1]
    print(S[:i-1] + ss[ss.index(t)+1])
list = map(int,raw_input().split())
ilst.sort()
for i in list :
     print(i)

### FIXED CODE ###

list = map(int,raw_input().split())
list.sort()
print'%d %d %d' %(list[0],list[1],list[2])
# Binary Search

def isOK(i, key):
    '''
    問題に応じて返り値を設定
    '''
    cnt = 0
    for v in a:
        cnt += (v + i - 1) // i - 1

    return cnt <= key


def binary_search(key):
    '''
    条件を満たす最小/最大のindexを求める
    O(logN)
    '''
    ok = 10 ** 9  # 条件を満たすindexの上限値/下限値
    ng = -1       # 条件を満たさないindexの下限値-1/上限値+1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2

        if isOK(mid, key):  # midが条件を満たすか否か
            ok = mid
        else:
            ng = mid
    
    return ok


n, k = map(int, input().split())
a = list(map(int, input().split()))
 
print(binary_search(k))

### FIXED CODE ###

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

hi = 10 ** 9
lo = 0
while hi - lo > 1:
    mid = (hi + lo) // 2

    cnt = 0
    for v in a:
        cnt += (v + mid - 1) // mid - 1

    if cnt <= k:
        hi = mid
    else:
        lo = mid

print(hi)
X, K, D = list(map(int,input().rstrip().split()))
X = abs(X)
a = X//D
if K <= a:
    print(abs(X-(D*K)))
elif (K-a)a%2 == 0:
    print(abs(X-(D*a)))
else:
    print(abs(D*(a+1)-X))

### FIXED CODE ###

X, K, D = list(map(int,input().rstrip().split()))
X = abs(X)
a = X//D
if K <= a:
    print(abs(X-(D*K)))
elif (K-a)%2 == 0:
    print(abs(X-(D*a)))
else:
    print(abs(D*(a+1)-X))
from collections import defaultdict
n, m = map(int, input().split())
nums = sorted([int(i) for i in input().split()])[::-1]

d = defaultdict(int)

for _ in range(m):
    b, c = map(int, input().split())
    d[c] += b


new_list = []
cnt = 0
for c, b in sorted(d.items(), key=lambda x: -x[0]):
    new_list += [c] * b
    cnt += b
    if cnt > n:
        break
tmp = sorted(nums + new_list)[::-1]
print(sum(tmp[:n]))


### FIXED CODE ###

# from collections import defaultdict
# n, m = map(int, input().split())
# nums = [int(i) for i in input().split()]
#
# num_freq = defaultdict(int)
#
# for _ in range(m):
#     b, c = map(int, input().split())
#     num_freq[c] += b
#
#
# new_list = []
# for num, freq in sorted(num_freq.items(), key=lambda x: -x[0]):
#     new_list += [num] * freq
#     if len(new_list) >= n:
#         break
# tmp = sorted(nums + new_list)[::-1]
# print(sum(tmp[:n]))

# ↑と同じ処理なのに↑のはREになる
n, m = map(int, input().split())
nums = list(map(int, input().split()))
exc = []

for i in range(m):
    exc.append(list(map(int, input().split())))
exc.sort(key=lambda x: x[1], reverse=True)
e = []
count = 0
for i in range(m):
    freq = exc[i][0]
    e += [exc[i][1]] * freq
    count += freq
    if count >= n:
        break
cards = sorted(nums + e, reverse=True)
print(sum(cards[:n]))
a = list(map(int,input().split()))
x = a[0]
y = a[1]

n = a[0]
count = 0

while n <= y:
  n = n << 1
  count += 1
  
print(str(count))

### FIXED CODE ###

s = input()
t = input()

go = []
back = []
g = []
b = []
def has_duplicates(seq):
    return len(seq) != len(set(seq))


for i in range(len(s)):
  go.append(s[i]+t[i])
  back.append(t[i]+s[i])

go_l = set(go)
back_l = set(back)
go = list(go_l)
back = list(back_l)

#print(go)
#print(back)

for i in range(len(go)):
  g.append(go[i][0])
  b.append(back[i][0])
  
#print(g)
#print(b)
  
ansg = has_duplicates(g)
ansb = has_duplicates(b)

if ansg == True or ansb == True:
  print("No")
else:
  print("Yes")
alphabet = list("ABCDEFGHRJKLMNOPQRSTUVWXYZ")
n = int(input())
s = input()
for i in s:
  #print(i, alphabet.index(i))
  print(alphabet[(alphabet.index(i)+n) % 26], end='')

### FIXED CODE ###

alphabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
S = input()
for i in S:
  print(alphabet[(alphabet.index(i)+N) % 26], end='')
N = list(input())

N.reverse()

ans = 0
flag = False
L = len(N)
for i,s in enumerate(N):
    n = int(s)
    
    if flag:
        n += 1
    
    if n<5:
        ans += n
        flag = False
    elif n>5:
        ans += 10-n
        flag = True
    else:
        if i==L-1:
            ans += n
            flag = False
            
        if int(N[i+1])<5:
            ans += n
            flag = False
        else:
            ans += 10-n
            flag = True

if flag:
    ans += 1
    
print(ans)
        
        
    
    

### FIXED CODE ###


N = list(input())

N.reverse()

ans = 0
flag = False
L = len(N)
for i,s in enumerate(N):
    n = int(s)
    
    if flag:
        n += 1
    
    if n<5:
        ans += n
        flag = False
    elif n>5:
        ans += 10-n
        flag = True
    else:
        if i==L-1:
            ans += n
            flag = False
            break
            
        if int(N[i+1])<5:
            ans += n
            flag = False
        else:
            ans += 10-n
            flag = True

if flag:
    ans += 1
    
print(ans)
A = int(input())
B = int(input())

print(int(A*B))

### FIXED CODE ###

A,B = input().split()
A = int(A)
B = int(B)
print(A*B)
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aot = []
i, j = 0, 0
while sum(aot) <= k:


  if len(a) > 0 and len(b) > 0:
    if a[i] >= b[j]:
      aot.append(b[j])
      del b[j]
      #print('aは{}, bは{}'.format(a, b))
    elif a[i] <= b[j]:
      aot.append(a[i])
      del a[i]
      #print('aは{}, bは{}'.format(a, b))
      
  elif len(a) == 0:
    aot.append(b[j])
    del b[j]
  elif len(b) == 0:
    aot.sppend(a[i])
    del a[i]
  
if sum(aot) > k:
  del aot[-1]
print(len(aot))


### FIXED CODE ###

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

A, B = [0], [0]

for i in range(n):
  A.append(a[i] + A[i])
for i in range(m):
  B.append(b[i] + B[i])

ans, j = 0, m
for i in range(n+1):
  if A[i] > k:
    break
  while B[j] > k - A[i]:
    j -= 1
  ans = max(ans, i+j)
print(ans)
int_n = int(input())

bin_number = format(int_n, 'b')

bin_sum = sum(list(map(int, list(str(bin_number)))))

if int_n % bin_sum == 0:
    print("Yes")
else:
    print("No")



### FIXED CODE ###

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

print([i * (100 ** d) for i in range(1, 102) if i != 100][n - 1])
def eratosthenes(n):
 is_p=[1]*n
 p_list=[]

 is_p[0]=0
 is_p[1]=0

 for i in range(2,n):
  if is_p[i]:
   p_list.append(i)
   for j in range(i*i,n,i):
    is_p[j] = 0

# return p_list
 return is_p

q=int(input())

lim=10**2+1
is_p=eratosthenes(lim)

#print(is_p)

b=[0]
for i in range(1,lim+1):
 if is_p[i-1]==1 and is_p[i//2]==1:
  b.append(b[i-1]+1)
 else:
  b.append(b[i-1])

#print(b)

for i in range(q):
 l,r=map(int,input().split())
 print(b[r+1]-b[l])

### FIXED CODE ###

def factorization(n):
 p=2
 fcr=[]
 while p*p<=n:
  while n%p==0:
   fcr.append(p)
   n//=p
  p+=1
 if n>1:
  fcr.append(n)
 return fcr

q=int(input())

cnt=1
p_list=[1]
q_list=[0]
for i in range(3,10**5+1,2):
 a=factorization(i)
 b=factorization((i+1)//2)

 if len(a)==len(b)==1:
  cnt+=1
  q_list.append(1)
 else:
  q_list.append(0)

 p_list.append(cnt)

for i in range(q):
 l,r=map(int,input().split())

 c=p_list[r//2]-p_list[l//2]
 if q_list[l//2]==1:
  print(c+1)
 else:
  print(c)
N = int(input())
if N<10:
    print(N)
elif N<100:
    prnt(9)
elif N<1000:
    print(N-90)
else:
    print(90909)


### FIXED CODE ###

N = int(input())
if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(N-90)
elif N < 10000:
    print(909)
elif N < 100000:
    print(N - 9090)
else:
    print(90909)
N, K = map(int,input().split())
print(K*(K-1)**(N-1))


### FIXED CODE ###

mylist = input().split()
print(len(set(mylist)))
import math
a,b=input().split()
a=int(a)
b=b*100
ans=math.floor(a*b/100)
print(ans)

### FIXED CODE ###

import math
a,b=input().split()
a=int(a)
c=int(b[0]+b[2]+b[3])
print(int(a*c)//100)
#print(a*b)
n=input()
p=1
for i in range(n):
    a=input()
    if a%2:
        p=0
print(['first','second'][p])

### FIXED CODE ###

# coding:utf-8

import sys
from collections import Counter


input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

D = []
for i in range(1, N):
    D.append(A[i] - A[i - 1])

if A[-1] % 2 == 1:
    print('first')
else:
    cnt_e, cnt_o = 0, 0
    for i in range(N - 1):
        if A[i] % 2 == 0:
            cnt_e += 1
        else:
            cnt_o += 1

    if cnt_o > 0:
        print('first')
    else:
        print('second')
import itertools
n,c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
a.sort(key=lambda x:x[2])

# 同じチャンネルの番組を繋げる。
for i in range(n-1):
    if a[i][1]==a[i+1][0] and a[i][2]==a[i+1][2]:
        a[i][1]-=1
# いもす法
x=[0]*(10**5+1)
for i in range(n):
    x[a[i][0]]+=1
    x[a[i][1]+1]-=1

x = itertools.accumulate(x)
print(max(x))

### FIXED CODE ###

import itertools
n,c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
a.sort(key=lambda x:x[2])

# 同じチャンネルの番組を繋げる。
for i in range(n-1):
    if a[i][1]==a[i+1][0] and a[i][2]==a[i+1][2]:
        a[i][1]-=1
# いもす法
x=[0]*(10**5+5)
for i in range(n):
    x[a[i][0]]+=1
    x[a[i][1]+1]-=1

x = itertools.accumulate(x)
print(max(x))
N, K = map(int, input().split())
A = list(map(int, input().split()))


def countMask(a):
    ret = 0
    for x in cand:
        if (x & a) == a:
            ret += 1
    return ret


cand = []
for i in range(N):
    sum = 0
    for j in range(j, N):
        sum += A[j]
        cand.append(sum)

ans = 0

for i in range(40, -1, -1):
    if (countMask(ans | (1 << i)) >= K):
        ans |= 1 << i

print(ans)

### FIXED CODE ###

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


def countMask(a):
    ret = 0
    for x in cand:
        if (x & a) == a:
            ret += 1
    return ret


cand = []
for i in range(N):
    sum = 0
    for j in range(i, N):
        sum += A[j]
        cand.append(sum)

ans = 0

for i in range(40, -1, -1):
    if (countMask(ans | (1 << i)) >= K):
        ans |= 1 << i

print(ans)
s = sorted(list(input()))
t = sorted(list(input()))
ns = len(s)
nt = len(t)
can = True
if(ns<nt):
    for i in range(ns):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
else:
    can = False
    for i in range(nt):
        if(s[i] > t[i]):
            can = False
            break
        if(s[i] < t[i]):
            can = True
            break
if(can):
    print('Yes')
else:
    print('No')
    A



### FIXED CODE ###

s = ''.join(sorted(input()))
t = ''.join(sorted(input(),reverse=True))
if(s<t):
    print('Yes')
else:
    print('No')
N = int(input())
h = list(map(int,input().split()))
L = [0] * (N-1)

for i in range(N-2,-1,-1):
  if h[i] >= h[i+1]:
    L[i+1] = L[i] + 1
    
print(max(L))    

### FIXED CODE ###

N = int(input())
H = [int(x) for x in input().split()]
dp = [0] * len(H) 
for i in range(1, len(H)):
  if H[i-1] >= H[i]: 
    dp[i] = dp[i-1] + 1
ans = max(dp)
print(ans)
s = input()
zero = 0
one = 0

for i in len(s):
    if s[i]=="0":
        zero += 1
    else:
        one += 1
else:
    ans = min(zero,one)*2

print(ans)

### FIXED CODE ###

s = input()
zero = 0
one = 0

for i in range(len(s)):
    if s[i]=="0":
        zero += 1
    else:
        one += 1
else:
    ans = min(zero,one)*2

print(ans)
n=int(input())
a=list(map(int,input().split()))
m=10**9+7
b=[0]*3
ans=1
for i in a:
  ans*=b.count(i)
  ans%=m
  b[b.index(i)]+=1
print(ans%m)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
m=10**9+7
b=[0]*3
ans=1
for i in a:
  ans*=b.count(i)
  ans%=m
  for j in range(3):
    if b[j]==i:
      b[j]+=1
      break
print(ans%m)
N=int(input())
li = list(map(int,input().split()))
num=[0]*N
num_ans=[0]*N

for i in range(max(li)+1):
  num[i]=li.count(i)
  num_ans[i]=(num[i]*(num[i]-1))/2
ans=sum(num_ans)

for k in range(N):
  li2=(li[:k]+li[k+1:])
  num_k = li.count(li[k])
  before=num_k*(num_k-1)/2
  after=(num_k-2)*(num_k-1)/2
  print(int(ans-before+after))

### FIXED CODE ###

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

d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1

s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2

for i in range(N):
    t = d[A[i]]
    print(s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2)
n = int(input())
a = list(map(int, input().split()))
ans = 1
def incr(a,b):
    if a>b:
        return -1
    elif a==b:
        return 0
    else:
        return 1
init = incr(a[0], a[1])
flag = True
for i in range(1, n-1):
    tmp = incr(a[i], a[i+1])
    #print("a[i]=", a[i]," a[i+1]=", a[i+1], " init=", init, " tmp=", tmp)
    if tmp==0:
        tmp = init
    if init*tmp<0 and flag:
        ans += 1
        init = tmp
        flag = False
        #print(i)
        continue
    init = tmp
    flag = True
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 1
incr = None
for i, x in enumerate(a):
    if i==0:
        before = x
        continue
    if incr==None:
        if x > before:
            incr = 1
        elif x < before:
            incr = -1
        before = x
        continue
    if (incr==1)and(x < before):
        ans += 1
        incr = None
    elif (incr==-1)and(x > before):
        ans += 1
        incr = None
    before = x    
print(ans)
def chmin(a, b):
  if (a > b):
    return b

  return a

def chmax(a, b):
  if (a < b):
    return b

  return a

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

dp = [[0] * 10**5 for i in [0] * (N+1)]

for n in range(N):
  for w in range(1, W+1):
    if (w - li[n][0] >= 0):
      dp[n+1][w] = chmax(dp[n+1][w], dp[n][w - li[n][0]] + li[n][1])

    dp[n+1][w] = chmax(dp[n+1][w], dp[n][w])


print(max(max(dp)))

### FIXED CODE ###

def chmin(a, b):
  if (a > b):
    return b

  return a

def chmax(a, b):
  if (a < b):
    return b

  return a

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

dp = [[0] * (10**5+10) for i in [0] * (N+1)]

for n in range(N):
  for w in range(1, W+1):
    if (w - li[n][0] >= 0):
      dp[n+1][w] = chmax(dp[n+1][w], dp[n][w - li[n][0]] + li[n][1])

    dp[n+1][w] = chmax(dp[n+1][w], dp[n][w])


print(max(max(dp)))
MAX = 2*10**5
def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f
s_map = [0 for i in range(MAX+1)]
def solve(n):
    if n == 0:
        return 1
    if s_map[n] > 0:
        return s_map[n]
    s_map[n] = 1 + solve(n % popcount(n))
    return s_map[n]

N = int(input())
X = input()
num_x = int(X, 2)
p_cnt = X.count('1')
amari_p = num_x % (p_cnt+1)
amari_m = num_x % (p_cnt-1)
for i in range(N):
    if X[i] == '0':
        c_p_cnt = p_cnt+1
        amari = amari_p + 2**(N-1-i) % c_p_cnt
    else:
        c_p_cnt = p_cnt - 1
        amari = amari_m - 2**(N-1-i) % c_p_cnt
    print(solve(amari % c_p_cnt))



### FIXED CODE ###

def popcount(x):
    return bin(x).count("1")
def solve(n):
    if n == 0:
        return 0
    return 1+solve(n % popcount(n))

N = int(input())
X = input()
num_x = int(X, 2)
p_cnt = X.count('1')
if p_cnt == 1:
    for i in range(N):
        if X[i] == '1':
            print(0)
        elif i == N-1:
            print(2)
        else:
            print(1)
    exit()
r0_p = num_x % (p_cnt+1)
r0_m = num_x % (p_cnt-1)
for i in range(N):
    if X[i] == '0':
        c_p_cnt = p_cnt+1
        r = (r0_p + pow(2, (N - 1 - i), c_p_cnt)) % c_p_cnt
    else:
        c_p_cnt = p_cnt-1
        if c_p_cnt == 0:
            print(0)
            continue
        r = (r0_m- pow(2, (N - 1 - i), c_p_cnt)) % c_p_cnt
    print(1 + solve(r % c_p_cnt))
N = int(input())
def calc(n):
    if n % 2:
        return 0
    else:
        return a(n//2) + 1

A = [int(a) for a in input().split()]
mi = 9999
for a in A:
    mi = min(mi, calc(a))
print(a)



### FIXED CODE ###

N = int(input())
def calc(n):
    if n % 2:
        return 0
    else:
        return calc(n//2) + 1

A = [int(a) for a in input().split()]
mi = 9999
for a in A:
    mi = min(mi, calc(a))
print(mi)