peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
a, b, m = map(int,raw_input().split())
dr = map(int,raw_input().split())
wa = map(int,raw_input().split())
xyc = [map(int,raw_input().split()) for i in range(m)]
low = 200001

for i in range(m):
    f = xyc[i][0] - 1
    d = xyc[i][1] - 1
    if low >= dr[f]+wa[d]-xyc[i][2]:
        law = dr[f]+wa[d]-xyc[i][2]

dr.sort()
wa.sort()

if law >= (dr[0] + wa[0]):
    print (dr[0] + wa[0])
else:
    print law
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
for i in range(N-1):
  b=A.count(i+1)
  print(b)
# Judge status: Wrong Answer
import math
A,B,C = list(map(int,input().split()))
V = A**2 * B
r = math.atan(2 * (V - C) / (A ** 3))
ans = math.degrees(r)
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())

n = b - a
sumb = n * (n + 1) // 2
print(sumb - b)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    s=1
    for i in a:
        s=s*i
        if s>10**18:
            s=-1
            break
    print(s)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A = [x-i-1 for i, x in enumerate(A)]
R = round(sum(A)/N)
m = 1000000000000
for i in range(-100, 100):
  m = min(m, sum(abs(a-R-i) for a in A))
print(m)
# Judge status: Accepted
N = int(input())

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

a.sort()


x = []
i = len(a)-1
#print(a)

while i > 0:
    if a[i] == a[i-1]:
        x.append(a[i])
        i-=1

    i-=1
    
    if len(x) == 2:
        print(x[0]*x[1])
        exit()



print(0)
# Judge status: Accepted
_,*a=map(int,open(0).read().split());s,t=sum(a),0;l=[]
for i in a:t+=i;l+=[abs(s-t*2)]
print(min(l[:-1]))
# Judge status: Accepted
n, l = map(int, input().split())

s_list = []
s_list.append(input())

for i in range(n-1):
  s = input()
  for j in range(len(s_list)):
    if s_list[j] >= s:
      s_list.insert(j, s)
      break
    elif j == len(s_list) - 1:
      s_list.append(s)

ans = ''
for i in range(len(s_list)):
  ans += s_list[i] 

print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline

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

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

print(len(Base_10_to_n(N, K)))
# Judge status: Accepted
a, b, c = map(int, input().split())
k=int(input())

for i in range(k):
    if a>=b:
        b*=2
    elif b>=c:
        c*=2

if a<b and b<c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
pos=[0]*n
s=0
for i in range(n):
  if b[i]-a[i]>=0:
    pos[i]=b[i]-a[i]
  else:
    s+=a[i]-b[i]
for p in pos:
  s-=p//2
