peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys
input = lambda : sys.stdin.readline().rstrip()

n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = []
for _ in range(m):
    bc.append(list(map(int, input().split())))
bc = sorted(bc, reverse=True, key=lambda x: x[1])
cnt = n
for b, c in bc:
    if cnt <= b:
        for i in range(cnt):
            a.append(c)
        break
    else:
        for i in range(b):
            a.append(c)
        cnt -= b
a = sorted(a, reverse=True)
print(sum(a[:n]))
# Judge status: Accepted
N, T = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
Y = [x for x in X if x[1]<=T]
Z = [y[0] for y in Y]
print("TLE" if Y==[] else min(Z))
# Judge status: Wrong Answer
ais = map(int, raw_input().split(' '))
total = sum(ais)
ais.sort()
cumul = 0
i = 0
j = 0
m = abs(total)
while(j< len(ais)):
	while(j < len(ais) and ais[j] == ais[i]):
		cumul += ais[j]
		j+=1
	i = j
	m = min(m, abs(2 *cumul + total))
print m
# Judge status: Accepted
l, r = map(int, input().split())

ans = 2018**2
for i in range(l, min(r, l+2019)):
    v = i % 2019
    for j in range(l+1, min(r+1, l+2020)):
        w = j % 2019
        ans = min(ans, (v*w)%2019)
