Harryxun/stf_run huggingface dataset:
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
S = input()
K = int(input())

ans = []
for i, c in enumerate(S):
    num = ord('z') - ord(c) + 1
    if K >= num:
        K -= num
        ans.append('a')
    else:
        ans.append(c)
if K > 0:
    ans[-1] = chr((ord(S[-1]) - ord('a') + K) % 26 + ord('a'))
print("".join(an))
    


### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
S = input()
K = int(input())

ans = []
for i, c in enumerate(S):
    if c == 'a':
        ans.append(c)
        continue
    num = ord('z') - ord(c) + 1
    if K >= num:
        K -= num
        ans.append('a')
    else:
        ans.append(c)
if K > 0:
    ans[-1] = chr((ord(ans[-1]) - ord('a') + K % 26) % 26 + ord('a'))
print("".join(ans))
print(eval("*".join(list(map(int, input().split()))[:2]))//2)

### FIXED CODE ###

a, b, c = list(map(int, input().split()))
print(a*b//2)
# Problem D - Line++

# input
N, X, Y = map(int, input().split())

# initialization
INF = N
kyori_graph = [[INF]*N for i in range(N)]
kosu_list = [0]*(N-1)

# graph search
for i in range(N):
    for j in range(i+1, N):
        # グラフの更新
        kyori_graph[i][j] = min(abs(j-i), abs(X-1-i)+1+abs(j-(Y-1)))
        # abs((Y-1)-i)+1+abs(j-(X-1))

# 個数の数え上げ
for i in range(N):
    for j in range(i+1, N):
        kyori = kyori_graph[i][j]
        kosu_list[kyori-1] += 1

# output
for k in kosu_list:
    print(k)


### FIXED CODE ###

S = list(input())

if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
    print("No")
A, B = map(int, input())
print(A * B)

### FIXED CODE ###

A, B = map(int, input().split())
print(A * B)
n = input()
a = []
for i in range(n):
  if i =="0":
    a.append("0")
  elif i =="1":
    a.append("1")
  elif i =="B":
    a.pop()
print(*a)

### FIXED CODE ###

n = input()
a = ""
for i in n:
  if i =="0":
    a+=i
  elif i =="1":
    a+=i
  elif i =="B":
    a = a[:-1]
print(a)
A = input()
B = input()
C = input()
print(A(0)+B(1)+C(2))

### FIXED CODE ###

A = input()
B = input()
C = input()
print(A[0]+B[1]+C[2])
a=int(input())
b=[]
for _ in range(a):
  b.append(list(map(int,input().split())))
ans=0
for i in range(a):
  ans+=n[i][1]-n[i][0]+1
print(ans)


### FIXED CODE ###

a=int(input())
b=[]
for _ in range(a):
  b.append(list(map(int,input().split())))
ans=0
for i in range(a):
  ans+=b[i][1]-b[i][0]+1
print(ans)
inputlist = int(input().split())

a = inputlist[0]
b = inputlist[1]

if a < b:
    print('a < b')
elif a > b:
    print('a > b')
elif a == b:
    print('a == b')

### FIXED CODE ###

a, b = [int(i) for i in input().split()]
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
elif a == b:
    print('a == b')
n = int(input())
s = input()
count = 0
for i in range(n):
  if s[i] == "A":
    if s[i+1]+s[i+2] == "BC":
      count += 1
print(count)

### FIXED CODE ###

n = int(input())
s = input()
count = 0
for i in range(n-2):
  if s[i] == "A":
    if s[i+1]+s[i+2] == "BC":
      count += 1
print(count)
import sys
sys.setrecursionlimit(10 ** 9)

n = int(input())
x = input()

p = [-1 for _ in range(2*10**5+1)]
cnt = x.count('1')

def calc(a):
  #print('a=',a)
  if p[a] != -1:
    return p[a]
  else:
    if a == 0:
      ret = 0
    else:
      b = bin(a).count('1')
      ret = 1+calc(a%b)
    p[a] = ret
    return ret

for i in range(n):
  y = list(x)
  if y[i] == '0':
    y[i] = '1'
    c = cnt+1
  else:
    y[i] = '0'
    c = cnt-1
  z = int(''.join(y),2)
  print(calc(z%c)+1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n = int(input())
x = input()

p = [-1 for _ in range(2*(10**7)+1)]
cnt = x.count('1')

def calc(a):
  #print('a=',a)
  if 0 <= a <= 2*(10**7) and  p[a] != -1:
    return p[a]
  else:
    if a == 0:
      ret = 0
    else:
      b = bin(a).count('1')
      ret = 1+calc(a%b)
    if 0 <= a <= 2*(10**7):
      p[a] = ret
    return ret

if cnt > 1:
  x0 = int(x,2)%(cnt-1)
  xx0 = [1]
  for i in range(n+1):
    xx0.append((xx0[-1]*2)%(cnt-1))
x1 = int(x,2)%(cnt+1)
xx1 = [1]
for i in range(n+1):
  xx1.append((xx1[-1]*2)%(cnt+1))

y = list(x)  
for i in range(n):
  if y[i] == '0':
    xx = xx1[n-i-1]
    print(calc((x1+xx)%(cnt+1))+1)
  else:
    if cnt == 1:
      print(0)
    else:
      xx = xx0[n-i-1]
      print(calc((x0-xx)%(cnt-1))+1)
6 5
2 3
1 2
5 6
3 4
4 5

### FIXED CODE ###

# -*- coding: utf-8 -*-

# -*- coding: utf-8 -*-


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [1]* (n+1)
        self.size = [1]* (n+1)
        
    # search parents of tree
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    # union tree
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        # parent same
        if x == y:
            return False
        
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            return True
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            return True
    # check
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    # size
    def sizes(self, x):
        x = self.find(x)
        return self.size[x]
    
#[N,M] = [6,5]
#A = [2, 1, 5, 3, 4]
#B = [3, 2, 6, 4, 5]
[N,M] = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
    [a,b] = list(map(int,input().split()))
    A[i], B[i] = a, b

A.reverse()
B.reverse()
uf = UnionFind(N)
ans_list = [0]*M
ans_list[0] = (N*(N-1))//2
ans = ans_list[0]
for i in range(M-1):
    if uf.same(A[i], B[i]) == True:
        ans = ans
    else:
        ans = ans - uf.sizes(A[i])*uf.sizes(B[i])
    uf.unite(A[i],B[i])
    ans_list[i+1] = ans
    
ans_list.reverse()
for i in range(M):
    print(ans_list[i])
n=int(input())
l=[[0]*10for _ in range(10)]
for x in range(1,n+1):l[a=int(str(x)[0])][b=int(str(x)[-1])]+=1
print(sum(l[i][j]*l[j][i]for i in range(10)for j in range(10)))

### FIXED CODE ###

n=int(input())
l=[[0]*10for _ in range(10)]
for x in range(1,n+1):l[int(str(x)[0])][int(str(x)[-1])]+=1
print(sum(l[i][j]*l[j][i]for i in range(10)for j in range(10)))
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=sum(a)
l=[]
for i in range(m):
    b,c=map(int,input().split())
    l.append((b,c))
l.sort(key=lambda x:x[1],reverse=True)
x=[]
for i in range(m):
    xx=[l[i][1]]*l[i][0]
    x.extend(xx)
c=0
while a[c]<x[c]:
    ans+=x[c]-a[c]
    c+=1
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
l=[]
for i in range(n):
    l.append([1,a[i]])
for i in range(m):
    l.append(list(map(int,input().split())))
l.sort(key=lambda x:x[1], reverse=True)
c=0
ans=0
for i in range(n+m):
    ans+=l[i][1]*l[i][0]
    c+=l[i][0]
    if c>n:
        ans-=l[i][1]*(c-n)
        break
print(ans)
n, x = map(int, input().split())
l = list(map(int, input().split()))

wk = 0
for i in range(n):
    wk += l[i]
    #print(i)
    #print(l[i])
    if(wk > x):
        ans = i + 1
        break
print(ans)

### FIXED CODE ###

n,x=map(int,input().split())
l=list(map(int,input().split()))

wk=0
cnt=1
for i in range(n):
    wk+=l[i]
    if wk <= x:
        cnt+=1
print(cnt)
import sys
input = sys.stdin.readline

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

#output
from collections import Counter
 
l = Counter(A).most_common()
l = [b for a, b in l]

maximum_operation = [0] * N
for K in range(len(l)):
    l = Counter(A).most_common()
    l = [b for a, b in l]
    while l[K][1] > 0:
        for i in range(K+1):
            l[i] -= 1
        l.sort(reverse = True)
        maximum_operation[K] += 1

for m in maximum_operation:
    print(m)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

#output
from collections import Counter
import bisect

l = Counter(A).most_common()
l = [b for a, b in l]
M = len(l)
l.sort()
p = sum(l)

maximum_operation = [0] * N

ll = []
for x in reversed(range(1, N+1)):
    a = bisect.bisect_left(l, x)
    if a == 0:
        b = M*x
        c = 0
    elif a >= M:
        b = 0
        c = p
    else:
        b = (M-a)*x
        c = sum(l[0:a]) 
    ll.append((b + c)/x)

for K in range(M):
    maximum_operation[K] = N - bisect.bisect_left(ll, K+1)

for m in maximum_operation:
    print(m)
b = ["the", "this", "that"]
while 1:
        a = raw_input()
        if a == "":
                break
        for y in range(26):
                for x in b:
                        if x in a:
                                print a
                                break
                a = list(a)
                for x in range(len(a)):
                        if a[x] == "z":
                                a[x] = "a"
                        elif "a" <= a[x] < "z":
                                a[x] = chr(ord(a[x])+1)
                a = "".join(a)

### FIXED CODE ###

b = ["the", "this", "that"]
while 1:
        try:
                a = raw_input()
        except EOFError:
                break
        for y in range(26):
                for x in b:
                        if x in a:
                                print a
                                break
                a = list(a)
                for x in range(len(a)):
                        if a[x] == "z":
                                a[x] = "a"
                        elif "a" <= a[x] < "z":
                                a[x] = chr(ord(a[x])+1)
                a = "".join(a)
##### 解けた #####

S=input()
A=[""]

for s in S: # 入力の文字列1文字ずつ見てゆく
    if s in ["0","1"]: # もし0か1の場合、それを追加
        A.append(s)
    elif s=="B": # もしバックスペースの場合、1文字削除
        A.pop(-1)

print("".join(A))

### FIXED CODE ###

##### 解けた #####

S=input()
A=[""]

for s in S: # 入力の文字列1文字ずつ見てゆく
    if s in ["0","1"]: # もし0か1の場合、それを追加
        A.append(s)
    elif s=="B": # もしバックスペースの場合、1文字削除
        if len(A)>=1: # 長さが1以上の場合のみ削除
            A.pop(-1)

print("".join(A))
a, b = input().split()
a = int( a )
b = b * 100

print( a * b // 100 )


### FIXED CODE ###

a, b = input().split()

b = b.replace(".","")

a = int( a )
b = int( b )
print( a * b // 100 )
from operator import itemgetter

def calc(n, A, B):
    count = 0
    for i in range(n-1):#scanA
        Bmin = B[i]
        swapnum = i
        for j in range(i+1,n):
            if Bmin > B[j]:
                Bmin = B[j]
                swapnum = j            
        
        if A[i] > Bmin:
            return 'No'
        elif A[i+1] > Bmin:
            B[swapnum] = B[i]
            count += 1
    
    if count > n -2:
        return 'No'
    else:
        return 'Yes'

                
#main

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

#print(A)
#print(B)

pair = list(zip(A,B))
pair.sort(key=itemgetter(0))#sortA

A, B = zip(*pair)

ltA = list(A)
ltB = list(B)

#print(ltA)
#print(ltB)

#print(pair)

print(calc(n,ltA,ltB))


### FIXED CODE ###

n = int(input())
print((n-1)//2)
a=input()
b=input()
s=int(a)*int(b)
t=(int(a)+int(b))*2
print(s, t)


### FIXED CODE ###

a, b = map(int, input().split())
s=int(a)*int(b)
t=(int(a)+int(b))*2
print(s, t)
a,b=map(int, input().split())
a,b=map(int, input().split())
print('%d %d %f' %(a/b, a%b, a/b))

### FIXED CODE ###

a,b=map(int, input().split())
print('%d %d %f' %(a/b, a%b, a/b))
import numpy as np
from collections import deque
N, M = map(int, input().split())
INF = 100000
dist = [INF]*N*3
dist = np.array(dist).reshape(N, 3)
vector = np.zeros((N, N))

for i in range(M):
    graf1, graf2 = map(int, input().split())
    vector[graf1-1, graf2-1] = 1
S, T = map(int, input().split())
S, T = S-1, T-1

# BFS
dist[S][0] = 0
queue = deque()
queue.append((S, 0))
while len(queue) > 0:
    v, l = queue.popleft()
    for i in range(N):
        if vector[v][i] != 1:
            continue
        new_l = (l+1)%3
        if dist[i][new_l] != INF:
            continue
        dist[i][new_l] = dist[v][l] + 1
        queue.append((i, new_l))

ans = dist[T][0]
if ans == INF:
    print("-1")
else:
    print(ans // 3)

### FIXED CODE ###

from collections import deque
N, M = map(int, input().split())
INF = -1
dist = [[INF]*3 for _ in range(N)]
vector = [[] for _ in range(N)]

for i in range(M):
    graf1, graf2 = map(int, input().split())
    vector[graf1-1].append(graf2-1)
S, T = map(int, input().split())
S, T = S-1, T-1

# BFS
dist[S][0] = 0
q = deque()
q.append((S, 0))
while q:
    v, l = q.popleft()
    for i in vector[v]:
        new_l = (l+1)%3
        if dist[i][new_l] != INF:
            continue
        dist[i][new_l] = dist[v][l] + 1
        q.append((i, new_l))

ans = dist[T][0]
if ans == INF:
    print("-1")
else:
    print(int(ans/3))
n, m, c = map(int, input().split())
b = input().split()
ans = 0

for j in range(n):
    a = list(int(x) for x in input().split())
    for i in range(m):
        sum = 0
        sum += a[i]*b[i]
        if sum > -c:
            ans += 1

print(ans)

### FIXED CODE ###

n, m, c = map(int, input().split())
b = list(int(x) for x in input().split())
ans = 0

for j in range(n):
    a = list(int(x) for x in input().split())
    sum = 0
    for i in range(m):
        sum += a[i]*b[i]
    if sum > -c:
        ans += 1

print(ans)
s = input()
if s[3] == s[4] and s[5] == s[6]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No')
n = int(input())
li = input().split()

lians = [0]*n
for i in range(n):
  while li[i]%2 == 0:
    li[i] /= 2
    lians[i] += 1
print(max(lians))

### FIXED CODE ###

n = int(input())
li = list(map(int,input().split()))
 
lians = [0]*n
for i in range(n):
  while li[i]%2 == 0:
    li[i] /= 2
    lians[i] += 1
print(min(lians))
K = int(input())
N = int(input())

A = list(range(N))

for i in range(N):
    A[i]=int(input())
    
max = A[0]

for i in range(N-1):
    if max < A[i+1]-A[i]:
        max = A[i+1]-A[i]

if max < K-A[N-1]+A[0]:
    max = K-A[N-1]+A[0]
    
print(K-max)
    


### FIXED CODE ###

K,N = map(int,input().split())
A = list(map(int,input().split()))
    
max = K-A[-1]+A[0]
 
for i in range(N-1):
    if max < A[i+1]-A[i]:
        max = A[i+1]-A[i]
    
print(K-max)
def lpop(ans,l):
    return((ans * l.pop(0)) % (10 ** 9 + 7))
N,K = map(int,input().split())
la = list(map(int,input().split()))
la = sorted(la,key=abs,reverse=True)
lg = la[:K]
lgp = []
lgm = []
lr = la[K:]
lrp = []
lrm = []
for a in lg:
    if a >= 0:
        lgp.append(a)
    else:
        lgm.append(a)
for a in lr:
    if a >= 0:
        lrp.append(a)
    else:
        lrm.append(a)
if len(lgm) % 2 == 1:
    if len(lrp) > 0:
        lg.pop(l.index(lgm[len(lgm) - 1]))
        lg.append(lrp[0])
    else:
        if len(lrm) > 0:
            if len(lgp) > 0:
                lg.pop(l.index(lgp[len(lgp) - 1]))
                lg.append(lrm[0])
            else:
                lg = la[N - K:]
ans = 1
for a in lg:
    ans *= a
    ans %= 10 ** 9 + 7
print(ans)



### FIXED CODE ###

N,K = map(int,input().split())
la = list(map(int,input().split()))
la = sorted(la)
la = sorted(la,key=abs,reverse=True)
lg = la[:K]
lgp = []
lgm = []
lr = la[K:]
lrp = []
lrm = []
for a in lg:
    if a >= 0:
        lgp.append(a)
    else:
        lgm.append(a)
for a in lr:
    if a >= 0:
        lrp.append(a)
    else:
        lrm.append(a)
if len(lgm) % 2 == 1:
    if len(lrp) > 0 and len(lrm) > 0:
        if len(lgp) > 0 and len(lgm) > 0:
            if lgp[len(lgp) - 1] * lrp[0] > lgm[len(lgm) - 1] * lrm[0]:
                lg.pop(lg.index(lgm[len(lgm) - 1]))
                lg.append(lrp[0])
            else:
                lg.pop(lg.index(lgp[len(lgp) - 1]))
                lg.append(lrm[0])
        else:
            if len(lgp) > 0:
                lg.pop(lg.index(lgp[len(lgp) - 1]))
                lg.append(lrm[0])
            else:
                lg.pop(lg.index(lgm[len(lgm) - 1]))
                lg.append(lrp[0])
    elif len(lrp) > 0:
        if len(lgm) > 0:
            lg.pop(lg.index(lgm[len(lgm) - 1]))
            lg.append(lrp[0])
        else:
            lg = la[N - K:]
    elif len(lrm) > 0:
        if len(lgp) > 0:
            lg.pop(lg.index(lgp[len(lgp) - 1]))
            lg.append(lrm[0])
        else:
            lg = la[N - K:]
ans = 1
for a in lg:
    ans *= a
    ans %= 10 ** 9 + 7
print(ans)
P = int(input())
Q = int(input())
R = int(input())

X = max([P, Q, R])

print(P + Q + R - X)

### FIXED CODE ###

P, Q, R = map(int, input().split())
 
X = max([P, Q, R])
 
print(P + Q + R - X)
# ABC073 D - joisino's travel
import itertools
N,M,R=map(int, input().split())
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]
dist=[inf]*N
visited=[False]*N
for i in range(M):
    a,b,c=map(int,input().split())
    mat[a-1][b-1]=mat[b-1][a-1]=c

for i in range(R):
    r[i]-=1

ans=inf
for i in range(N):
    for j in range(N):
        for k in range(N):
            mat[i][j]=min(mat[i][j],mat[i][k]+mat[k][j])

for rr in itertools.permutations(r,R):
    t_sum=0
    for j in range(1,R):
        t_sum+=mat[rr[j-1]][rr[j]]
    ans=min(ans,t_sum)
print(int(ans))


### FIXED CODE ###

# ABC073 D - joisino's travel
import itertools
N,M,R=map(int, input().split())
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]

for i in range(M):
    a,b,c=map(int,input().split())
    if mat[a-1][b-1]>c:
        mat[a-1][b-1]=mat[b-1][a-1]=c

for i in range(R):
    r[i]-=1

ans=inf
for k in range(N):
    for i in range(N):
        for j in range(N):
            mat[i][j]=min(mat[i][j],mat[i][k]+mat[k][j])

for rr in itertools.permutations(r,R):
    t_sum=0
    for j in range(1,R):
        t_sum+=mat[rr[j-1]][rr[j]]
    ans=min(ans,t_sum)
print(int(ans))
if b == "A":
  print("G")
elif b == "G":
  print("A")
elif b == "C":
  print("T")
else:
  print("C")

### FIXED CODE ###

b = input()
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
else:
  print("G")
print(len(set([int(input()) for _　in range(input())])))

### FIXED CODE ###

print(len(set([int(input()) for _ in range(int(input()))])))
n = int(input())
x = list(map(int, input().split()))
p = []

for i in range(100):
   	cnt = 0
	for j in range(n):
   		cnt = cnt + (x[j]-i)**2
    	p.append(cnt)

print(sorted(p)[0])

### FIXED CODE ###


if __name__ == '__main__':
    n = int(input())
    x = list(map(int, input().split()))
    p = []

    for i in range(100):
        cnt = 0
        for j in range(n):
            cnt = cnt + (x[j]-i)**2
        p.append(cnt)

    print(sorted(p)[0])
s = input()
if len(set(sort(s))) == 4:
    print("Good")
else:
    print("No")

### FIXED CODE ###

s = input()
if s[0] != s[1] != s[2] != s[3]:
    print("Good")
else:
    print("Bad")
n, m = map(int, input().split())
ps = []
for i in range(m):
    p, s = input().split()
    ps.append([int(p), s])
flag = [False for _ in range(n)]
ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]
i = 0
sumac = 0
sumwa = 0

for i in range(m):
    p = ps[i][0]
    s = ps[i][1]
    if s == "WA" and ac[p - 1] == 0:
        wa[p - 1] += 1
    elif s == "AC" and ac[p - 1] == 0:
        ac[p - 1] += 1
        sumac += 1
        sumwa += wa[p - 1]

print(str(int(ac)) + " " + str(int(wa)))

### FIXED CODE ###

n, m = map(int, input().split())
ps = []
for i in range(m):
    p, s = input().split()
    ps.append([int(p), s])
flag = [False for _ in range(n)]
ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]
i = 0
sumac = 0
sumwa = 0

for i in range(m):
    p = ps[i][0]
    s = ps[i][1]
    if s == "WA" and ac[p - 1] == 0:
        wa[p - 1] += 1
    elif s == "AC" and ac[p - 1] == 0:
        ac[p - 1] += 1
        sumac += 1
        sumwa += wa[p - 1]

print(str(sumac) + " " + str(sumwa))
a, b, c= map(int,input())
sum = a + b + c
if sum >= 22:
  preint("best")
else:
  print("win")

### FIXED CODE ###

num = list(map(int,input().split()))
sum = 0
for i in num:
  sum += i
if sum >= 22:
  print("bust")
else:
  print("win")
H,W = map(int, input().split())

if H == 1:
    print(1)
elif W == 1: 
    print(1)
else:
    ans = H*(W // 2)
    if H % 2 == 1:
        if W % 2 == 0:
            ans += W // 2
        else:
            ans += W // 2 + 1
print(ans)


### FIXED CODE ###

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

if W == 1:
    print(1)
elif H == 1:
    print(1)
else:
    ans = W * (H // 2)
    if H % 2 == 1:
        if W % 2 == 0:
            ans += W // 2
        else:
            ans += W // 2 + 1
    print(ans)
r = input()
r2 = r * r
print(r2)

### FIXED CODE ###

r = int(input())
print(r * r)
import sympy
n, m = map(int, input().split())


b = sympy.divisors(m)
# print(b)
a = m//n
# print(a)
ans = 0
for i in b:
    if i <= a:
        ans = i
print(ans)

### FIXED CODE ###


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


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


b = make_divisors(m)
# print(b)
a = m//n
# print(a)
ans = 0
for i in b:
    if i <= a:
        ans = i
print(ans)
n = int(input())
dic = {}
from collections import Counter
for i in range(n):
  s = list(input())
  s = sorted(s)
  if s not in dic: dic[s] = 1
  else: dic[s] += 1
a = dic.values()
ans = 0
for i in range(len(a)):
  ans += a[i]*(a[i]-1)/2
print(ans)


### FIXED CODE ###

n = int(input())
dic = {}
for i in range(n):
  s = input()
  s = sorted(s)
  s = ''.join(s)
  if s not in dic:
    dic[s] = 1
  else:
    dic[s] += 1

ans = 0
for _ in dic:
  if dic[_]>1: ans = ans + int(dic[_]*(dic[_]-1)/2)
    
print(ans)
a = input()
for i in range(int(a[0]+a[2:])):
    if int(a[0]+a[2:]) == i**2:
        print("Yes")
        exit()
print("No")


### FIXED CODE ###

a = list(map(int,input().split()))
s = int(str(a[0]) + str(a[1]))
for i in range(s):
    if s == i**2:
        print("Yes")
        exit()
print("No")
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
dp = [float('inf')]*n
dp[-1] = 0
dp[-2] = abs(h[-1]-h[-2])

for i in range(n-3,-1,-1):
  for j in range(i+1,min(i+k+1,n)):
    dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]))
                
print(dp[0])


### FIXED CODE ###

n = int(input())
h = [int(x) for x in input().split()]
dp = [0]*n
dp[n-2] = abs(h[n-1]-h[n-2])

for i in range(n-3,-1,-1):
  dp[i] = min(dp[i+1]+abs(h[i]-h[i+1]),dp[i+2]+abs(h[i]-h[i+2]))
  
print(dp[0])
N,M,K = map(int,input().split())	
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a=[0]
b=[0]
for i in range(N):
  a.append(a[-1]+A[i])
for j in range(M):
  b.append(b[-1]+B[j])  
for i in range(len(A)+1):
  for j in range(len(B)+1):
    score=a[i]+b[j]
    if score <= K:
      point=[]
      point.append(i+j)
print(max(point))


### FIXED CODE ###

a=int(input())
score=a+a**2+a**3
print(score)
N = int(input())
nump = input().split()
nump = [int(i) for i in nump]

count = 0
for i in range(1,8):
  p = nump[i]
  tmp = sorted([p[i-1],p[i],[i+1]])
  if tmp[1] == p:
    count+=1
print(count)


### FIXED CODE ###

N = int(input())
nump = input().split()
nump = [int(i) for i in nump]

count = 0
for i in range(1,N-1):
  p = nump[i]
  tmp = nump[i-1:i+2]
  tmp.sort()
  if tmp[1] == p:
    count+=1
print(count)