Harryxun/stf_run huggingface dataset:
S =input()
K =int(input())

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

else:
    S_ans =  0
    cnt = 1
    for i in range(1,len(S)):
        if S[i] == S[i-1]:
            cnt += 1
            if i ==len(S)-1:
                S_ans += cnt//2
        else:
            S_ans += cnt//2
            cnt = 1
    ans =S_ans*K

    if S[0] == S[-1]:
        a, i =1, 1
        while S[0]==S[i]:
            a += 1
            i += 1
        b, i =1, 1
        while S[-1]==S[-1- i]:
            b += 1
            i += 1
    
    ans = ans - (a//2 +b//2 -(a+b)//2)*(K-1)        
    

print(ans) 

### FIXED CODE ###

S =input()
K =int(input())

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

else:
    S_ans =  0
    cnt = 1
    for i in range(1,len(S)):
        if S[i] == S[i-1]:
            cnt += 1
            if i ==len(S)-1:
                S_ans += cnt//2
        else:
            S_ans += cnt//2
            cnt = 1
    ans =S_ans*K

    if S[0] == S[-1]:
        a, i =1, 1
        while S[0]==S[i]:
            a += 1
            i += 1
        b, i =1, 1
        while S[-1]==S[-1- i]:
            b += 1
            i += 1
        ans = ans - (a//2 +b//2 -(a+b)//2)*(K-1)        
    

print(ans)
S = input()
k = input()

if S[0] == '1':
    cnt = 0
    for s in S:
        if s == '1':
            cnt += 1
        else:
            not1 = s
            break
    if k <= cnt:
        print(1)
    else:
        print(not1)
else:
    print(S[0])


### FIXED CODE ###

S = input()
k = int(input())

if S[0] == '1':
    cnt = 0
    for s in S:
        if s == '1':
            cnt += 1
        else:
            not1 = s
            break
    if k <= cnt:
        print(1)
    else:
        print(not1)
else:
    print(S[0])
a

### FIXED CODE ###

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

cnt = 0
for i in range(N):
    if i + 1 == p[i]:
        cnt += 1

if cnt >= N - 2:
    print("YES")
else:
    print("NO")
X,Y = map(int, input().split())

for i in range(X+1):
    for j in range(X+1):
        if int(i) + int(j) < X+1:
            if (((2*i) + (3*j)) == Y) or (((2*j) + (3*i)) == Y):
                print("Yes")
                sys.exit()

print("No")

### FIXED CODE ###

import sys 
X,Y = map(int, input().split())
for i in range(X+1):
    for j in range(X+1):
        if (((2*i) + (4*j)) == Y) or (((2*j) + (4*i)) == Y):
            if (i+j == X):
                print("Yes")
                sys.exit()
print("No")
import math

n, m = list(map(int, input().split()))
s = input()
t = input()

l = n * m // math.gcd(n,m)

a = l // n
b = l // m

for i in range(0, l, a*b):
    if s[i // a] != t[i // b]:
        print(-1)
        break
else:
    print(l)

### FIXED CODE ###

import fractions

n, m = list(map(int, input().split()))
s = input()
t = input()

l = n * m // fractions.gcd(n,m)

a = l // n
b = l // m

for i in range(0, l, a*b):
    if s[i // a] != t[i // b]:
        print(-1)
        break
else:
    print(l)
n=int(input())
def num2alpha(num):
  if num<=26:
    return chr(64+num)
  elif num%26==0:
    return num2alpha(num//26-1)+chr(90)
  else:
    return num2alpha(num//26)+chr(64+num%26)
print(num2alpha(n).lower())
  


### FIXED CODE ###

a=input()
if a.isupper():
    print("A")
else:
    print("a")
N, M = map(int, input().split())

ans = [0]*M

for i in range(N):
    K, *A = map(int, input().split())
    for j in range(K):
        ans[A[j]] = ans[A[j]] + 1

count = 0

for i in range(M):
    if ans[i]==N:
        count = count + 1

print(count)


### FIXED CODE ###

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

ans = [0]*M

for i in range(N):
    K, *A = map(int, input().split())
    for j in range(K):
        ans[A[j]-1] = ans[A[j]-1] + 1

count = 0

for i in range(M):
    if ans[i]==N:
        count = count + 1

print(count)
# -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

rem=k-1
nxt=1
visit=[]
for i in range(k):
    visit.append(nxt)
    nxt=a[nxt-1]
    if nxt in visit:
        break
    rem-=i

if rem==0:
    print(nxt)
else:
    loops=visit[visit.index(nxt):]
    print(loops[(rem-1)%len(loops)])    

### FIXED CODE ###

# -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

rem=k
nxt=1
visit=[]
visit_set=set([])
for i in range(k):
    visit.append(nxt)
    visit_set.add(nxt)
    nxt=a[nxt-1]
    # この判定をやめる
    if nxt in visit_set:
        break
    rem-=1

if rem==0:
    print(nxt)
else:
#    print('-'*60)
#    print('nxt=', nxt)
#    print('rem=', rem)
#    print('visit=', visit)
    
    loops=visit[visit.index(nxt):]
    print(loops[(rem-1)%len(loops)])    
    
#    print('-'*60)
#    print('loops=', loops)
n,a,b=int(input().split())
c=0
for i in range(n+1):
  d=0
  for j in str(i):
    d+=int(j)
  if a<=d<=b:
    c+=1
print(c)

### FIXED CODE ###

n,a,b=(int(x) for x in input().split())
c=0
for i in range(n+1):
  d=0
  for j in str(i):
    d+=int(j)
  if a<=d<=b:
    c+=i
print(c)
import math


def f(xxx):
    return math.factorial(xxx)


arr = list(map(int, input().split()))
n = arr[0]
m = arr[1]
cnt = 0
cnt += int(f(n) / (2 * f(n - 2)))
if m > 1:
    cnt += int(f(m) / (2 * f(m - 2)))
print(int(cnt))

### FIXED CODE ###

inp=input().split()
n=int(inp[0])
m=int(inp[1])
arr=[]
pares=0
impares=0
count=1
nums=0

def binary(arr, menor, mayor, x): 
    if mayor >= menor: 
        med = (mayor + menor) // 2
        if arr[med] == x: 
            return med 

        elif arr[med] > x: 
            return binary(arr, menor, med - 1, x) 
  
        else: 
            return binary(arr, med + 1, mayor, x) 
    else: 
        return -1

while len(arr)<(m+n):
    if count%2==0 and pares<n:
        arr.append(count)
        pares+=1
    elif count%2!=0 and impares<m:
        arr.append(count)
        impares+=1
    count+=1
sums=[]


for x in arr:
   for y in arr:
        if(x+y)%2==0 and binary(sums, 0, len(sums)-1, [y,x])==-1 and x!=y:
            sums.append([x,y])
            nums+=1
print(nums)
import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop

def main():
    N, K = map(int, readline().rstrip().split())
    V = list(map(int, readline().rstrip().split()))
    V_rev = V[::-1]
    res = 0
    for x in range(K+1):
        for y in range(K-x+1):
            z = K - x - y
            if z > x + y:
                continue
            temp = V[:x] + V_rev[:y]
            heapify(temp)
            for _ in range(z):
                heappop(temp)

            res = max(res, sum(temp))
    
    print(res)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop

def main():
    N, K = map(int, readline().rstrip().split())
    V = list(map(int, readline().rstrip().split()))
    V_rev = V[::-1]
    res = 0
    for x in range(min(N, K)+1):
        for y in range(min(N, K)-x+1):
            z = K - x - y
            temp = V[:x] + V_rev[:y]
            heapify(temp)
            for _ in range(z):
                if temp:
                    m = heappop(temp)
                    if m >= 0:
                        heappush(temp, m)
                        break
                else:
                    break

            res = max(res, sum(temp))
    
    print(res)


if __name__ == '__main__':
    main()
print(sum([x % 2 for x in input().split()[::2]))

### FIXED CODE ###

input()
print(sum([int(x) % 2 for x in input().split()[::2]]))
S = input()
 
if S = 'ABC':
    print('ARC')
else:
    print('ABC')

### FIXED CODE ###

S = input()
 
if S == 'ABC':
    print('ARC')
else:
    print('ABC')
from collections import deque

def solve():
    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 = 0
    j = M

    for i in range(len(A)):
        if a[i] > K:
            break
        while b[j] < K - a[i]:
            j -= 1
        ans = max(ans, i+j)
    
    print(ans)
            
solve()

### FIXED CODE ###

from collections import deque
 
def solve():
    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 = 0
    j = M
 
    for i in range(len(a)):
        if a[i] > K:
            break
        while b[j] > K - a[i]:
            j -= 1
        ans = max(ans, i+j)
    
    print(ans)
            
solve()
W,H,x,y,r = map(int, raw_input().split(' '))
if r <= x <= W-r and r <= y <= H-r:
print "Yes"
else:
print "No"

### FIXED CODE ###

W,H,x,y,r = map(int, input().split())
if r <= x <= W-r and r <= y <= H-r:
    print ('Yes')
else:
    print ('No')
N = int(input())

sum=0
while(1):
    sum=sum+(N%10)
    N=int(N/10)
    #print("sum")
    #print(sum)
    #print("N")
    #print(N)
    if N==0:
        break

if sum%9==0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

N = int(input())
if digitSum(N)%9==0:
    print("Yes")
else:
    print("No")
modulo=10**9+7
n, m=map(int, input().split())
a_list=[]
for i in range(m):
    a=int(input())
    a_list.append(a)
dp=[0 for i in range(n+1)]#0~n
dp[0]=1
if a_list[0]==1:
    dp[1]=0
else:
    dp[1]=1

for i in range(2, n+1):
    if not i in a_list:
        dp[i]=dp[i-2]+dp[i-1]
print(dp[n]%modulo)


### FIXED CODE ###

modulo=10**9+7
n, m=map(int, input().split())
a_list=[]
for i in range(m):
    a=int(input())
    a_list.append(a)
a_list.append(-1)
dp=[0 for i in range(n+1)]#0~n
dp[0]=1
if a_list[0]==1:
    dp[1]=0
    j=1
    for i in range(2, n+1):#10^5
        if i!=a_list[j]:
            dp[i]=(dp[i-2]+dp[i-1])%modulo
        else:
            j=j+1
else:
    dp[1]=1
    j=0
    for i in range(2, n+1):#10^5
        if i!=a_list[j]:
            dp[i]=(dp[i-2]+dp[i-1])%modulo
        else:
            j=j+1

print(dp[n]%modulo)
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d = [None for i in range(4)]
d[0] = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d[1] = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)
d[2] = abs(x-w*0.5)
d[3] = abs(y-h*0.5)

if int(w-2*x)==0 and int(h-2*y)==0:
  print(w*h/2.0, 1)
  exit()
elif int(w-2*x)==0 or int(h-2*y)==0:
  print(w*h/2.0, 0)
  exit()

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d.index().min(d) == 0:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5, 0)
    else:
      print(w*(h-b)*0.5, 0)
elif d.index().min(d) == 1:
  if int(d[0]-d[1]) == 0:
    casenum = 1
  else:
    casenum = 0
    
  if x > 0.5*w:
    if  y > -h/w*x+h:
      print(w*(-(y-h)*w/x)*0.5, casenum)
    else:
      print(h*x*h/(h-y)*0.5, casenum)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > -h/w*x+h:
      print(h*(w-(b-h)*x/(y-h))*0.5, casenum)
    else:
      print(w*(h-b)*0.5, casenum)
elif d.index().min(d) == 2:
  if y > 0.5*h:
    b = w*y/(w-2*x)
    x1=(x-0.5*w)/y*(b-h)
    if x > 0.5*w:
      print(h*(0.5*w+w-x1)*0.5, 0)
    else:
      print(h*(0.5*w+0.5*w-x1)*0.5, 0)
  else:
    b = h - 0.5*w*y/(x-0.5*w)
    x1=b*y/(0.5*w-x)
    if x > 0.5*w:
      print(0.5*h(0.5*w+w-x1), 0)
    else:
      print(0.5*h(0.5*w+0.5*w-x1), 0)    
elif d.index().min(d) == 3:
  if int(d[2]-d[3]) == 0:
    casenum = 1
  else:
    casenum = 0
  if x > 0.5*w:
    if y > 0.5*h:
      print(0.5*w*(0.5*h+h-(y-0.5*h)/x*w+0.5*h), casenum)
    else:
      print(0.5*w*(0.5*h+0.5*h-(y-0.5*h)/x*w+0.5*h), casenum)
  else:
    if y > 0.5*h:
      print(0.5*w*(0.5*h+h-(0.5*h-w*(y-0.5*h)/(x-w))), casenum)
    else:
      print(0.5*w*(0.5*h+0.5*h-(0.5*h-w*(y-0.5*h)/(x-w))), casenum)    

### FIXED CODE ###

import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())
S = w*h/2

if x == w/2 and y == h/2:
  print(S,1)
else:
  print(S, 0)
from collections import deque
N = int(input())
E = [[] for i in range(N + 1)]
ans = [-1]*(N+1)
ans[1] = 0
for i in range(N - 1):
    u, v, w = map(int, input().split((' ')))
    E[u].append((v, w % 2))
    E[v].append((u, w % 2))


def dfs(c=0,p=1):
    for e,w in E[p]:
        if ans[e] != -1:
            continue
        if w:
            ans[e] = 0 if c else 1
        else:
            ans[e] = c
        dfs(ans[e], e)
dfs()
for i in ans[1:]:
    print(i)

### FIXED CODE ###

from collections import deque
N = int(input())
E = [[] for i in range(N + 1)]
ans = [-1]*(N+1)
ans[1] = 0
for i in range(N - 1):
    u, v, w = map(int, input().split((' ')))
    E[u].append((u, v, w % 2))
    E[v].append((v, u, w % 2))
dfs = deque(E[1])
while dfs:
    p = (dfs.popleft())
    f, t, w = p
    if ans[t] != -1:
        continue
    if w == 0:
        ans[t] = ans[f]
    else:
        ans[t] = 0 if ans[f] else 1
    for i in E[t]:
        dfs.append(i)
for i in ans[1:]:
    print(i)
n=int(input())
l=[]
for i in range(n):
  s=int(input())
  l.append(s)
 
 
a=round(sum(l)/n)
k=0
for j in range(n):
  k = k + (l[j]-a)**2
print(k)


### FIXED CODE ###

n=int(input())
l= list(int(i) for i in input().split())
a=int(round(sum(l)/n))
k=0
for j in l:
  k = k + (j-a)**2
print(k)
N = int(input())
score = [0]*N
score = map(int, input().split())
total = 0

score.sort(reverse=True)
for i in range(N):
  if score[i+1] == None:
    total += score[i]
  else:
    total += score[i]-score[i+1]

print(total)

### FIXED CODE ###

N = int(input())
score = list(map(int, input().split()))
A = 0
B = 0
 
score.sort(reverse=True)
for i in range(N):
  if i % 2 == 0:
    A += score[i]
  else:
    B += score[i]

print(A-B)
s = input()
t = input()

for i in range len(s):
  if s[i] == t[i]:
    count +=
    print(count)
    
  else:
    print(0)

### FIXED CODE ###

s = input()
t = input()
count = 0

for i in range(3):
  if s[i] == t[i]:
    count += 1

print(count)
[a,b] = int(input().split())
if a < b:
    return ("a < b")
elif a > b:
    return ("a > b")
return ("a == b")

### FIXED CODE ###

a,b = map(int,input().split())

if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
N = int(input())
A = [0] * 5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
mi = 0
mA = 1e18
for i in range(0,5):
    if (A[i] < mA):
        mA = A[i]
        mi = i
print(math.ceil(N / mA) * (mi + 1) + 4)

### FIXED CODE ###

import math
N = int(input())
A = [0] * 5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
print(math.ceil(N / min(A)) + 4)
import numpy as np
while 1:
    global a,c
    c = np.array([[0]*14]*14)
    a = np.array([[0]*14]*14)
    a[1:-1,1:-1] = [list(map(int,list(input()))) for i in range(12)]


    def dfs(x,y,n):
        if c[x][y] == 0 and a[x][y] == 1:
            c[x][y] = n
            [dfs(x+i, y+j, n) for i,j in [(-1,0),(1,0),(0,-1),(0,1)]]


    [[dfs(x,y,12*x + y) for x in range(1,12+1)] for y in range(1,12+1)]
    flat = [a for b in c for a in b]
    print(len(set(flat)) - 1)
    if input() is None:
        break



### FIXED CODE ###

state = 1
while(state):
    a = [[0 for i in range(12)] for j in range(12)]
    for i in range(12):
        a[i] = [int(i) for i in list(input())]
    try:
        _ = input()
    except EOFError:
        state = 0

    def erase(y,x):
        if a[y][x] != 0:
            a[y][x] = 0
            if x-1 > -1:
                erase(y,x-1)
            if x+1 < 12:
                erase(y,x+1)
            if y-1 > -1:
                erase(y-1,x)
            if y+1 < 12:
                erase(y+1,x)

    count = 0
    for i in range(12):
        for j in range(12):
            if a[i][j] != 0:
                count += 1
                erase(i,j)
    print(count)
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

l=int(input())
r=20
while 2**r>l:
    r-=1
# print(r)
for i in range(2*r):
    lst=[i//2+1, i//2+2, 0]
    if i%2==1:
        lst[2]=2**((i)//2)
    print(*lst)

for i in range(r):
    if l-2**(r-i-1)>=2**r:
        print(*[r-i,r+1,l-2**(r-i-1)])
    l-=2**(r-i-1)

### FIXED CODE ###

import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

l=int(input())
r=20
while 2**r>l:
    r-=1
anslst=[]
for i in range(2*r):
    lst=[i//2+1, i//2+2, 0]
    if i%2==1:
        lst[2]=2**((i)//2)
    anslst.append(lst)

for i in range(r):
    if l-2**(r-i-1)>=2**r:
        anslst.append([r-i,r+1,l-2**(r-i-1)])
        l-=2**(r-i-1)

print(*[r+1,len(anslst)])
for i in range(len(anslst)):
    print(*anslst[i])
#!/usr/bin/env python3

#import
#import math
#import numpy as np
N = int(input())
A = list(map(int, input().split()))
n = N // 3
dic = {}

for a in A:
    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 1

ans = True

if len(dic) > 3:
    ans = False

elif len(dic) == 3:
    keys = dic.keys()
    for k in keys:
        if dic[k] != n:
            ans = False

    if (keys[0] ^ keys[1]) != keys[2]:
        ans = False

elif len(dic) == 2:
    for k in dic:
        if k == 0:
            if dic[k] != n:
                ans = False
        else:
            if dic[k] != n * 2:
                ans = False

else:
    keys = dic.keys()
    if not 0 in keys:
        ans = False

if ans:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

#!/usr/bin/env python3

#import
#import math
#import numpy as np
N = int(input())
A = list(map(int, input().split()))
n = N // 3
dic = {}

for a in A:
    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 1

ans = True

if len(dic) > 3:
    ans = False

elif len(dic) == 3:
    keys = dic.keys()
    t = []
    for k in keys:
        t.append(k)
        if dic[k] != n:
            ans = False

    a = t[0]
    b = t[1]
    c = t[2]

    if (a ^ b) != c:
        ans = False

elif len(dic) == 2:
    for k in dic:
        if k == 0:
            if dic[k] != n:
                ans = False
        else:
            if dic[k] != n * 2:
                ans = False

else:
    keys = dic.keys()
    if not 0 in keys:
        ans = False

if ans:
    print("Yes")
else:
    print("No")
n,x = map(int,input().split())
l = list(map(int,input().split()))
m = 0
a = 0
while(a<=x):
    a+=l.pop(0)
    m+=1
print(m)

### FIXED CODE ###

n,x = map(int,input().split())
l = list(map(int,input().split()))
m = 1
a = 0
for i in l:
    a+=i
    if a<=x:
        m+=1
print(m)
n=int(input())
    l= list(map(int, input().split()))
    r= list(map(int, input().split()))
    l=[0]+l
    r.append(0)
     
    res=1
    for i in range(n):
    	if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
    		if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
    			res*=0
    	else:
    		res*=min(l[i],r[i])
    print(res%1000000007)

### FIXED CODE ###

n=int(input())
l= list(map(int, input().split()))
r= list(map(int, input().split()))
l=[0]+l
r.append(0)
 
res=1
if(l[-1]!=r[0]):
	res=0
for i in range(n):
	if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
		if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
			res=0
		if( ( (l[i]<l[i+1]) and (r[i]==r[i+1]) ) and (l[i+1]>r[i]) ):
			res=0
		if( ( (l[i]==l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]<r[i]) ):
			res=0
	else:
		res*=min(l[i],r[i])
		res%=1000000007
print(res)
N, T = map(int, input().split())
A = list(map(int, input().split()))

dp = [[0] * (N + 1) for _ in range(N + 1)]

max_num = max(A)
max_index = A.index(max_num)

idx = 0
dfe = 0
count = 0
while True:
    print(idx)
    if idx >= len(A) - 1:
        break
    max_num = max(A[idx:])
    max_index = A.index(max_num)

    min_num = min(A[idx:max_index + 1])
    if dfe == max_num - min_num:
        count += 1
    elif dfe < max_num - min_num:
        dfe = max_num - min_num
        count = 1

    idx = max_index + 1

print(count)


### FIXED CODE ###

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

min_num = 10 ** 9 + 7
diff = 0
count = 0
for i in range(N):
    min_num = min(min_num, A[i])
    if diff == A[i] - min_num:
        count += 1
    elif A[i] - min_num > diff:
        count = 1
        diff = A[i] - min_num
    else:
        continue

print(count)
count = 0
while true:
    set = int(input())
    count +=1
    if set == 0:
        break
    print('Case {}: {}'.format(count, set))



### FIXED CODE ###

c = 0
while True:
    x = int(input()); c += 1
    if x == 0: break
    print("Case {}: {}".format(c, x))
from statistics import mean, median,variance,stdev
import sys
import math
import fractions
def j(a):
    if a==1: print("YES")
    else :print("NO")


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#x = int(input())                              #入力整数1つ
#x,y = (int(i) for i in input().split())      #入力整数横2つ
x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#a,b,c,k = (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#x = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
lower = (x//z)*z
if lower < x: lower+=z
high = (y//z)*z
print((high - low)/z+1)

### FIXED CODE ###

from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
#n = ip()                                     #入力整数1つ
x,y,z= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[input() for i in range(x)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
low = (x//z)*z
if low < x: low+=z
high = (y//z)*z
print((high - low)//z+1)
N=list(input())

n==reversed(N)

if n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9":
    print("hon")
if n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8":
    print("pon")
if n[0]=="3":
    print("bon")
    break


### FIXED CODE ###

n=list(input())

n==n.reverse()

if (n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9"):
    print("hon")
elif (n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8"):
    print("pon")
elif (n[0]=="3"):
    print("bon")