print(ans)
# Judge status: Wrong Answer
s = input()
count = 0
print(count)
# Judge status: Accepted
import sys
s = input()
pre = []
back = []
for i in range((len(s)-1)//2):
    pre.append(s[i])
s1 = ''.join(pre)

for i in range((len(s)+3)//2-1,len(s)):
    back.append(s[i])
s2 = ''.join(back)

if s != s[::-1]:
    print('No')
    sys.exit()
elif s1 != s1[::-1]:
    print('No')
    sys.exit()
elif s2 != s2[::-1]:
    print('No')
    sys.exit()
print('Yes')
# Judge status: Wrong Answer
s = open(0).read().rstrip()
n = len(s)

from collections import defaultdict
ans = defaultdict(int)
ans[-2] = -1
ans[-1] = -1
ans[0] = 1

for i in range(1,n):
    if s[i] != s[i-1]:
        ans[i] = ans[i-1]+1
    else:
        ans[i] = ans[i-3]+2

print(ans[n-1])
# Judge status: Accepted
n = input()
check = [input() for i in range(int(n))]

print('AC x %d' % check.count('AC'))
print('WA x %d' % check.count('WA'))
print('TLE x %d' % check.count('TLE'))
print('RE x %d' % check.count('RE'))
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
print('YES' if A <= C <= B else 'NO')
# Judge status: Wrong Answer
N = int(input())
A = list(input())
B = [0]*N
C = [0]*N
for i in range(N):
  if A[i] == "I":
    B[i] = 1
  else:
    B[i] = -1
C[0] = B[0]
for i in range(1, N):
  C[i] = C[i-1]+B[i]
print(max(C))
# Judge status: Accepted
A,B=map(int,input().split())
if (A+B)%3==0 or A%3==0 or B%3==0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
n = int(input())
d = list(map(int, input().split()))
d.sort()
index = n//2
if d[index-1]==d[index]:
    print(0)
else:
    print(d[index]-d[index-1])
# Judge status: Accepted
a = int(input())
b = int(input())
print(6-a-b)
# Judge status: Accepted
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

N, K, Q = map(int, input().split())
counter = Counter(int(input()) - 1 for _ in range(Q))
for i in range(N):
    if K - (Q - counter[i]) > 0:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    for x in range(1, n):
        if int(x * 1.08) == n:
            print(x)
            return
    
    print(":(")

main()
# Judge status: Wrong Answer
A,B,M=map(int,input().split())
aa=list(map(int,input().split()))
bb=list(map(int,input().split()))
coupon=[list(map(int,input().split())) for i in range(M)]
min=2*(10**5)
for j in range(M):
    p_a=coupon[j][0]
    p_b=coupon[j][1]
    p_c=coupon[j][2]
    ans=aa[p_a-1]+bb[p_b-1]-p_c
    if ans<min:
            min=ans
print(min)
# Judge status: Accepted
import sys
a,b,c,k = [int(_) for _ in input().split()]

ans = 0
if a >= k: #
  print(k)
  sys.exit()
else:
  ans = a
  k = k -a

if k != 0 and k - b > 0:
  print(a-(k-b))
else:
  print(a)
# Judge status: Accepted
N, M = map(int, input().split())

ans = [-1] * N

for i in range(M):
  s, c = map(int, input().split())
  s -= 1
  if ans[s] != -1 and ans[s] != c:
    print(-1)
    exit()
  ans[s] = c
  
if N != 1:
  if ans[0] == 0:
    print(-1)
    exit()
  
  if ans[0] == -1:
    ans[0] = 1
    
  for i in range(N):
    if ans[i] == -1:
      ans[i] = 0

else:
  if ans[0] == -1:
    ans[0] = 0
    
print(''.join(map(str, ans)))
# Judge status: Accepted
n = int(input())
List = list(map(int, input().split()))

Ans = [0 for _ in range(n)]

for i in range(n):
    Ans[List[i]-1] = i + 1

print(*Ans)
# Judge status: Accepted
S=input()
T=input()
lens=len(S)
lent=len(T)

ans=0
for i in range(lens-lent+1):
    tmp=0
    for j in range(lent):
        if S[i+j]==T[j]:
            tmp+=1
        if tmp>ans:
            ans=tmp

print(lent-ans)
# Judge status: Accepted
S=input()
T=input()

ans=0
for s,t in zip(S,T):
    if s!=t:
        ans+=1
print(ans)
# Judge status: Wrong Answer
L=int(input())
ans=[]
for i in range(1,1000):
    for j in range(1,1000):
        k=L-(i+j)
        ans.append(i*j*k)
print(max(ans))
# Judge status: Accepted
s=input()

a=[0]*(len(s)+1)

prev=0
for i in range(len(s)):
    if s[i]=='<':
        a[i+1]=a[i]+1

for j in range(len(s)-1,-1,-1):
    if s[j]=='>':
        if a[j]>a[j+1]+1:
            continue
        else:
            a[j]=a[j+1]+1

print(sum(a))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

B = [0]*(N+1)

for i in range (0, N):
	B[A[i]]+=1
    
C = 0
import math

for i in range (1, N+1):
	C+=math.comb(B[i],2)
    
for i in range (0, N):
	print(C+math.comb(B[A[i]]-1,2)-math.comb(B[A[i]],2))
# Judge status: Wrong Answer
k = int(input())
s = str(input())
if k>=len(s):
  print(s)
else:
  a = s+s[0:k]
  print(a)
# Judge status: Accepted
S = input()
T = input()

s_len = len(S)
t_len = len(T)
R = s_len - t_len
ans = 1000

for i in range(R + 1):
  s_new = S[i : t_len + i]
  count = 0
  for j in range(t_len):
    if s_new[j] != T[j]:
      count += 1
  ans = min(ans, count)

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = [int(i) for i in input().split()]

len_f = sum(a)
sum_a = 0
min = 2020202021

for i in range(1,len(a)):
    sum_a += a[i]
    len_f -= a[i]
    if min > abs(sum_a - len_f):
        min = abs(sum_a - len_f)

print(min)
# Judge status: Wrong Answer
li = list(input())
print(li[1]+li[0])
# Judge status: Accepted
def resolve():
    N = int(input()[-1])
    hon = [2, 4, 5, 7, 9]
    pon = [0, 1, 6, 8]

    if N in hon:
        print('hon')
    elif N in pon:
        print('pon')
    elif N == 3:
        print('bon')

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
N = int(input())
P = []
for _ in range(N):
    P.append(list(map(int, input().split())))

total = 0
for i, p1 in enumerate(P[:-1]):
    for p2 in P[i+1:]:
        total += ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5

print(total * 2 / N)
# Judge status: Accepted
N=int(input())
import math
print(360//math.gcd(360,N))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
a=0
b=0
for num in A:
    if num%2==1:
        a+=1
    elif num%4==0:
        b+=1

if N%2==1:
    if a>b+1:
        print('No')
    else:
        print('Yes')
else:
    if a<=b:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
l=list(set(s))
print(max(0,max(s.count(l[i])-t.count(l[i]) for i in range(len(l)))))
# Judge status: Wrong Answer
x,a,b = map(int, input().split())  
d = b-a

if (d <= 0):
    print('delicious ')
elif(d < x):
    print('safe')
else:
    print('dangerous')
# Judge status: Accepted
n,k,s = map(int,input().split())
INF = 10**9

ans = [INF] * n

if s == INF:
    ans = [1] * n

for i in range(k):
    ans[i] = s
    
print(*ans)
# Judge status: Wrong Answer
n = int(input())
if(n % 4 == 0):
  print('Yes')
elif(n % 7 == 0):
  print('Yes')
elif(n % 11 == 0):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import collections

s = input()
cnt = collections.Counter()

for i in s:
    cnt[i] += 1


if all([True if i % 2 == 0 else False for i in cnt.values()]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n,k=map(int,input().split())
a,b,c=map(int,input().split())
s=input()
l=['']*k
for i in range(n):
  l[i%k]+=s[i]
ans=0
d={'s':a,'p':b,'r':c}
for i in range(k):
  x=l[i]
  for j in range(len(x)//2):
    if x[2*j]==x[2*j+1]:
      ans+=d[x[2*j]]
    else:
      ans+=(d[x[2*j]]+d[x[2*j+1]])
  if len(x)%2==1:
    ans+=d[x[-1]]
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
s = []
c = []
for m in range(M):
    si, ci = map(int, input().split())
    s.append(si)
    c.append(ci)

ss = 10 ** (N - 1)
if N == 1:
    ss -= 1

for i in range(ss, 10 ** N):
    for m in range(M):
        if str(i)[s[m] - 1] != str(c[m]):
            break
    else:
        print(i)
        exit()

print(-1)
# Judge status: Accepted
a, b = map(int, input().split())
if (a*b)%2 == 1:
  print("Odd")
else:
  print("Even")
# Judge status: Wrong Answer
i=0
N,D=map(int,input().split())
for i in range(N):
    X,Y=map(int,input().split())
    if (X**2+Y**2)**0.5<=D:
        i=i+1
print(i)
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int,input().split()))
    m = 0
    for i in range(n):
        if a[i]<0:
            m += 1
    ans = 0
    for i in range(n):
        ans += abs(a[i])
    if m%2==0:
        print(ans)
    else:
        mi = float('inf')
        for i in range(n):
            if mi>abs(a[i]):
                mi = abs(a[i])
        print(ans-2*mi)

if __name__ == "__main__":
    main()
# Judge status: Accepted
li=list(map(int,input().split()))
ans = 'YES' if (li.count(5) == 2) and (li.count(7) == 1) else "NO"
print(ans)
# Judge status: Accepted
from fractions import gcd
A, B = map(int, input().split())

print(A*B//gcd(A, B))
# Judge status: Accepted
N = int(input())
S = input()
if N % 2 != 0:
    print('No')
    exit()
H = int(N / 2)
if S[:H] == S[H:]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A, B, T = map(int, input().split())
ans = 0
time = A
while time < T+0.5:
    time += A
    ans += B
print(ans)
# Judge status: Wrong Answer
N = int(input())
MOD = 1e+9 + 7
shift = 70
a = [int(i) for i in input().split()]

b = [0 for _ in range(shift)]

for i in a:
  for j in range(shift):
    b[j] += (i >> j) & 1

ans = 0
for i, j in enumerate(b):
  second = 1
  for _ in range(i):
    second *= 2
    second %= MOD
  ans += ((j * (N - j)) * second) % MOD
  ans %= MOD
  
print(int(ans))
# Judge status: Wrong Answer
import collections
import heapq
n = int(raw_input())
ais = [0] + map(int, raw_input().split(' ')) 
res = [0 for __ in range(n +1)]
for u in range(n, 0, -1):
	c = u*2
	cumul = 0
	while(c <= n):
		cumul += res[c]
		c += u
	if ais[u] != (cumul % 2): 
		res[u] = 1
s = sum(res)
print s
if s:
	print ''.join([str(i) for i in range(len(res)) if res[i] == 1])
# Judge status: Accepted
# -*- coding: utf-8 -*-
# 整数の入力
lst = list(map(int, input().split()))

if lst[0] == 5:
    if (lst[1] == 7 and lst[2] == 5) or (lst[1] == 5 and lst[2] == 7):
        print("YES")
        exit()

elif lst[0] == 7:
    if lst[1] == 5 and lst[2] == 5:
        print("YES")
        exit()

print("NO")
# Judge status: Accepted
A, B, C, K = map(int, input().split())

# 1回後 A:B+C B:A+C C:A+B   A-B = B-A
# 2回後 A:2A+B+C B:A+2B+C C:A+B+2C    A-B = A-B

if K % 2 == 0:
    print(A - B)
else:
    print(B - A)
# Judge status: Wrong Answer
#!/usr/bin/env python3


def main():
    L, R = map(int, input().split())
    if R - L > 2017:
        print(0)
        return
    ans = min([n % 2019 for n in range(L, R + 1)])
    ans = ans * (ans + 1)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
from math import gcd
k = int(input())
sum = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        for k in range(1, k + 1):
            sum += gcd(gcd(i, j), k)
print(sum)
# Judge status: Accepted
import math

N = 10000000019
N = 50
N = 10
N = int(input())

result = []
for i in range(1, math.ceil(math.sqrt(N))+1):
    if N % i == 0:
        result.append((i + (N // i)) - 2)

print(min(result))
# Judge status: Accepted
import math
n=int(input())
print(math.factorial(n)%(10**9+7))
# Judge status: Accepted
import heapq
import math

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

# 各要素に1掛ける
A = list(map(lambda x: x * -1, A))
heapq.heapify(A)

for _ in range(M):
    heapq.heappush(A, ((-1*heapq.heappop(A))//2)*-1 )

print(sum(A) * -1)
# Judge status: Accepted
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N = inp()
B = inlist()
A = [0] * N
A[0] = B[0]
for i in range(N-2):
    A[i+1] = min(B[i], B[i+1])

A[N-1] = B[N-2]
print(sum(A))
# Judge status: Accepted
a = int(input())
l = list(map(int,input().split()))
d = [0]*a
for i in l:
    d[i]+=1
r =1
if  l[0]!=0:
    print(0)
    exit()
for i in l[1:]:
    r=r*d[i-1]%998244353
print(r)
# Judge status: Wrong Answer
s=list(input())

l=[]
for i in s[1::2]:
  l.append(i)

new_l=[]
for i in s[::2]:
  new_l.append(i)

num =0
for i in new_l:
  if i == 'R' or i == 'U' or i == 'D':
    num='Yes'
  else:
    num='No'
    break

ans=0
for i in l:
  if i == 'L' or i == 'U' or i == 'D':
    ans='Yes'
  else:
    ans='No'
    break
if num == 'Yes' and ans == 'Yes':
  print('Yes')
else:
  print('No')
# Judge status: Accepted
Array =  ["SUN","MON","TUE","WED","THU","FRI","SAT"] 
S = input()

print(abs(Array.index(S)-7))
# Judge status: Wrong Answer
import sys
n = int(input())
v = list(map(int,input().split()))
v.sort()
ans,tmp = [],[]
gab = (v[0]+v[1])/2
tmp.append(gab)
if n == 2:
  print(tmp[0])
  sys.exit()
for i in range(2,n):
  j = 0
  tmp.append((v[i] +tmp[j])/2)
  j += 1
print(tmp[-1])
# Judge status: Accepted
S = input()[::-1]
remain_table = [0] * 2019
remain_table[0] = 1
d = 1
chk = 0
for s in S:
    chk += int(s) * d
    chk = chk % 2019
    remain_table[chk] += 1
    d *= 10
    d %= 2019

ans = 0
for r in remain_table:
    ans += r * (r - 1) // 2
print(ans)
# Judge status: Accepted
n = int(input())
q = [int(input())  for i in range(n)]
cnt = 0
ind = 0
for i in range(n):
    ind = q[ind]-1
    cnt += 1
    if ind == 1:
        print(cnt)
        exit()
    
print(-1)
# Judge status: Accepted
l = []
l.append(input())
l.append(input())
if '1' not in l:
  print('1')
elif '2' not in l:
  print('2')
elif '3' not in l:
  print('3')
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
ans = 0
start = True
for i in range(101):
    if a <= i+1 <= b and c <= i+1 <= d:
        if start:
            start = False
            continue
        ans += 1
print(ans)
# Judge status: Accepted
n=int(input())
for i in range(0,n):
  if n<2**(i+1):
    ans=2**i
    break
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())

a = [[1, False] for _ in range(n+1)]
a[1] = [1, True]

for _ in range(m):
    x, y = map(int, input().split())
    if a[x][1]:
        a[x][0] -= 1
        if a[x][0] == 0:
            a[x][1] = False
        a[y][0] += 1
        a[y][1] = True

print(sum(x[1] for x in a))
# Judge status: Accepted
print(eval(input().replace(" ","+"))%24)
# Judge status: Accepted
#B

S = input()
print("x"*len(S))
# Judge status: Accepted
#coding: utf-8

N, K = (int(i) for i in input().split()) 
S = input()

while "LL" in S:
    S = S.replace("LL", "L")

while "RR" in S:
    S = S.replace("RR", "R")

sad = N - len(S)
sad += K * 2

sad = min(N-1, sad)
print(sad)
# Judge status: Accepted
n = input()
for i in range(3):
    if n[i] == n[i+1]:
        print("Bad")
        exit()
print("Good")
# Judge status: Wrong Answer
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
A=[(e,i) for i,e in enumerate(list(map(int,input().split())))]
#print(A)
A.sort(key=lambda tup: tup[0])
#print(A)
for e,i in A:
    print(e, i+1)
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(len(p)):
  if p[i] != i+1:
    cnt += 1
if cnt==0 or cnt==2:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if (b-a)>=(c-b):
  print(c-b)
else:
  print(b-a)
# Judge status: Accepted
# 最大公約数を格納するリストを初期化
max_codiv = []
 
# 繰り返す数を入力
n = int(input())
 
import math
# 1からkまでの総当たりで最大公約数を調べる
for i in range(1, n+1):
	for j in range(1, n+1):
		i_j = math.gcd(i, j)
		for k in range(1, n+1):
			i_j_k = math.gcd(i_j, k)
			max_codiv.append(i_j_k)
print(sum(max_codiv))
# Judge status: Wrong Answer
x = list(map(int, input().split()))
print(x)
for i in range(5):
  if x[i] == 0:
    print(i+1)
    exit()
# Judge status: Wrong Answer
h = input()
if "hi" in h:
    print("No")
elif len(h.replace("hi","")) < len(h):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, M = map(int,input().split())
oks = [True]*(N+1)
mod = 1e9+7
for i in range(M):
    a = int(input())
    oks[a]=False
dp = [0]*(N+1)
dp[0]=1
if oks[1]:
    dp[1]=1
else:
    dp[1]=0
for i in range(2,N+1):
    if oks[i]:
        dp[i]=dp[i-1]+dp[i-2]
        dp[i]%=mod
print(int(dp[N]))
# Judge status: Accepted
H,N=map(int,input().split())
magic=[]
for _ in range(N):
    A,B=map(int,input().split())
    magic.append((A,B))

inf=float("inf")
dp=[inf]*(H+1)
dp[0]=0

for i in range(H):
    for a,b in magic:
        d=min(i+a,H)
        dp[d]=min(dp[d],dp[i]+b)
print(dp[H])
# Judge status: Accepted
a=int(input())
b=int(input())
h=int(input())
print(((a+b)*h)//2)
# Judge status: Accepted
N = int(input())
list = list(map(int, input().split()))

newlist = sorted(list)

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

if cnt == 0 or cnt == 2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
from collections import Counter, deque, defaultdict
from functools import lru_cache

a,b,c=map(lambda x:int(x),input().split())
if (a==b and b==c ) or (a!=b and b!=c and c !=a):
	print("No")
else:
	print("Yes")
# Judge status: Accepted
x = int(input())

lis = []
for n in range(32):
    for e in range(2,11):
        if n**e <= x:
            lis.append(n**e)
se = set(lis)
print(max(se))
# Judge status: Accepted

N = int(input())
#N,K = map(int, input().split())
flag = False
lst = list(map(int, input().split()))
for elem in lst:
    if elem % 2 == 0:
        if ((elem % 3)==0) or ((elem % 5) ==0):
            pass
        else:
            flag = True
            break
if flag:
    print('DENIED')
else:
    print('APPROVED')
# Judge status: Wrong Answer
n = int(input())
a = []
b = []
for i in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
a.reverse()
b.reverse()

ans = 0
for i in range(n):
    ai = a[i]+ans
    bi = b[i]
    if ai%bi != 0 or ai == 0:
       ans += bi-ai%bi
print(ans)
# Judge status: Wrong Answer
s=input()
t=input()
l=len(s)
for _ in range(l-1):
  if s==t:
    print("Yes")
    exit()
  else:
    s=s[-1]+s[:l-1]
print("No")
# Judge status: Wrong Answer
a,b= map(int, input().split())

if a<=b:
        print(a)
else:
        print(a-b)
# Judge status: Wrong Answer
import bisect as bi
def fact(n):
  arr=[]
  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.append([i,cnt])
  if temp!=1:
    arr.append([temp,1])
  if arr==[]:
    arr.append([n,1])
  return arr
n=int(input())
l=[i*(i+1)//2 for i in range(1,100)]
c=0
for t in fact(n):
  c+=bi.bisect_right(l,t[1])
print(c)
# Judge status: Wrong Answer
line1 = str(input())
line2 = str(input())

newline1 = line2[::-1]
newline2 = line1[::-1]

if newline1==line1 and line2==newline2:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from fractions import gcd
def resolve():
    S=input()
    st=set()
    for s in S:
        if s in st:print("no");return
        st.add(s)
    print("yes")
    
        
#%%submit!    
resolve()
# Judge status: Accepted
N = int(input())
if N%2 ==1:
    N += 1
print(int(N/2))
# Judge status: Accepted
n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]

aabbcc = [[0], [0], [0]]
tmp = [0]*3
for i in abc:
  for j in range(3):
    tmp[j] = i[j] + max(aabbcc[(j+1)%3][-1], aabbcc[(j+2)%3][-1])
  for j in range(3):
    aabbcc[j].append(tmp[j])
print(max([i[-1] for i in aabbcc]))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
if N == len(list(set(A))):
  print('YES')
else:
  print('NO')
# Judge status: Accepted
o="RUD"
g="LUD"

s=input()

i=0
while i<len(s):
  #print(s[i],i%2)
  if i%2==0:
    if s[i] =="L":
      print("No")
      exit()
  else:
    if s[i]=="R":
      print("No")
      exit()
  i+=1
  
print("Yes")
# Judge status: Accepted
n, a, b = map(int, input().split())

ans = 0

for i in range(1, n+1):
    sum = 0
    x = i
    while x > 0:
        sum += x % 10
        x = x//10
    if sum >= a and sum <= b:
        ans += i
        
print(ans)
# Judge status: Accepted
N,x=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
for i in range(N):
  cnt+=max(A[i]-x,0)
  A[i]=min(A[i],x)
for i in range(1,N):
  d=max(A[i]+A[i-1]-x,0)
  A[i]-=d
  cnt+=d
print(cnt)
# Judge status: Accepted
s = str(input())

S = []
temp = ''
for c in s:
    temp += c
    if S:
        if S[-1] != temp:
            S.append(temp)
            temp = ''
    else:
        S.append(temp)
        temp = ''
print(len(S))
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))

L.sort(reverse = True)
i = j = k = 0
cnt = 0

while i<len(L)-2:
    j = i + 1
    while j<len(L)-1:
        k = j + 1
        if L[i] != L[j]:
            while k<len(L):
                if L[j] != L[k] and L[i] < L[j] + L[k]:
                    cnt += 1
                k += 1
        j += 1
    i += 1

print(cnt)
# Judge status: Accepted
a, b = map(int, input().split())

if (a+b)%2 == 0 :
    print((a+b)//2)
else :
    print("IMPOSSIBLE")
# Judge status: Accepted
s, t = map(str,input().split())
a, b = map(int,input().split())
u = input()
if u == s:
  print(a-1, b)
else:
  print(a, b-1)
# Judge status: Wrong Answer
n = int(input())
s = input()
from collections import Counter
c = dict(Counter(s))
ans = 0
for i in c:
    if ans==0:ans=c[i]
    else:
        ans *= c[i]+1
        ans += c[i]
print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
a=list(map(int,input().split()))
if K>=N:
	print(0)
else:
	b=sorted(a)
	c=0
	for i in range(N-K):
		c+=b[i]
	print(c)
# Judge status: Accepted
M=10**9+7
n,a,b=map(int,input().split())
s,r=pow(2,n,M),1
for i in range(b):r=r*(n-i)*pow(i+1,M-2,M)%M;s-=r*(i+1==a)
print((~r+s)%M)
# Judge status: Wrong Answer
def isp(str): return True if str == str[::-1] else False
a,b= map(int, input().split())
ans=0
for i in range(a,b+1):
  i_s=str(i)
  if isp(i_s):
    print(i)
    ans+=1

print(ans)
# Judge status: Accepted
x = int(input())
if x==0:
  print(1)
elif x==1:
  print(0)
# Judge status: Wrong Answer
n=int(input())
d =list(map(int,input().split()))
d.sort()
ans = 0
for i in range(1,10**5):
        if d[n//2-1] <i and d[n//2] >=i:
                ans +=1

print(ans)
# Judge status: Accepted
K,X = map(int, input().split())
 
for i in range(X-K+1,X+K):
	print(i,end = " ")