if s<=0:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
A,B=map(int,input().split())
if B%A!=0:
  print(B//A+1)
else:
  print(B//A)
# Judge status: Wrong Answer
# 入力
N = int(input())

# 処理
total = 0
for i in range(1, N+1):
    print(total)
    total = total + i

# 出力
print(total)
# Judge status: Wrong Answer
from functools import reduce
from fractions import gcd
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
x = reduce(gcd,T)
sum=0
for i in T:
    sum+=x*i
print(sum)
# Judge status: Wrong Answer
n = int(input())
c = input()
def try_count(c, color):
    try:
        return c.count(color)
    except:
        return 0
all_r = try_count(c, 'R')
all_w = try_count(c, 'W')
left_w = try_count(c[:all_w], 'W')
print(min(all_r,all_w,left_w))
# Judge status: Accepted
L = list(map(int,input().split()))
print(10*max(L)+sum(L)-max(L))
# Judge status: Accepted
A,B,C,D=map(int,input().split())

while True:
    if C-B<=0:
        print('Yes')
        exit()
    if A-D<=0:
        print('No')
        exit()
    C-=B
    A-=D
# Judge status: Wrong Answer
import sys
import os
import math

Q = 10*9

def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    a, b, c = list(map(int, sys.stdin.readline().split()))
    # print(math.sqrt(a), math.sqrt(b), math.sqrt(c))
    # print(math.sqrt(a*Q), math.sqrt(b*Q), math.sqrt(c*Q))

    print('Yes' if math.sqrt(a*Q)+math.sqrt(b*Q) < math.sqrt(c*Q) else 'No')


if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import defaultdict
def c163(n, al):

    count = defaultdict(int)

    for i in range(n-1):
        count[al[i]] += 1

    return count

def main():
    n = int(input())
    al = list(map(int, input().split()))
    dilist = c163(n, al)
    for i in range(1 , n + 1):
        try:
            print(dilist[i])
        except:
            print("0")

if __name__ == '__main__':
    main()
# Judge status: Accepted
# AtCoder Beginner Contest 147 - B
# -*- encoding: UTF-8 -*-

s = input()
la = len(s)

lf = la // 2

slist =list(s)

flist = slist[:lf]
slist.reverse()
#print(flist)
#print(slist)
count = 0
for i in range(lf) :
  if flist[i] != slist[i] :
    count = count + 1

print(count)
# Judge status: Wrong Answer
N = int(input())
max=1
for i in range(1, N):
  if max<int(i**2)<=N:
    max=i**2
  else:
    break
print(max)
# Judge status: Wrong Answer
#template
def inputlist(): return [int(j) for j in input().split()]
from collections import Counter
#template
#issueから始める
N = int(input())
s = list(input())
ans = -1
for i in range(1,N-1):
    lif = s[:i]
    lib = s[i:]
    cf= list(Counter(lif).keys())
    cb= list(Counter(lib).keys())
    k = len(cf) + len(cb) - len(set(cf+cb))
    ans = max(ans,k)
print(ans)
# Judge status: Accepted
n,l=map(int,input().split())
S=[input() for i in range(n)]
S.sort()
print(*S,sep='')
# Judge status: Accepted
def main():
    n, m = map(int, input().split())
    n2 = n//2
    if n%2:
        for i in range(1, m+1):
            print(i, n-i+1)
    else:
        for i in range(1, m+1):
            if n+1-2*i <= n2:
                print(i, n-i)
            else:
                print(i, n-i+1)
                
    
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
K, N = map(int,input().split())
a = list(map(int,input().split()))
x = [a[0]-a[-1]+K]
for i in range(1,N):
    x.append(a[i]-a[i-1])
print(K-max(x))
# Judge status: Accepted
import math

n = int(input())
tL = [int(input()) for _ in range(n)]


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


ans = tL[0]
for t in tL[1:]:
    ans = lcm(t, ans)

print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
cnt=0
while(x<=y):
  cnt+=1
  x*=2
print(cnt)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
ans = ((max(x)-min(x)))**2*n
for i in range(min(x),max(x)+1):
    t = 0
    for j in x:
       t+= (j-i)**2 
    ans = min(ans,t)
print(ans)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def main():
    A = [int(input()) for _ in range(5)]
    k = int(input())
    if A[-1] - A[0] > k:
        print(":(")
    else:
        print("Yay!")



if __name__ == "__main__":
    main()
# Judge status: Accepted
input()
s=t=input()
l,r=p='()'
exec("t=t.replace(p,'');"*50)
c=t.count
print(l*c(r)+s+r*c(l))
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a == b:
  print("Draw")
if a == 1:
  print("Alice")
elif b == 1:
  print("Bob")
elif a > b:
  print("Alice")
else:
  print("Bob")
# Judge status: Accepted
N=int(input())
dictionary={}
count=0
for i in range(N):
    s="".join(sorted(input()))
    if s in dictionary:
        dictionary[s]+=1
        count+=dictionary[s]
    else:
        dictionary[s]=0
print(count)
# Judge status: Accepted
n, m = map(int,input().split())
if m == n:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort(reverse=True)

cnt=0
for j in range(n):
    cnt+=a[j]

b=[]
for i in range(n):
    if a[i]>(cnt*(1/(4*m))):
        b.append(a[i])

if len(b) >= m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
n, m = map(int, readline().split())
ab = map(int, read().split())
ab = sorted(zip(ab, ab))

ans = 0
for a, b in ab:
    drink = min(b, m)
    ans += a * drink
    m -= drink
    if m <= 0:
        break
print(ans)
# Judge status: Accepted
list1 = [1,3,5,7,8,10,12]
list2 = [2]
list3 = [4,6,9,11] 
x,y = map(int,input().split())
if (x in list1 and y in list1) or (x in list2 and y in list2) or (x in list3 and y in list3):
    print("Yes")
else:
  print('No')
# Judge status: Accepted
n,i=int(input()),1
while n>111*i:
    i+=1
print(111*i)
# Judge status: Accepted
X = int(input())

K = 0
rad = 360
while rad != 0:
    rad -= X
    K += 1
    if rad < 0:
        rad += 360
print(K)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
if(1 in a):
  ans = 0
  jud = 0
  f = 1
  for i in range(n):
    if(a[i]!=f):
      ans += 1
    else:
      f += 1
  print(ans)
else:
  print(-1)
# Judge status: Accepted
s = input()
t = input()
ans = 0

for idx in range(len(s)):
    if s[idx] != t[idx]:
        ans += 1

print(ans)
# Judge status: Accepted
l=set()
for _ in range(int(input())):
  l.add(input())
print(len(l))
# Judge status: Wrong Answer
import math
N = int(input())
a = math.floor(math.log(N, 2))
print(a)
# Judge status: Wrong Answer
N = int (input ())
print ((N*(N+1))/2)
# Judge status: Accepted
a,b,x=map(int,input().split())
if x<a or x-a>b:
  print("NO")
else:
  print("YES")
# Judge status: Accepted
#import math
import fractions
a,b,c,d = map(int,input().split())

def anti_div(a,b,c):
    aa = (a-1) - (a-1) // c
    bb = b - b // c
    return bb - aa

# c,dの最小公倍数を求める
# l = c*d / gcd
#lcd = c // math.gcd(c,d) * d
lcd = c // fractions.gcd(c,d) * d

ans = anti_div(a,b,c) + anti_div(a,b,d) - anti_div(a,b,lcd)
print(ans)
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(5)]
minimum = min(a)
print((n + minimum - 1) // minimum + 4)
# Judge status: Accepted
n = int(input())
INF = 10**5
answer = INF
for i in range(n+1):
    money = i
    cnt = 0
    while money > 0:
        cnt += money % 6
        money //= 6

    money = n-i
    while money > 0:
        cnt += money % 9
        money //= 9
    if answer > cnt:
        answer = cnt
print(answer)
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(1000000)

N = int(input())
alpha = [chr(ord('a') + i) for i in range(26)]

def dfs(s, max_i):
  if len(s) == N:
    print(s)
  else:
    for i in range(97,max_i+1):
      dfs(s+chr(i), i+1)

dfs('', 97)
# Judge status: Accepted
n=int(input())%10
if n in[2,4,5,7,9]:
    print("hon")
elif n==3:
    print("bon")
else:
    print("pon")
# Judge status: Wrong Answer
n = int(input())
l = []
r = []
for _ in range(n):
  a, b = map(int, input().split())
  l.append(a)
  r.append(b)
before_sa = 0
for i in range(1, n+1):
  j = 0
  a, b = l[-i], r[-i]
  a += before_sa
  if a % b == 0:
    continue
  else:
    sa = (a//b + 1) * b - a
    before_sa = sa
print(before_sa)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

from itertools import permutations
l = []
for pp in permutations(range(1, n+1)):
    ll = []
    for _p in pp:
        ll.append(_p)
    l.append(str(ll))

a = l.index(str(p))
b = l.index(str(q))
print(abs(a - b))
# Judge status: Accepted
MOD = 10**9+7


def cmb2(n, r):
    x = 1
    y = 1
    for i in range(r):
        x = x * (n-i) % MOD
        y = y * (i+1) % MOD
    return x * pow(y, MOD-2, MOD) % MOD


def main():
    n, a, b = map(int, input().split())
    ans = pow(2, n, MOD)
    ans -= 1
    ans %= MOD
    ans -= cmb2(n, a)
    ans %= MOD
    ans -= cmb2(n, b)
    ans %= MOD
    print(ans)


main()
# Judge status: Wrong Answer
import itertools

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

Combination = list(itertools.permutations(L, 3))
count = 0
for i in Combination:
    # a+b>c かつ b+c>a かつ c+a>b
    a = int(i[0])
    b = int(i[1])
    c = int(i[2])
    if((a+b)> c and (b+c) >a and (c+a) >b and a!=b and b!= c and a!= c and a<b and b<c and a<c):
        count+=1
        print(i)

print(count)
# Judge status: Accepted
a=input()
n=len(a)
m=int(input())
ans=""
for i in range(n-1):
  if a[i]=="a":
    ans += "a"
    continue
  x=ord(a[i])-97
  if m>=26-x:
    ans += "a"
    m -= 26-x
  else:
    ans += a[i]
ans += chr((ord(a[n-1])-97+m)%26+97)
print(ans)
# Judge status: Wrong Answer
N = int(input())
ans = 0

def F(N):
  if(N == 0):
    return ''
  
  if(N % 2 == 0):
    return F(N//-2) + '0'
  else:
    return F((N-1)//-2) + '1'

print(F(N))
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
if max(l)<=(sum(l)-max(l)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
h = int(input())

ans = 0
if h == 1:
    print(1)
    exit()


for i in range(h):
    ans += 2 ** i
    h//= 2
    if h == 1:
        ans += 2 ** (i + 1)
        print(ans)
        exit()
# Judge status: Accepted
N=int(input())
S=input()
print("Yes" if S[:N//2]==S[N//2:] else "No")
# Judge status: Accepted
S, T = input().strip(), input().strip()
ds, dt = {}, {}

for s, t in zip(S, T):
    if s not in ds or ds[s] == t:
        ds[s] = t
    else:
        print('No')
        exit()
    if t not in dt or dt[t] == s:
        dt[t] = s
    else:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
n=int(input())
if n%111==0:
  print(n)
else:
  print(((n//111)+1)*111)
# Judge status: Accepted
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

print(*list(map(lambda x : x + 1, np.argsort(a))))
# Judge status: Accepted
N,M=map(int,input().split())
md=10**9+7
def P(m):
  ret=1
  for i in range(1,m+1):
    ret = (ret*i)%md
  return ret

if N<M:
  N,M=M,N
MK = P(M)
if N==M:
  ans=(2*(MK**2))%md
elif N==M+1:
  ans=(MK**2)%md
  ans=(ans*N)%md
else:
  ans=0
print(ans)
# Judge status: Wrong Answer
x = int(input())

if x < 600:
    print(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 600 <= x < 800:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif 1800 <= x < 2000:
    print(1)
# Judge status: Accepted
A, B, C = map(int, input().split())
if A<=C and B>= C:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
s=input()
s1=s.replace('7','8',1)
print(s1)
# Judge status: Accepted
N, M, X = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

ans = 10**9 + 10

for i in range(1, 2**N):
    money = 0
    L = [0] * M
    for j in range(N):
        if (i >> j) & 1:
            money += A[j][0]
            for k in range(M):
                L[k] += A[j][k+1]
    if min(L) >= X and money < ans:
        ans = money

if ans == 10**9+10:
    ans = -1

print(ans)
# Judge status: Accepted
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n, m = map(int, readline().rstrip().split())
    if n == 1 or m == 1:
        print(abs(abs(n - m) - 1))
        return
    print(abs((m - 2) * (n - 2)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
vowel=["a","i", "u", "e", "o"]

c=input()

if c in vowel:
    print("vowel")
else:
    print("consonant")
# Judge status: Wrong Answer
s=input();print("YNeos"[s[0]!=s[-1]::2])
# Judge status: Wrong Answer
n,b,r = map(int,input().split())

loop = n/(b+r)
mod = n%(b+r)
extra = min([b,mod])

print(int(loop*b + extra))
# Judge status: Wrong Answer
AB, BC, CA = map(int, input().split())

print((BC*AB)/2)
# Judge status: Accepted
from collections import defaultdict
n = int(input())

arr = defaultdict(int)
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr[i] = cnt

if temp!=1:
    arr[temp] = 1

if arr==[]:
    arr[n] = 1

ans = 0

for i in arr:
    c = 1
    while arr[i]-c>=0:
        arr[i] -= c
        c += 1
        ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = []

for item in A:
    if item%2==0:
        B.append(item)
cnt = 0
ans = ''
for item in B:
    if item%3!=0:
        if item%5!=0:
            ans = 'DENIED'
if ans!='DENIED':
    ans = 'APPROVED'
print(ans)
# Judge status: Accepted
N = int(input())

x = N%10

if x in [2, 4, 5, 7, 9]:
    print('hon')
elif x in [0, 1, 6, 8]:
    print('pon')
else:
    print('bon')
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[8]:


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


# In[9]:


a_abs = list(map(abs,A))
minus_cnt = sum([1 for x in A if x < 0])
if minus_cnt%2 == 0:
    ans = sum(a_abs)
else:
    ans = sum(a_abs) - min(a_abs)*2
print(ans)


# In[ ]:
# Judge status: Wrong Answer
S=int(input())
if S == 10**18:
    print(0,0,10**9,1,0,10**9)
else:
    q,r = S//10**9, S%10**9
    print(0,0,10**9,1,q+1,10**9-r)
# Judge status: Accepted
N, C, K = map(int, input().split())
T = sorted([int(input()) for i in range(N)])

bs = 0
st = 0
ans = 0
for t in T:
    if bs == 0:
        st = t
    if bs == C or t-st>K:
        bs = 1
        st = t
        ans += 1
    else:
        bs += 1

if bs > 0:
    ans += 1
print(ans)
# Judge status: Wrong Answer
a=list(map(int,input().split()))
a=sorted(a)

dist1=a[2]-a[0]
dist2=a[2]-a[1]

if (dist1%2)==0 and (dist2%2)==0:
  ans=(dist1+dist2)//2
  print(ans)
  
elif (dist1%2)==1 and (dist2%2)==1:
  ans=(dist1+dist2)//2
  print(ans)
  
elif (dist1%2)==2 and (dist2%2)==1:
  ans=(dist1//2)+(dist2+1)//2
  print(ans)
  
else:
  ans=(dist2//2)+(dist1+1)//2
  print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
a, b = [], []
for i in range(n):
  a.append(input())
for i in range(m):
  b.append(input())
  
ans = False
for i in range(n-m+1):
  for j in range(n-m+1):
    flag = True
    for k in range(m):
      if a[i+k][j:j+m] != b[k]:
        flag = False
    if flag:
      ans = True

if ans:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys
def input():
    return sys.stdin.readline()[:-1]
H,W = map(int,input().split(' '))
A = -(-W//2)
if W==1 or H==1:
    print(1)
    exit()
if H%2==0:
    print(W*H//2)
else:
    print(W*(H-1)//2+A)
# Judge status: Accepted
n,m=map(int,input().split())
part1 = n
part2 = m
if n*2 < m:
    part3 = (m-(n*2))//4
    print(n+part3)
elif n*2 > m:
    print(m//2)
# Judge status: Wrong Answer
n = int(input())
cnt_tb = [0]*n
for i in range(1, n + 1):
    j = 1
    tmp = i*j
    while (tmp < n):
        cnt_tb[tmp] += 1
        j += 1
        tmp = i*j
ans = 0
for i, cnt in enumerate(cnt_tb):
    ans += (i + 1) * cnt
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())

ans = 0
if n*2 <= m:
    ans += n + (m-n*2)//4
    print(ans)
else:
    ans += m//2
    print(ans)
# Judge status: Wrong Answer
n = int(input())
count = 0

for a in range(1,10**6):
  if n - a <= 0:
    exit()
  for b in range(a,10**6):
      if n - a*b > 0:
        if a == b:
        	count += 1
        else:
          count += 2
      if n -a*b <= 0:
        break

print(count)
# Judge status: Accepted
N = int(input())
CSF = [list(map(int, input().split())) for i in range(N-1)]

import math

for i in range(N):
    time = 0
    for csf in CSF[i:]:
        if time <= csf[1]:
            time = csf[1] + csf[0]
        else:
            time = math.ceil((time - csf[1]) / csf[2])*csf[2] + csf[1] + csf[0]
    print(time)
# Judge status: Accepted
a, b = map(int, input().split())
print(-(-(b-1)//(a-1)))
# Judge status: Wrong Answer
s=list(input())
t=list(input())
s.sort()
t.sort()
if s==t:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
r = int(input())

m = 3.14159265359*r*r
ans = int(m/3.14)
print(ans)
# Judge status: Accepted
store = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
s = input()
print(store[s])
# Judge status: Accepted
s = input()[::-1]  # 反転
template = list('dream dreamer erase eraser'.split())
template = [c[::-1] for c in template]  # 反転

while s:
    for c in template:
        if s.startswith(c):
            s = s[len(c):]
            break
    else:
        break
print("YES") if s == "" else print("NO")
# Judge status: Wrong Answer
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))
one_idx = A.index(1)
before = math.ceil(one_idx / (K - 1))
after = math.ceil((N - one_idx - 1) / (K - 1))
print(before + after)
# Judge status: Accepted
# Red or Not

a = int(input())
s = input()

if a < 2800 or 5000 <= a:
    print('数値が範囲外です')
if len(s) < 1 or 10 < len(s):
    print('文字数が範囲外です')
elif a < 3200:
    print('red')
else:
    print(s)
# Judge status: Accepted
line = input()
A, B = [int(n) for n in line.split()]
if A > 8 or B > 8:
    print(":(")
else:
    print("Yay!")
# Judge status: Accepted
"""
1度の操作で最大+2できる
隣り合う箇所はN-1
LないしRが連続している箇所をグループとして見ると、求める数は
  N-1-隣り合うグループが異なっている場所の個数
= N-1-(グループの個数-1)
"""
import sys
sys.setrecursionlimit(10**6)
n, k = map(int, input().split())
s = input()

score = 0
for i in range(n-1):
    if s[i] == s[i+1]: score += 1

ans = min(score+2*k, n-1)
print(ans)
# Judge status: Wrong Answer
str1, str2 = [s for s in input().split()]
a = str1*int(str2)
b = str2*int(str1)
if str1 > str2:
  print(b)
elif str1 < str2:
  print(a)
else:
  print(a)
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(105,n+1,2):
    c=0
    for d in range(1,i+1,2):
        if i % d == 0:
            c+=1
    if c == 8:
        ans += 1
print(ans)
# Judge status: Wrong Answer
def nCr(n, r):
    mod=10**9+7
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

x,y=map(int,input().split())
if (x+y)%3 or max(x,y)>min(x,y)*2:
   print(0)
   exit()

f=(x+y)//3
m=-(1/3)*x+(2/3)*y
n=f-m

print(nCr(int(f),int(m)))
# Judge status: Accepted
N = int(input())
S = []
for i in range(N):
    S.append(int(input()))
S.sort()
if sum(S)%10!=0:
    print(sum(S))
else:
    for i in range(N):
        if S[i]%10!=0:
            print(sum(S)-S[i])
            break
        elif i==N-1:
            print(0)
            break
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

cnt = 0
cnt1 = 0
for i in range(len(a)):
    if(a[i]%4==0):
        cnt += 1
    elif(a[i]%2 == 0):
        cnt1 += 1

if(cnt+cnt1//2 >= N//2):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
a = map(int, input().split())
# N = 3
# a = [200, 300, 500]

s = sorted(a)
t = 0
result = 0
for i in range(0, N-1):
    if i == N - (N - 1):
        result = (t + s[i+1]) / 2
    z = (s[i] + s[i+1]) / 2
    t = z
print(result)
# Judge status: Wrong Answer
[N,K] = list(map(int,input().split()))
x = list(map(int,input().split()))

#連続する蝋燭を全探索
l=0
r=K-1

ans=2*(10**8)+1
for i in range(N-K+1):
    print('x[l], x[r]:', x[l], x[r])
    # ans = min(ans, min(abs(x[l]), abs(x[r])) + x[r]-x[l])
    l+=1
    r+=1

print(ans)
# Judge status: Wrong Answer
N, M = list(map(int,input().split()))
s = [0]*M
c = [0]*M
for i in range(M):
    s[i], c[i] = list(map(int,input().split()))
    s[i] -= 1

err = False

digit = [0]*N
digit_bool = [False]*N

for i in range(M):
    if digit_bool[s[i]]:
        if digit[s[i]] != c[i]:
            err = True
    else:
        digit[s[i]] = c[i]
        digit_bool[s[i]] = True

if digit[0] == 0:
    err = True

if err:
    print('-1')
else:
    print(''.join(list(map(str,digit))))
# Judge status: Accepted
N, K = list(map(int, input().split()))
print(min(N%K,abs(N-((N//K)+1)*K)))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

num4 = 0
num2 = 0
for i in range(n):
    if a[i]%4 == 0:
        num4 += 1
    elif a[i]%2 == 0:
        num2 += 1

#print(num4, num2)



if n-num4*2 <= 1:
    print("Yes")
elif n-num4*2 <= num2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S = int(input())
X1 = 0
Y1 = 0
X2 = 10**9
Y2 = 1
X3 = S%(10**9)
Y3 = S//(10**9)
if X3 != 0:
  Y3 += 1
  X3 = X2 - X3
print(X1,Y1,X2,Y2,X3,Y3)
# Judge status: Wrong Answer
s = input()
s_len = len(s)
check = s[0:2]
if s_len == 2 and s[0] != s[1]:
    print(2)
    exit()
s = s+"1"
ind = 1
ans = 1
for i in range(2,s_len):
    if check == s[ind+1]:
       check = s[ind+1:ind+3]
       ind += 1
    else:
       check = s[ind+1]
    ind += 1
    ans += 1
    if ind >= s_len-1:
        break
if ind == s_len+1 and s[s_len-1] == s[s_len-2]:
    ans -= 1
print(ans)