peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
s = input()
m = [{"char": c, "exists": True, "go_to_when_deleted": idx - 1} for idx, c in enumerate(s)]
for idx in range(0, len(s) - 1):
    jdx = idx
    while not m[jdx]["exists"]:
        jdx = m[jdx]["go_to_when_deleted"]
    if m[jdx]["char"] + m[idx + 1]["char"] == "ST":
        m[jdx]["exists"] = False
        m[idx+1]["exists"] = False
        m[idx+1]["go_to_when_deleted"] = m[jdx]["go_to_when_deleted"]
print(len("".join([c['char'] for c in m if c["exists"]])))
# Judge status: Accepted
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()
if N % 2 == 0:
    b = (B[N//2-1]+B[N//2])/2
    a = (A[N//2-1]+A[N//2])/2
    ans = (b-a)//0.5 +1
else:
    b = B[(N+1)//2-1]
    a = A[(N+1)//2-1]
    ans = b-a+1
print(int(ans))
# Judge status: Accepted
from collections import defaultdict
from collections import OrderedDict

N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k] += 1
    else:
        ans.update({k: 1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
# Judge status: Wrong Answer
n=int(input())
ans = 1
for i in range(n):
    inp = int(input())
    tmp = ans*inp
    while (ans % inp != 0):
        if (ans >= tmp):
            ans = tmp
            break
        ans+=ans
print(ans)
# Judge status: Wrong Answer
def ABC145B():
    N = int(input())
    S = input()

    if len(S) % 2 == 1:
        print('No')
    l = len(S) // 2
    if S[:l] == S[(-1 * l):]:
        print('Yes')
    else:
        print('No')

ABC145B()
# Judge status: Wrong Answer
a=int(input())
b=input()
c=int(a/2)
d=0
e=a-1
i=0
while True:
    if (b[i]=='W'):
        for j in range(0,e+1)[::-1]:
            if b[j]=='R':
                d=d+1
                e=j-1
                break
    i=i+1
    if i>e: break
print(d)
# Judge status: Wrong Answer
NK = list(map(int, input().split()))
N = NK[0]; K = NK[1]
A = list(map(int, input().split()))
 
rlist = [0]*N
flag = 1
location = 1
div = 0
 
while flag>0:
    location = A[location-1]
    if rlist[A[location-1]-1] == 0:
        rlist[A[location-1]-1] = rlist[location-1]+1
    else:
        div = rlist[location-1]+1-rlist[A[location-1]-1]
        flag = -1
 
cnt = (K-rlist[A[location-1]-1])%div + rlist[A[location-1]-1]
 
result = 0
for i in range(cnt):
    result = A[result]-1
 
print(result+1)
# Judge status: Wrong Answer
n=int(input());print(800*n-60//15*200)
# Judge status: Wrong Answer
import math
import numpy
inp = int(input())-1
xxxx = list(map(int,input().split()))
list = []
for i in range(inp):
  i=i+1
  a = abs(sum(xxxx[0:i]) - sum(xxxx[i:inp]))
  list.append(a)
def func(x):
    return min(x)
print(int(func(list)-1))
# Judge status: Accepted
n = int(input())
cnt = 0
for i in range(n):
    if len(str(i+1))%2 != 0:
        cnt +=1
print(cnt)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    x=II()
    inf=10**9
    st=int(x**0.5)-1
    for i in range(st,inf):
        if(i+1)*i//2>=x:
            print(i)
            break

main()
# Judge status: Accepted
import fractions
a, b = map(int, input().split())

print(int(a*b / fractions.gcd(a,b)))
# Judge status: Accepted
a,b,c=map(int,input().split())
if a<=c and b>=c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import collections
MOD = 998244353

n = int(input())
d = [int(_) for _ in input().split()]

ans = 1
if d[0] != 0:
    ans = 0
else:
    D = sorted(collections.Counter(d).most_common())
    cnt = 0
    prev = 1
    for i in D:
        if i[0] == cnt:
            ans = ans * pow(prev, i[1], MOD) % MOD
            prev = i[1]
        else:
            ans = 0
            break
        cnt += 1
print(ans)
# Judge status: Accepted
from math import sqrt as r
from math import floor

N = int(input())
n = N - 1
ans = 0

for A in range(1, N):
    B = n // A
    ans += B

print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
if x%y==0:
  print(-1)
else:
  print(x)
# Judge status: Accepted
n = int(input())
l = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1,n):
            a = [l[i],l[j],l[k]]
            if len(set(a))!=3:
                continue
            a.sort()
            ans += a[0]+a[1]>a[2]
print(ans)
# Judge status: Accepted
def check(k):
    cnt = 0
    for i in range(1, k + 1):
        if k % i == 0:
            cnt += 1
    if cnt == 8:return 1
    else:return 0

n = int(input())
pre = [0] * n

for i in range(n):
    if i % 2 == 1:
        pre[i] = pre[i - 1]
    else:
        temp = check(i + 1)
        pre[i] = pre[i - 1] + temp
print(pre[n - 1])
# Judge status: Wrong Answer
n = int(input())
count=0
for i in range(1,1000):
    for j in range(1,1000):
        if (i*j)>=n:
            count+=j-1
            break
print(count)
# Judge status: Accepted
x = len(input())

ans = ""
for i in range(x):
    ans += "x"
print(ans)
# Judge status: Accepted
N, H = map(int, input().split())

lst = []
for _ in range(N):
    a, b = map(int, input().split())
    lst.append((a, 0))
    lst.append((b, 1))
lst.sort(reverse=True)

ans = 0
ceil = lambda a, b: (a + b - 1) // b

for p, q in lst:
    if q == 1:
        H -= p
        ans += 1
        if H <= 0:
            break
    else:
        ans += ceil(H, p)
        break
print(ans)
# Judge status: Wrong Answer
D, T, S = list(map(int, input().split()))
if int(D / S) <= T:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A,B,H,M = list(map(int,input().split()))

import math 

x = A**2+B**2-2*A*B*math.cos(math.radians(11*M/2-30*H))

print(math.sqrt(x))
# Judge status: Accepted
S = input()
ans = True
print("Yes" if ("N" in S) == ("S" in S) and ("E" in S) == ("W" in S) else "No")
# Judge status: Accepted
n,m,x,y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
X.append(x)
Y.append(y)
if max(X)<min(Y):
  print("No War")
else:
  print("War")
# Judge status: Accepted
N, C, K = map(int, input().split())
T = []
for _ in range(N):
    T.append(int(input()))
T = sorted(T)

# print(N, C, K)
# print(*T, end="\n")

# 現在の時刻
# 前から詰めていく (容量制約を忘れない)
count = 0
i = 0
while i < N:
    timax = T[i] + K
    # 乗せた人数
    c = 0
    count += 1
    while i < N and c < C and T[i] <= timax:
        c += 1
        i += 1
print(count)
# Judge status: Accepted
s = input()
n = len(s)
p = 0
ten = 1
cnt = [0] * 2019
cnt[0] = 1
ans = 0
for i in reversed(s):
    p = (p + int(i) * ten) % 2019
    ans += cnt[p]
    cnt[p] += 1
    ten = ten * 10 % 2019

print(ans)
# Judge status: Accepted
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    X,K,D =map(int,input().split())
    ans =10**19
    if X >= K*D:
        print(X-K*D)
    elif -X>= K*D:
        print(-X - K*D)

    else:
        X =abs(X)
        c =X//D
        if (K-c)%2  ==0:
            print(X-c*D)
        else:
            print(D*(c+1)-X)








if __name__ == "__main__":
    main()
# Judge status: Accepted
a,b,c = sorted(map(int,input().split()))

print(10*c+b+a)
# Judge status: Accepted
from collections import deque


S = list(input())
T = list(input())



dqS = deque(S)
dqT = deque(T)

cnt = 0

while dqS:
    tempS = dqS.popleft()
    tempT = dqT.popleft()
    if tempS != tempT:
        cnt += 1

print(cnt)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

M=0
i=0

while i < N:
  M += B[A[i]-1]
  if i>=1:
    if A[i]-A[i-1]==1:
      M +=  C[A[i-1]-1]
  i += 1

print(M)
# Judge status: Wrong Answer
#!/usr/bin/env python

n = int(input())
a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
for i in range(n):
    a[i], b[i] = map(int, input().split())

ans = 0 

for i in reversed(range(n)):
    if i!=0:
        a[i] += ans 
    if a[i]%b[i] == 0:
        continue
    else:
        ans += (a[i]//b[i]+1)*b[i]-a[i]

print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
r=[0]
l=[0]
ans=0
INF=10**9+7
for i in range(n+1):
    a=r[i]+i
    b=l[i]+n-i
    r.append(a)
    l.append(b)
#print(r)
#print(l)

for i in range(k,n+2):
    min_wa=r[i]
    max_wa=l[i]
    ans+=max_wa-min_wa+1
    
print(ans%INF)
# Judge status: Accepted
S=input()

if 1<=int(S[:2])<=12:
  if 1<=int(S[2:])<=12:
    print("AMBIGUOUS")
  elif 0<=int(S[2:])<=99:
    print("MMYY")
elif 0<=int(S[:2])<=99:
  if 1<=int(S[2:])<=12:
    print("YYMM")
  elif 0<=int(S[2:])<=99:
    print("NA")
# Judge status: Wrong Answer
val = 'b'
if val in 'abcdefghijklmnopqrstuvwxyz':
  ans = 'a'
else:
  ans = 'A'
  
print(ans)
# Judge status: Accepted
N, M, X, Y = list(map(int, input().split(" ")))

x_coord = list(map(int, input().split(" ")))
y_coord = list(map(int, input().split(" ")))

is_war = True

for Z in range(X, Y+1):
  if X < Z <= Y and max(x_coord) < Z and min(y_coord) >= Z:
    is_war = False
    break

if is_war:
  print("War")
else:
  print("No War")
# Judge status: Wrong Answer
n = int(input())
ls = list(map(int, input().split()))

curr = 1000
stock = 0

for i in range(n - 1):
    if ls[i] < ls[i + 1]:
        stock = curr // ls[i]
        curr -= stock * ls[i]
    elif ls[i] > ls[i + 1]:
        curr += stock * ls[i]
        stock = 0 

curr += stock * ls[i + 1]
stock = 0

print(curr)
# Judge status: Accepted
N = int(input())

BA = []
for i in range(N):
  A,B = map(int,input().split())
  BA.append([B,A])
  
BA.sort()

check = True
sum_A = 0
for j in range(N):
  sum_A += BA[j][1]
  if sum_A > BA[j][0]:
    check = False
    break
    
print("Yes" if check else "No")
# Judge status: Wrong Answer
A,B,C = map(int, input().split())
for i in range(1,B+1):
    if A*i % B == C:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
n = int(input())
C = list(input())

a, b = 0, 0
for i in range(n):
    if C[i] == "R":
        a += 1
    ans = max(a, b)

for i in range(n):
    if C[i] == "R":
        a -= 1
    else:
        b += 1
    tmp = max(a, b)
    ans = min(ans, tmp)

print(ans)
# Judge status: Accepted
S = list(input())
set_S = list(set(S))
if(len(set_S)==2):
    if((S.count(set_S[0])==2) and (S.count(set_S[1])==2)):
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Judge status: Accepted
s = input()
t = input()
S = sorted(s)
T = sorted(t,reverse=True)
#print(S,T)
ans = "W"
for i in range(min(len(s),len(t))):
    if S[i] > T[i]:
        ans = "No"
        break
    elif ans == "W" and S[i] == T[i]:
        ans = "W"
    elif ans == "W" and S[i] < T[i]:
        ans = "Yes"
        break
if ans == "W":
    if len(s) < len(t):
        ans = "Yes"
    else:
        ans = "No"
print(ans)
# Judge status: Accepted
N,M = list(map(int,input().strip().split()))

if 2*N > M:
  res = M // 2
else:
  res =  (M - 2*N)//4 + N

print(res)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
for i in range(n):
  if a[i]>=b[i]:
    cnt+=b[i]
    a[i]-=b[i]
    b[i]=0
  elif a[i]<b[i]:
    cnt+=a[i]
    b[i]-=a[i]
    a[i]=0
    temp=b[i]
    cnt+=min(b[i], a[i+1])
    b[i]=max(b[i]-a[i+1], 0)
    a[i+1]=max(a[i+1]-temp, 0)
print(cnt)
# Judge status: Accepted
from collections import defaultdict

d = defaultdict(int)
d=[0]*3
n = int(input())

for i in list(map(int, input().split())):
  if i % 4 == 0:
    d[2] += 1
  elif i % 2 == 0:
    d[1] += 1
  else:
    d[0] += 1
t = d[2] - d[1]
if (d[0] <= d[2]) or ((d[0] == d[2] + 1) and (d[1] == 0)):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
amount = int(input())
n_1yen = int(input())

fraction = amount % 500

if fraction <= n_1yen:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
x, y, z = map(int, input().split())
ans = 0
for i in range(z, 10**5):
    if (x-i) % (y+i) == 0:
        ans = (x-i) / (y+i)
        break
print(int(ans))
# Judge status: Accepted
N,K = map(int,input().split())
X = list(map(int,input().split()))
ls = []
rs = []
for x in X:
    if x < 0:
        ls.append(-x)
    else:
        rs.append(x)
ls.reverse()

ans = float('inf')
if len(ls) >= K:
    ans = min(ans, ls[K-1])
if len(rs) >= K:
    ans = min(ans, rs[K-1])

for l in range(1,K):
    if l > len(ls): break
    r = K-l
    if r > len(rs): continue
    ans = min(ans, ls[l-1]*2 + rs[r-1])
    ans = min(ans, rs[r-1]*2 + ls[l-1])
print(ans)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
cntf=0
cntno=0
for i in A:
  if i%4==0:
    cntf+=1
  if i%2==1:
    cntno+=1

if cntno>2:
  print('No')
elif cntno==0:
  print('Yes')
elif cntno==1:
  if cntf>0:
    print('Yes')
  else:
    print('No')
else:
  if N==3 and cntf>0:
    print('Yes')
  elif N>3 and cntf>1:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

cnt = 0
e = 0
while e == 0:
  for i in range(n):
    if a[i] % 2 == 0:
      a[i] = a[i]/2
      if i == n-1:
        cnt += 1
        
    else:
      e = 1
      break
      
print(cnt)
# Judge status: Accepted
import sys
from heapq import heapify, heappop, heappush

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
jobs = [[] for _ in range(M+1)]
for _ in range(N):
    a, b = lr()
    if a > M:
        continue
    jobs[a].append(b)

answer = 0
candidate = []
for i in range(1, M+1):
    for job in jobs[i]:
        heappush(candidate, -job)
    if candidate:
        answer += heappop(candidate)

answer *= -1
print(answer)
# 31
# Judge status: Wrong Answer
from math import ceil

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

if K >= N:
    print(1)
    exit()

one = A.index(1)
print(ceil((one)/(K-1)) + ceil((N-one-1)/(K-1)))
# Judge status: Accepted
from collections import defaultdict

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

roads = defaultdict(list)
for i in range(m):
    a, b = map(int, input().split())
    roads[a].append(b)
    roads[b].append(a)

ans = n
for i in range(n):
    for couho in roads[i + 1]:
        if h_s[i] <= h_s[couho - 1]:
            ans -= 1
            break

print(ans)
# Judge status: Accepted
import sys
import itertools
import math
input = sys.stdin.readline
N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
jisyo=[]
for i in range(1,N+1):
    jisyo.append(i)
ans =[]
for v in itertools.permutations(jisyo, N):
    ans.append(list(v))
print(abs(ans.index(P)-ans.index(Q)))
# Judge status: Wrong Answer
n = int(input())

count = 0

for i in range(1, n//2):
    temp = n // i
    if temp * i < n:
        count += temp
    else:
        count += temp - 1

print(count + n//2)
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
bh = h[0]


for i in range(1,n):
    if bh>h[i]:
        print("No")
        exit()
    elif h[i]>bh:
        bh = h[i]-1
    else:
        bh = h[i]

print("Yes")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt_1 = 0
for i in a:
    if i % 2 != 0:
        cnt_1 += 1

cnt_2 = 0
for i in a:
    if i % 2 == 0 and i % 4 != 0:
        cnt_2 += 1

cnt_4 = 0
for i in a:
    if i % 4 == 0:
        cnt_4 += 1

if cnt_4*2 + 1 >= n:
    print("Yes")
else:
    if cnt_4*2 + cnt_2 >= n:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
import sys
def main():
    input = sys.stdin.readline
    X = input().rstrip()
    
    ans = len(X)
    s_cnt = 0
    for x in X:
        if x == 'S': s_cnt += 1
        elif s_cnt > 0:
            s_cnt -= 1
            ans -= 2
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
print('ABC' if n<1000 else 'ABD')
# Judge status: Accepted
import sys
input = sys.stdin.readline

s = input().rstrip()
l = [0]*len(s)
k=0
for i in range(1,len(s)-1):
    if s[i] == s[i-1] and l[i-1] == 0:
        l[i]=1
        l[i+1]=1
        
if len(s) >1 and s[-1] == s[-2] and l[-2] == 0:
    l[-2] = 1
    l[-1]=1
print(len(s)-sum(l)//2)
# Judge status: Accepted
n, k = map(int, input().split())
s = list(input())

if s[k - 1] == "A":
    s[k - 1] = "a"
elif s[k - 1] == "B":
    s[k - 1] = "b"
else:
    s[k - 1] = "c"

print("".join(s))
# Judge status: Accepted
# coding: utf-8
# Your code here!
import fractions
from functools import reduce
N=int(input())
L=[]
for i in range(N):
    L.append(int(input()))
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
    
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(L))
# Judge status: Accepted
import sys
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            print("DENIED")
            sys.exit()

print("APPROVED")
# Judge status: Wrong Answer
def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

N = cin()
A = cin()
INF = 1e9 + 7

res = [0 for _ in range(65)]
for i in range(65):
    c0 = 0
    c1 = 0
    for j in range(N):
        if bool(A[j] & (1 << i)):  c1 += 1
        else:  c0 += 1
    res[i] = c0 * c1
ans = 0
for i in range(65):  ans = (ans + (2 ** i) * res[i]) % INF
print(int(ans))
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a > b:print(2*b-1)
elif b < a: print(2*a-1)
else:print(a+b)
# Judge status: Accepted
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = dict()
for _ in range(M):
    a, b = map(int, input().split())
    if a not in AB:
        AB[a] = [H[b-1]]
    else:
        AB[a].append(H[b-1])

    if b not in AB:
        AB[b] = [H[a-1]]
    else:
        AB[b].append(H[a-1])

cnt = 0
for n in range(1, N+1):
    if (n not in AB.keys()) or (max(AB[n]) < H[n-1]):
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
a, b, c = input().split()
print("Yes" if a <= c <= b else "No")
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=0
c=0
for i in range(n):
  if a[i]%2==0:
    if a[i]%4==0:
      c+=1
    else:
      b+=1
if b==0:
  print("Yes") if n<=3*c else print("No")
else:
  print("Yes") if n<=3*c+b-1 else print("No")
# Judge status: Wrong Answer
s=input()
t=input()
total=False
for i in range(len(s)):
    s=s[len(s)-1]+s[0:len(s)-1]
    print(s)
    if s==t:
        print("Yes")
        total=True
        break
if total==False:
    print("No")
# Judge status: Wrong Answer
n,m=map(int,input().split())
py=[list(map(int,(str(_+1)+' '+input()).split())) for _ in range(m)]
py.sort(key=lambda x:str(x[1])+','+str(x[2]))
print(py)
a=[]
pi=0
x=0
b='00000'
ans=[]
for pyi in py:
  if pyi[1]!=pi:
    x=1
    pi=pyi[1]
  else:
    x+=1
  ans.append([pyi[0],(b+str(pyi[1]))[-6:]+(b+str(x))[-6:]])
ans.sort(key=lambda x:x[0])
for ansi in ans:
  print(ansi[1])
# Judge status: Wrong Answer
K,X = map(int,input().split())
for i in range(X-K,X+K):
    print(i,end='')
# Judge status: Accepted
s = input()

if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
# Judge status: Wrong Answer
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
k,x=input2()

st=x-k+1
fi=x+k-1

for i in range(st,fi+1):
	print(i,end="")
# Judge status: Accepted
from collections import defaultdict
N = int(input())
actions = [int(i) for i in input().split()]

d = defaultdict(int)
for a in actions:
    d[a-1] += 1
    d[a] += 1
    d[a+1] += 1
print(sorted(d.items(), key=lambda x: -x[1])[0][1])
# Judge status: Wrong Answer
import collections
s = input()
s = list(s)
s = collections.Counter(s)
s = list(s.values())
flag = False
for i in s:
    if i!=2:
        flag = True
if flag==True:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
import sys
from collections import defaultdict

N = int(input())

memo = defaultdict(int)

for i in range(N):
    tmp = input()
    memo[tmp] += 1
    if i==0:
        last = tmp[-1]
        continue
    if memo[tmp]==2:
        print("No")
        sys.exit()
    else:
        if last != tmp[0]:
            print("No")
            sys.exit()
        last = tmp[-1]
else:
    print("Yes")
# Judge status: Accepted
S = input()
prev_si = ''
flag = False
for si in S:
    #print(prev_si, si)
    if si == prev_si:
        #print('Bad')
        flag = True
    prev_si = si

if flag:
    print('Bad')
else:
    print('Good')
# Judge status: Accepted
import itertools

n = int(input())

p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]

init = sorted(p)


# print(p, q, init)
countp, countq, count = 0, 0, 0

for array in itertools.permutations(init, n):
    # print(array)
    count += 1
    if(list(array) == p):
        countp = count
    if(list(array) == q):
        countq = count


print(abs(countp-countq))
# Judge status: Accepted
n = int(input())
print(n * (n - 1) // 2)
# Judge status: Accepted

import numpy as np

inf=10**7
n=int(input())
coin=[6**x for x in range(10)]
coin+=[9**x for x in range(1,10)]

dp=[0]*(n+1)
for (i,x) in enumerate(dp):
    dp[i]+=inf
dp[0]=0


for i in range(n+1):
    for x in coin:
        if(i+x<=n):
            dp[i+x]=min(dp[i+x],dp[i]+1)
print(dp[-1])
# Judge status: Accepted
# -*- coding: utf-8 -*-


#----------
X,A,B = list(map(int, input().rstrip().split()))
#----------
d=-A+B
print( "delicious" if d <= 0 else "safe" if d <= X else "dangerous")
# Judge status: Accepted
n = int(input())
l = []
for i in range(n):
    l.append(sorted(input()))
l.sort(key=len)
ans = []
for i in l[0]:
    for j in range(1, n):
        if i not in l[j]:
            break
        else:
            l[j].remove(i)
    else:
        ans.append(i)
print(*ans, sep="")
# Judge status: Wrong Answer
s=input();t=input();
cnt=0
for i in range(len(s)):
  if s[i]==t[i]:
    cnt+=1
    
    
print(cnt)
# Judge status: Accepted
S = input().strip()
k = 0
l = ""
r = ""
for s in S:
    r += s
    if l == r:
        continue
    l = r
    r = ""
    k += 1
print(k)
# Judge status: Accepted
n = int(input())
if n < 600:
    print(8)
elif n < 800:
    print(7)
elif n < 1000:
    print(6)
elif n < 1200:
    print(5)
elif n < 1400:
    print(4)
elif n < 1600:
    print(3)
elif n < 1800:
    print(2)
elif n < 2000:
    print(1)
# Judge status: Accepted
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T = sorted(T)

S = []
for i in range(N):
    S.append(T[i] + K)
ans = 0
bus = 0
count = 0
for i in range(N):
    if T[i] <= bus and count < C:
        count += 1
    else:
        bus = S[i]
        count = 1
        ans += 1
print(ans)
# Judge status: Wrong Answer
from collections import Counter
 
n = int(input())
a = list(map(int, input().split()))
 
c = Counter(a)
 
for _ in range(1, n):
  print(c[_])
# Judge status: Accepted
N = int(input())
D = {}

for k in range(2,10**6):
  while N%k<1:
    N//=k
    D[k]=D.get(k,0)+1

a = 0
for i in D.values():
  t = 0
  c = 0
  while t+c<i:
    c+=1
    t+=c
  a+=c
print(a+(N>1))
# Judge status: Wrong Answer
N = int(input())
print(N*(N-1)/2)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

sum = 0
for i in range(n):
    now = a[i] - 1
    pre = a[i-1] - 1
    sum += b[ now ]
    if i > 0 and now - 1 == pre:
        sum += c[ pre ]

print(sum)
# Judge status: Accepted
w = sorted(input())
if len(w)%2==1:
  print("No")
else:
  ans = ("Yes")
  for i in range(1,len(w),2):
    if not w[i]==w[i-1]:
      ans = ("No")
  print(ans)
# Judge status: Accepted
w = str(input())

d ={}

flg = True

for i in range(len(w)):
    temp = w[i]
    
    
    if temp in d:
        d[temp] += 1
    else:
        d[temp] = 1
        

for i in d.values():
    
    if i %2 !=0:
        flg= False
    
if flg == True:
    print("Yes")
else:
    print("No")