peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a, b = map(str, input().split())
c = int(a + b)
if int((c ** 0.5)) ** 2 == c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#変数の初期化
text = 0
count = 0

#入力値の格納
n = int(input())

#計算
while count < n:
    count += 1
    if (count % 3 != 0) and (count % 5 != 0):
        text = text + count

#表示
print(text)
# Judge status: Wrong Answer
N = int(input())

shiritori_set = set()

shiritori = input()
head = shiritori[len(shiritori) -1]

ans = "Yes"

for i in range(N-1):
  shiritori = input()
  if (shiritori[0] == head and shiritori not in shiritori_set):
    head = shiritori[len(shiritori)-1]
    shiritori_set.add(shiritori)
    continue
  else:
    ans = "No"
    break

print(ans)
# Judge status: Accepted
(a,b,x) = map(int,input().split())
if a==0:
    print(int(b//x)+1)
else:
    print(int(b//x)-int((a-1)//x))
# Judge status: Accepted
rgb = ''.join(input().split())

print('YES' if int(rgb) % 4 == 0 else 'NO')
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
sl = sorted(l)
if len(l) == len(sl):
    print('YES')
else:
    Print('NO')
# Judge status: Wrong Answer
from collections import defaultdict
import math
n = int(input())
d = defaultdict(int)
nums = set([])
for _ in range(n):
  s = input()
  m = 1
  for l in s:
    m *= ord(l)-95
  d[m] += 1

def comb(n, r):
  if n<r:
    return 0
  else:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = 0
for k in d.values():
  ans += comb(k,2)
print(ans)
# Judge status: Accepted
S = input()
List = ['SAT', 'FRI', 'THU', 'WED', 'TUE', 'MON', 'SUN']
length = len(List)

for i in (range(length)):
    if S == List[i]:
        print(i+1)
# Judge status: Wrong Answer
h=int(input())
w=int(input())
n=int(input())

print(n//max(h,w))
# Judge status: Accepted
N, x = map(int, input().split())
a = list(map(int, input().split()))

count = 0

for i, c in enumerate(a):
	try:
		j = a[i + 1]
	except IndexError:
		break
	while (a[i + 1] + c) > x:
		if (a[i + 1] + c) == x:
			break
		count += abs(x - (a[i + 1] + c))
		a[i + 1] -= abs(x - (a[i + 1] + c))
		if a[i + 1] <= 0:
			a[i + 1] = 0
			break
	else:
		continue

print(count)
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(a*int(b) if a<=b else b*int(a))
# Judge status: Accepted
import math

start, kai, step = map(int, input().split(" "))

if 0 <= abs(start) - (kai * step):
    print(abs(start) - (kai * step))
    exit()

ans1 = start % step
ans2 = abs(ans1 - step)
if (kai - abs(start // step)) % 2 == 0:
    print(abs(ans1))
else:
    print(abs(ans2))
# Judge status: Accepted
K = int(input())
print(K//2 * (K - K//2))
# Judge status: Wrong Answer
s = list(input())
s_len = len(s)
ans = 0
if s_len % 2 == 0:
  for i, j in zip(s[0 : (s_len // 2 )], reversed(s[(s_len // 2) : s_len + 1])):
    if i != j:
      ans += 1
else:
  for i, j in zip(s[0 : (s_len // 2  )], reversed(s[(s_len // 2 + 3) : s_len])):
    if i != j:
      ans += 1
print(ans)
# Judge status: Accepted
cc = [list(map(int, input().split())) for i in range(3)]
tc = [x for c in cc for x in c]

if sum(tc) % 3 != 0:
  print('No')
else:
  cnt = 0
  for i in range(3):
    cnt  += cc[i][i]
  if cnt == sum(tc)//3:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
L, R ,d = map(int,input().split())
q_L =  L // d
q_R =  R// d
answer = q_R -q_L
if L%d == 0:
    answer += 1
print(answer)
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))
even = [A[i] for i in range(0, N, 2)]
odd = [A[i] for i in range(1, N, 2)]
if N%2==0:
    ans = odd[::-1] + even
else:
    ans = even[::-1] + odd
print(*ans)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))

L.sort()
#print(L)

ans=0
for i in range(0, N-2):
    for j in range(i+1, N-1):


        left, right = j, N

        while right-left > 1:
            mid=(left+right) // 2
            if L[i]+L[j] <= L[mid]:
                right=mid
            else:
                left=mid
        ans += left - j
        #print(i,j,left)
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
o_cnt=0
t2_cnt=0
t4_cnt=0
for i in a:
    if i%2==1:
        o_cnt += 1
    elif i%4==0:
        t4_cnt += 1
    else:
        t2_cnt += 1

if t4_cnt > 0:
    if t4_cnt >= (o_cnt-n%2):
        print('Yes')
    else:
        print('No')
else:
    if t2_cnt==n:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
n, k, q = map(int, input().split())
m = [q] * n
for i in range(q):
    m[int(input()) - 1] -= 1
for i in m:
    if i >= k:
        print("No")
    else:
        print("Yes")
# Judge status: Wrong Answer
s = input()
n = len(s)

ans = 0

sub = 0
judge = False
for i in range(n-1, -1, -1):
  key = int(s[i])+sub
  if judge:
    if key <= 4:
      ans += key
      sub = 0
    elif key == 5:
      ans += 9-key
    else:
      ans += 9-key
      sub = 1
  else:
    if key <= 5:
      ans += key
      sub = 0
    else:
      ans += 10-key
      sub = 1
  if key == 5:
    judge = True
  else:
    judge = False

ans += sub

print(ans)
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
l_r_list = [[int(i) for i in input().split()] for _ in range(Q)]

tmp = [0] * N
cnt = 0
for i in range(1, N):
    if S[i-1] + S[i] == 'AC':
        cnt += 1
    tmp[i] = cnt

for l, r in l_r_list:
    print(tmp[r-1] - tmp[l-1])
# Judge status: Wrong Answer
n,k=map(int,input().split())
candle=list(map(int,input().split()))
ans=2000000000
for i in range(n-k):
  if candle[i]<0 and candle[i+k-1]>0:
    temp=min(abs(candle[i]), candle[i+k-1])*2+max(abs(candle[i]), candle[i+k-1])
  elif n==1 and candle[k]==0:
    ans=0
  elif candle[i+k-1]<=0:
    temp=abs(candle[i])
  elif candle[i]>=0:
    temp=candle[i+k-1]
  ans=min(temp, ans)
print(ans)
# Judge status: Accepted
X = int(input())
M = 1
for i in range(1, X):
    for p in range(2, 10):
        if M < i ** p <= X:
            M = i ** p

print(M)
# Judge status: Accepted
import bisect
import math

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

a.sort()

ans = sum(a)
for i in range(m):
    tmp = a.pop()
    ans -= tmp
    cost = math.floor(tmp/2)
    ans += cost
    idx = bisect.bisect_left(a,cost)
    a.insert(idx,cost)

print(ans)
# Judge status: Accepted
from functools import reduce
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a, b):
    return b // gcd(a, b) * a
n=int(input())
a=list(map(int,input().split()))
x=reduce(lambda x,y: lcm(x,y), set(a))
ans=0
for i in a:
  ans+=x//i
ans%=1000000007
print(ans)
# Judge status: Accepted
N=int(input())
Z=[0]*N
W=[0]*N

for i in range(N):
    x,y=map(int,input().split())
    Z[i]=x+y
    W[i]=x-y

alpha=max(Z)-min(Z)
beta=max(W)-min(W)
print(max(alpha,beta))
# Judge status: Accepted
N, x = map(int, input().split())
a = list(map(int, input().split()))
result = 0
if a[0] > x:
    result += a[0] - x
    a[0] = x
for i in range(N-1):
    if a[i] + a[i+1] > x:
        result += a[i] + a[i+1] - x
        a[i+1] = x - a[i]
print(result)
# Judge status: Accepted
n = int(input())
c = []
for i in range(n):
  a, b = input().split()
  c.append([i+1, a, -int(b)])

c = sorted(c, key=lambda x: (x[1], x[2]))
for i in c:
  print(i[0])
# Judge status: Accepted
import math
n,k = list(map(int, input().split()))
As = list(map(int,input().split()))
print(math.ceil((n-1)/(k-1)))
# Judge status: Wrong Answer
from sys import stdin
def main():
    readline=stdin.readline
    L=int(readline())
    print((L//3)**3)
if __name__=="__main__":
    main()
# Judge status: Accepted
h, a = map(int, input().split())
r = h // a
if h % a:
  r += 1
print(r)
# Judge status: Accepted
s = list(input())
ans = []
for i in s:
    if i == 'B':
        if len(ans) != 0:
            ans.pop()
    else:
        ans += i
print(''.join(ans))
# Judge status: Accepted
s = input()
dic = {"A":False,"B":False}
for c in s:
    dic[c] = True
if dic["A"] and dic["B"]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s = input("R=")
a = 2*3.1415936535*float(s)
print(a)
# Judge status: Accepted
from itertools import combinations
from collections import defaultdict
n = int(input())
l = list(map(int, input().split()))

is_counted = defaultdict(lambda: 0)
cnt = 0
for t in combinations(range(n), 3):
    t = [l[x] for x in t]
    if len(set(t)) != 3:
        continue
    if sum(t) - max(t) > max(t):
        cnt += 1
print(cnt)
# Judge status: Accepted
A, B, C = map(int, input().split())
print("Yes") if A < C < B or B < C < A else print("No")
# Judge status: Accepted
s=input()
s= s[::-1]

S=[0,]
cnt=[0]*2019
cnt[0]=1
d=1
num=0
for i in range(len(s)):
    num += int(s[i])*d
    num %= 2019
    d *= 10
    d%= 2019
    # S.append((int(S[i]) + int(s[i]) * 10**i) % 2019)
    cnt[num]+=1

ans=0
for i in cnt:
    ans += i*(i-1) //2

print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
    if B[i]<=A[i]:
        ans+=B[i]
    else:
        ans+=A[i]
        B[i]-=A[i]
        ans+=min(B[i],A[i+1])
        A[i+1]-=min(B[i],A[i+1])
print(ans)
# Judge status: Wrong Answer
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    A_1 = list(map(int, input().split()))
    B_l = [1 - A_1[0]]

    sum = 0
    
    for i in range(1, N):
        if A_1[i] in B_l:
            sum += 1

        B_l = list(map(lambda x: x+1, B_l))
        B_l.append(0 - A_1[i])

        
    print(sum)
    
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
S = input()

s = list(S)
for i in range(len(S)):
    if (ord(s[i]) - 64 + N) == 26:
        p = 89
    else:
        p = (ord(s[i]) - 64 + N) % 26 + 64

    s[i] = chr(p)

print("".join(s))
# Judge status: Wrong Answer
A = int(input())
s=0
while (A > 0):

    r  = A % 10
    A= (A - r) / 10
    s = s+r
print(s)
# Judge status: Accepted
s=input()
if len(set(s)) == len(s): print('yes')
else: print('no')
# Judge status: Accepted
S = input()
ans = [0] * (len(S) + 1)

for i in range(len(S)):
    if S[i] == '<':
        ans[i + 1] = ans[i] + 1

for i in range(len(S) - 1, -1, -1):
    if S[i] == '>':
        ans[i] = max(ans[i + 1] + 1, ans[i])
print(sum(ans))
# Judge status: Wrong Answer
a, b = map(int, input().split())
if (a + b) % 3 == 0:
  print("Possible")
else:
  print("Impossible")
# Judge status: Accepted
n=int(input())
list=[]
for i in range(n):
    s,p=input().split()
    list.append([s,int(p),i+1])
sort1=lambda val: val[1]
list.sort(reverse=True,key=sort1)
sort2=lambda val: val[0]
list.sort(key=sort2)
for i in range(n):
    print(list[i][2])
# Judge status: Accepted
from decimal import *
a, b = [ Decimal(f) for f in input().split()]
r = a * b
getcontext().rounding = ROUND_DOWN
print('{:.0f}'.format(r))
# Judge status: Accepted
N,X=map(int,input().split())
L=list(map(int,input().split()))
mem=0; ans=1
for i in L:
    mem+=i
    if mem<=X: ans+=1
print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())

cnt = 0
for _ in range(N):
  a, b = map(int, input().split())
  cnt += b
  if K <= cnt:
    print(a)
    break
# Judge status: Accepted
MM = input().split()
a = int(MM[0])
b = int(MM[1])
ans = (b -a )*(b-a+1)*0.5 -b
print(int(ans))
# Judge status: Accepted
N = int(input())
print("ABC") if N < 1000 else print("ABD")
# Judge status: Wrong Answer
a = int(input())
print( int((2000-a)/201) + 1)
# Judge status: Wrong Answer
n = int(input())
dict = {}
for i in map(int, input().split(" ")):
	dict[i] = dict.get(i, 0) + 1
 
for i in range(0, n + 1):
	print(dict.get(i, 0))
# Judge status: Wrong Answer
n=int(input())
h=list(map(int,input().split()))
dp=[0]*(n)
for i in range(1,n):
  if i-2>=0:
    dp[i]=min(dp[i-2]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
  else:
    dp[i]=dp[i-1]+abs(h[i-1]-h[i])
print(dp[-1])
# Judge status: Wrong Answer
import numpy as np
N=int(input())
S=[]
allten=True
for i in range(N):
  s=int(input())
  S.append(s)
  if s%10==0:
    allten=False
if allten:
  print(0)
  exit()
  
S=sorted(S)
SUM=sum(S)
if SUM%10!=0:
  print(SUM)
else:
  ans=0
  for i in range(N):
    if S[i]%10!=0:
      ans=max(ans, SUM-S[i])
  print(ans)
# Judge status: Accepted
n, x, t = map(int, input().split())
ans = t * (n//x)
print(ans+t if n%x else ans)
# Judge status: Accepted
import sys
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
start = 0
end = k
count = 0
for i in range(n):
    if a[n-1]==1:
        print(count)
        sys.exit()
    a[start:end] = [1]*k
    start += (k-1)
    end += (k-1)
    count += 1
# Judge status: Accepted

n, m = map(int, input().split())
a = [True] * (n + 1)
for _ in range(m):
    a[int(input())] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
    if a[i + 1]:
        dp[i + 1] += dp[i]
    if i + 2 < n + 1:
        if a[i + 2]:
            dp[i + 2] += dp[i]
print(dp[n] % 1000000007)
# Judge status: Wrong Answer
a = list(map(int, input().split()))
num = int(input())
k = 0
for i in range(num):    #num回２倍を繰り返す。でなければNoをprint
  if a[0] == max(a) or a[1] == max(a):   #リストaの中のmaxよりも青が小さいならば青を二倍する
    a[2] = a[2] * 2
    k += 1
  if a[1] == min(a) and k < num:
    a[1] = a[1] * 2
    k += 1
print(a)
if a[0] < a[1] and a[1] < a[2]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N,M = map(int,input().split())

dp = [False]*N
dp[0] = True
cnt = [1]*N

for _ in range(M):
    x,y = map(lambda x:int(x)-1,input().split())
    dp[y] = dp[y] or dp[x]
    cnt[y] += 1
    cnt[x] -= 1
    if cnt[x] == 0:
        dp[x] = False

print(sum(dp))
# Judge status: Accepted
D,N=map(int,input().split())
if N!=100:
    print(N*(100**D))
else:
    print((N+1)*(100**D))
# Judge status: Accepted
N, M = map(int, input().split())
P_Y = []
for i in range(M):
    p, y = map(int, input().split())
    P_Y.append([p, y, i])

sorted_P_Y = sorted(P_Y)
rank = 1
prev_p = -1
for p, y, i in sorted_P_Y:
    if prev_p != p:
        rank = 1
    else:
        rank += 1
    P_Y[i].append(rank)
    prev_p = p
for p, _, _, rank in P_Y:
    print(str(p).rjust(6, '0') + str(rank).rjust(6, '0'))
# Judge status: Accepted
A,B,C,X,Y=map(int,input().split())
if A+B<2*C:
  ans=A*X+B*Y
else:
  if X<=Y:
    ans=C*2*X
    if 2*C<=B:
      ans+=2*C*(Y-X)
    else:
      ans+=B*(Y-X)
  else:
    ans=C*2*Y
    if 2*C<=A:
      ans+=2*C*(X-Y)
    else:
      ans+=A*(X-Y)
print(ans)
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,n):
    a=(n-1)//i
    ans+=a
print(ans)
# Judge status: Wrong Answer
#https://atcoder.jp/contests/abc076/tasks/abc076_c

s=input()
t=input()
ls=len(s)
lt=len(t)
if ls<lt:
    print("UNRESTORABLE")
    exit()
for i in range(ls-lt+1):
    for j in range(lt):
        flag=0
        if (s[i+j]!=t[j])&(s[i+j]!="?"):
            flag=1
            break
    if flag==0:
        ans=s[:i]+t+s[i+lt:]
        #print(ans)
        print(ans.replace("?","a"))
        exit()

print("UNRESTORABLE")
# Judge status: Accepted
a,b=map(int,input().split())
from fractions import *
g=gcd(a,b)
c=i=1
while g>1 and i*i<=g:
    i+=1
    if g%i==0:
        c+=1
    while g%i==0:
        g//=i
print(c+(g>1))
# Judge status: Wrong Answer
import math

N,K = map(int,input().split())
p = [0] * (N+1)
for i in range(1,N+1):
    if (1 <= i) and (i <= K-1):
        r = int(1+math.log(K/i,2))
        p[i] = (1/N) * math.pow(1/2,r)
    elif i >= K:
        p[i] = 1/N
ans = sum(p)
print(ans)
# Judge status: Wrong Answer
import sys
d={}
d["a"]=list(input())
d["b"]=list(input())
d["c"]=list(input())
turn="a"

while 1:
  turn2=d[turn].pop(0)
  if len(d[turn])==0:
    print(turn)
    sys.exit()
  turn=turn2
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())
n = b - a
ans = n*(n+1)//2 - b
print(ans)
# Judge status: Accepted
n, m = map(int,input().split())
a = []
b = []

for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(m):
    b.append(list(map(int,input().split())))

for i in range(n):
    ans = 10000000000000
    for j in range(m):
        x = abs(a[i][0]-b[j][0]) + abs(a[i][1]-b[j][1])
        if x < ans:
            ans = x
            y = j
    print(y+1)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(0,n,2):
  if a[i]%2!=0:
    ans=ans+1
print(ans)
# Judge status: Accepted
List = list(map(int, input().split()))

if List[0]%List[1] >= abs(List[0]%List[1] - List[1]):
    print(abs(List[0]%List[1] - List[1]))
else:
    print(abs(List[0]%List[1]))
# Judge status: Accepted
N,M,X,Y = map(int, input().split())
A = list(map(int, input().split())) + [X]
B = list(map(int, input().split())) + [Y]

print('No War' if max(A) < min(B) else 'War')
# Judge status: Accepted
n=int(input())
s=input()

#毎ステップ毎にカウントする処理→TLE
# ans=10**6
# for i in range(1,N):
#   ans=min(ans,s[:i-1].count("W")+s[i+1:].count("E"))
# print(ans)
ans=[]
ans.append(s[1:].count("E"))
tmp=ans[0]
for i in range(1,n):
  if s[i]=="E":
    tmp-=1
  if s[i-1]=="W":
    tmp+=1
  ans.append(tmp)
print(min(ans))
# Judge status: Accepted
n = int(input())
s = [input() for _ in range(n)]
set_s = list(set(s))
m = int(input())
t = [input() for _ in range(m)]
ans = [s.count(set_s[i]) - t.count(set_s[i]) for i in range(len(set_s))]
print(max(0, max(ans)))
# Judge status: Accepted
from bisect import bisect_left
from itertools import accumulate

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort()
b.sort()
c.sort()

ba_cnt = [bisect_left(a, e) for e in b]
ba_acm = [0] + list(accumulate(ba_cnt))

ans = 0
for e in c:
    i = bisect_left(b, e)
    ans += ba_acm[i]

print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>b or (a==1 and b==13):
    print("Alice")
elif a<b or (a==13 and b==1):
    print("Bob")
else:
    print("Draw")
# Judge status: Accepted
# -*- coding: utf-8 -*-

def find_min(lst):
    tmp = lst[0]
    idx = 0
    for i, item in enumerate(lst):
        if item < tmp:
            tmp = item
            idx = i

    return idx


def main():
    n, k = map(int, input().split())
    price = list(map(int, input().split()))

    price_sum = 0

    for i in range(k):
        idx = find_min(price)
        price_sum = price_sum + price.pop(idx)

    print(price_sum)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N=set(map(int,input().split()))
if len(N)<=1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()

H1, M1, H2, M2, K = map(int, input().split())


if M2 - M1 >= 0:
    tmp = (H2-H1) * 60 + (M2-M1)
else:
    tmp = (H2-H1-1) * 60 + 60+M2-M1

print(tmp - K)
# Judge status: Accepted
S = input()
if len(S)%2==0:
  check = 0
  for i in range(len(S)//2):
    if S[i]!=S[len(S)-1-i]:
      check+=1
if len(S)%2!=0:
  check = 0
  for i in range((len(S)-1)//2):
    if S[i]!=S[len(S)-1-i]:
      check+=1
print(check)
# Judge status: Accepted
H,W=map(int,input().split())
if H==1 or W==1:
	print(1)
else:
	print((H*W+1)//2)
# Judge status: Accepted
A, B, C, K = map(int, input().split())
if K % 2 == 1:
    print(B-A)
else:
    print(A-B)
# Judge status: Accepted
N = int(input())
S = []
for _ in range(N):
    S.append(input())
M = int(input())
T = []
for _ in range(M):
    T.append(input())

L = set(S + T)
ans = 0
for l in L:
    blue = S.count(l)
    red = T.count(l)
    ans = max(ans, blue-red)

print(ans)
# Judge status: Wrong Answer
w,h,x,y = map(int, input().split())

if x == w//2 and y == h//2: print(w*h/2, 1)
elif (x==0 and y==h) or (x==0 and y == 0) or(x==w and x==h) or (x==w and y == 0):
    print(w*h/2, 0)
else:
    if x >= w/2: a = (w-x) * h
    else: a = x * h
    if y >= h/2: b = (h-y) * w
    else: b = y * w
    print(max(a,b), 0)
# Judge status: Accepted
N,*A=map(int, open(0).read().split())
st=0
ans=1
for i,a in enumerate(A):
    if st==1:
        if A[i-1]>a:
            st=0
            ans+=1
    elif st==-1:
        if A[i-1]<a:
            st=0
            ans+=1
    elif st==0 and i!=0:
        p=A[i-1]
        if p<a:
            st=1
        elif p>a:
            st=-1
print(ans)
# Judge status: Accepted
s = input()

if s[0] == "A" and s[2:-1].count("C") == 1:
  idx_C = s[2:-1].index("C") + 2
  s = s[1:idx_C] + s[idx_C+1:]
  if s.lower() == s:
    print("AC")
    exit()
print("WA")
# Judge status: Accepted
from collections import deque
S = deque(input())
ans = list()
while S:
  tmp = S.popleft()
  if not ans:
    ans.append(tmp)
    continue
  if ans[-1] == tmp:
    if S:
      tmp += S.popleft()
    else:
      break

  ans.append(tmp)
    
print(len(ans))
# Judge status: Accepted
x=int(input().replace(" ",""))
print("Yes" if x==int(x**0.5)**2 else "No")
# Judge status: Accepted
def solve():
    N = int(input())

    D1 = [0] * N
    D2 = [0] * N

    for i in range(N):
        D1[i], D2[i] = map(int, input().split())

    c = 0
    judge = 0

    for i in range(N):
        if D1[i]==D2[i]:
            c += 1
        else:
            c = 0

        if c>2:
            judge += 1

    if judge!=0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
num=input()
moji=num.split(" ")

if int(moji[0])==7 or int(moji[0])==5:
    pass
else:
    print("NO")
    
    if moji[1]==7 or moji[1]==5:
        if int(moji[0])+int(moji[1])+int(moji[2])==19:
            print("YES")
    else:
        print("NO")
# Judge status: Accepted
h = int(input())
a = 0
while h > 0:
    h = h//2
    a += 1
  
print(2**a-1)
# Judge status: Wrong Answer
a=int(input())
b=int(input())
if a%500>=b:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a,b=map(int,input().split())
if a==b:
  print(2*a)
elif abs(a-b)==1:
  print(a+b)
elif abs(a-b)>=2:
  if a>b:
    print(a+(a-1))
  else:
    print(b+(b-1))
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())

# k泊
if (n < k):
    price = n * x
else:
    price = k * x
    # after k+1 
    price += (n-k) * y

print(price)
# Judge status: Accepted
a,b,c=map(int,input().split())
if (b-a)==(c-b):
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
d=1
kabu=0
ans=1000
while d<=n-1:
    if a[d]>a[d-1]:
        f=ans//a[d-1]
        kabu+=f
        ans=ans-a[d-1]*f
    if a[d]<a[d-1]:
        ans+=kabu*a[d-1]
        kabu=0
    d+=1
ans+=kabu*a[n-1]
print(ans)
# Judge status: Accepted
a,b=map(int,input().split());print(sum(range(b-a))-a)
# Judge status: Accepted



from collections import defaultdict


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

da = defaultdict(int)
db = defaultdict(int)



p = 2
while p * p <= A:
    while A % p == 0:
        da[p] += 1
        A //= p
    p += 1

if A != 1:
    da[A] += 1

p = 2
while p * p <= B:
    while B % p == 0:
        db[p] += 1
        B //= p
    p += 1

if B != 1:
    db[B] += 1



ans = len(set(da.keys()) & set(db.keys())) + 1
print(ans)
# Judge status: Accepted
num = int(input())
if num == 0:
  print(1)
else:
  print(0)
# Judge status: Wrong Answer
n, m, q = map(int, input().split())

lis = [list(map(int, input().split())) for _ in range(q)]

import itertools
seq = list(range(1,m+1))
lis_p = list(itertools.combinations(seq, n))

ans = 0
ans_max = 0

for li_p in lis_p:
    for li in lis:
        if li_p[li[1]-1] - li_p[li[0]-1] == li[2]:
            ans += li[3]
    #print(li_p, ans)
    if ans > ans_max:
        ans_max = ans
    ans = 0

print(ans_max)
# Judge status: Accepted
def resolve():
    '''
    code here
    '''
    N = int(input())
    S = input()

    res = 0
    for i in range(1, N):
        A = set(S[:i])
        B = set(S[i:])

        res = max(res, len(A & B))

    print(res)

if __name__ == "__main__":
    resolve()
# Judge status: Accepted


import numpy as np

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

if(a+b>=c):print("Yes")
else:print("No")
# Judge status: Accepted
s = input()
t = input()
ans = 0
for i in range(len(t)):
    if s[i] != t[i]:
        ans += 1
print (ans)
# Judge status: Accepted
K = int(input())
A,B=[int(i) for i in input().split(" ")]
if A%K == 0:
    print("OK")
elif (A//K+1)*K <= B:
    print("OK")
else:
    print("NG")