peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def main():
  N = int(input())
  A = list(map(int, input().split()))

  counts = [0] * N

  for v in A:
    counts[v-1] += 1

  total = 0

  for v in counts:
    if(v > 1):
      total += v * (v - 1) // 2

  for v in A:
    n = counts[v-1]

    diff = n * (n - 1) // 2 - (n-1) * (n-2) // 2

    print(total - diff)


if __name__ == "__main__":
  main()
# Judge status: Wrong Answer
l = list(map(int,input().split()))
l.sort()
a = l[0]
b = l[1]
c = l[2]
if a%2 == 0 or b%2 == 0 or c%2 == 0:
    print(0)
    exit(0)
vmax,vmin = 0,0
v = a*b*c
vmin = (b//2)*c*a
vmax = v - vmin
print(vmax-vmin)
# Judge status: Accepted
N, C, K = map(int, input().split(' '))
bus = []
ans = 0
T = [int(input()) for _ in range(N)]
T.sort()

min_t = 0
i = 0
while i < N:
    ans += 1
    start = i
    while i < N and T[i] - T[start] <= K and i - start < C:
        i += 1
print(ans)
# Judge status: Accepted
s = int(input())

if s % 10**9 == 0:
    y2 = s // 10**9
else:
    y2 = s // 10**9 + 1
    
y1 = 10**9*y2 - s

print(0,0,10**9,y1,1,y2)
# Judge status: Accepted
l=list(map(int,input().split()))
if(l[0]+l[1]>=l[2]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, K = map( int, input().split())
# if N%K == 0:
#     print(0)
#     return
print( min(N%K, K - N%K))
# Judge status: Accepted
A,B,K = map(int,input().split())
k = []
for i in range(A,A+K):
    if A<=i<=B:
        k.append(i)
for i in range(B-K+1,B+1):
    if A<=i<=B:
        k.append(i)
p = set(k)
q = list(p)
q.sort()
for i in range(len(q)):
    print(q[i])
# Judge status: Wrong Answer
N,H = list(map(int,input().split()))
Amax = 0
Bs = []
for i in range(N):
    A,B = list(map(int,input().split()))
    Amax = max(Amax,A)
    Bs.append(B)
Bs.sort(reverse=True)
cnt = 0
for i in range(N):
    if Bs[i]>=Amax:
        H += -1*Bs[i]
        cnt += 1
    else:
        break
if H%Amax==0:
    print(cnt+H//Amax)
else:
    print(cnt+H//Amax+1)
# Judge status: Wrong Answer
a = input()
li = []
for s in a:
  li.append(s)

count = 0
for i in range(1,4):
  if li[i] == li[i-1]:
    count += 1
  else:
    count =0

if count >= 3:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
H, W = [int(i) for i in input().split()]
if H == 1 or W == 1:
    print(1)
else:
    if H%2 == 1 and W%2 == 1:
        print(H*W//2+1)
    else:
        print((H*W)//2)
# Judge status: Wrong Answer
N=int(input())
S=input()
T=[]
for i in range(N):
    A=set(S[0:i+1])
    B=set(S[i:N+1])
    C=set(A&B)
    T.append(len(C))
print(max(T))
# Judge status: Accepted
c1 = list(input())
c2 = list(input())
if c1[::-1]==c2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N, M = map(int,input().split())
for i in range(0, N+1):
    f = 2 * i + 4 * (N - i)
    if f == M:
        print("Yes")
        break
else:
    print('No')
# Judge status: Accepted
import itertools

def check(lis, a):
    return sum([i[3] for i in a if lis[i[1]-1]-lis[i[0]-1]==i[2]])
   
n, m, q = map(int, input().split())
a = [[int(i) for i in input().split(" ")] for j in range(q)]
ans = 0
for i in itertools.combinations_with_replacement(range(m), n):
    ans = max(ans, check(i, a))
print(ans)
# Judge status: Accepted
import math
def f_pow(x,n):
    if n == 0:
        return 1
    half = f_pow(x, n//2)
    if n % 2:
        return x * half * half % mod
    else:
        return half * half % mod

def c(n, r):
    p,q = 1,1
    for i in range(r):
        p = p*(n-i)%mod
        q = q*(i+1)%mod
    return p * f_pow(q, mod-2)%mod

n,a,b = map(int,input().split())
mod = 10**9+7

s = f_pow(2, n) - 1
print((s - c(n,a) - c(n,b))%mod)
# Judge status: Wrong Answer
N = int(input())
A = [int(x) for x in input().split()]

cnt = 0
flg_2 = 0
for a in A:
    if a % 4 == 0:
        cnt += 1
    elif a == 2:
        flg_2 += 1
if flg_2 >= 2:
    N -= flg_2 - 1
if cnt >= N//2:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)
# Judge status: Accepted
import math

MOD = 10 ** 9 + 7
n, m = list(map(int, input().split()))
ptn = 1
if abs(n - m) >= 2:
    ptn = 0
else:
    ptn = math.factorial(n) * math.factorial(m)
    if abs(n - m) == 0:
        ptn *= 2

print(ptn % MOD)
# Judge status: Accepted
x=int(input())

if x%11==0:
    print((x//11)*2)
    exit()

if 0<x%11<7:
    print((x//11)*2+1)
    exit()

print((x//11)*2+2)
# Judge status: Accepted
n, k = map(int, input().split())
h = [int(i) for i in input().split()]

dp = [0] * n

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

print(dp[n-1])
# Judge status: Accepted
from math import gcd
def main():
  K = int(input())
  ans = 0
  
  for i in range(1, K + 1):
    for j in range(1, K + 1):
      for k in range(1, K + 1):
        ans += gcd(i, gcd(j, k))
        
  print(ans)

if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.pop(0)
for _ in range(N-1):
    B=list(map(int,input().split()))
    for num in A[1:]:
        if num not in B:
            A.remove(num)

print(len(A))
# Judge status: Accepted
a, b = map(int, input().split())
if a * b <= 0:
    print("Zero")
else:
    if a > 0:
        print("Positive")
    else:
        if (b - a) % 2 == 0:
            print("Negative")
        else:
            print("Positive")
# Judge status: Accepted
S = input()
odd_S = S[0::2]
even_S = S[1::2]
if 'L' in odd_S or 'R' in even_S:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
lista = [1, 3, 5, 7, 8, 10, 12]
lista2 = [4, 6, 9, 11]
x, y = map(int, input().split())
if x in lista and y in lista:
    print('Yes')
elif x in lista2 and y in lista2:
    print('Yes')
elif x == 2 and y == 2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
s = set(list(input()))
t = set(list(input()))
print(len(s | t))
# Judge status: Accepted
N = int(input())
P = []
M = []
A = []

def dist(p1, p2):
  return abs(p1[0]-p2[0]) + abs(p1[1]-p2[1])

for i in range(N):
  x, y = map(int, input().split())
  P.append(x+y)
  M.append(x-y)
  A.append((x, y))

ans1 = dist(A[P.index(max(P))], A[P.index(min(P))])
ans2 = dist(A[M.index(max(M))], A[M.index(min(M))])

print(max(ans1, ans2))
# Judge status: Accepted
n, l = map(int, input().split())
sum,flag,mini = 0,0,10000
for i in range(1,n+1):
    hoge = l+i-1
    sum += hoge
    if abs(mini) >= abs(hoge):
        mini = hoge
    if (hoge == 0):
        flag = 1
if flag == 1:
    print(sum)
else:
    print(sum-mini)
# Judge status: Wrong Answer
N = int(input())
aaa = list(map(int, input().split()))
M = 0
for i in range(1, N + 1):
    if sum(aaa[i - 1::i]) % 2 == 1:
        M += 1
print(M)
if M > 0:
    bbb = [1] * M
    print(*bbb)
# Judge status: Accepted
def september9(n):

    return "Yes" if n[0] == "9" or n[-1] == "9" else "No"

def main():
    n = str(input())
    print(september9(n))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
x, y = map(int, input().split())
for kame in range(x):
  if kame * 4 + (x - kame) * 2 == y:
    print('Yes')
    exit()
print('No')
# Judge status: Accepted
s=str(input())
t=str(input())

if t[:-1]==s:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#基準曜日の取得
S = input()
 
# 入力された内容をもとに次の日曜日までの日数を表示
if S == "SAT":
  print(1)
elif S == "FRI":
  print(2)
elif S == "THU":
  print(3)
elif S == "WED":
  print(4)
elif S == "TUE":
  print(5)
elif S == "MON":
  print(6)
elif S == "SUN":
  print(7)
else:
  print("入力内容が間違っています。")
# Judge status: Wrong Answer
N = int(input())
T, A = map(int, input().split())
height = list(map(int, input().split()))
temperature = list(abs(T - i * 0.006) for i in height)
print(temperature.index(min(temperature)) + 1)
# Judge status: Accepted
def main():
    N = int(input())

    if N%1000 == 0:
        print(0)
    else:
        print(1000 - (N%1000))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
if N<1000:
  print("ABC")
else:
  print("ABD")
# Judge status: Accepted
S = [s for s in str(input())]
d = len(S) // 3
from collections import Counter
cntr = sorted(list(Counter(S).values()))
if len(S) == 1:
  print('YES')
elif cntr == [1,1]:
  print('YES')
elif cntr == [d,d,d] or cntr == [d,d,d+1] or cntr == [d,d+1,d+1]:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
x,k,d= list(map(int, input().split()))
a=x//d
if k>=a:
    if (k-a)%2==0:
        x=abs(x)
        print(x%d)
    else:
        x=abs(x)
        if x%d>d-(x%d):
            print(d-(x%d))
        else:
            print(d+(x%d))
else:
    x=abs(x)
    print(x-(k*d))
# Judge status: Accepted
n=int(input())

if n==0:
  print(0)
  exit()

ans=''
while n!=0:
  r=n%(-2)
  if r<0:
    r+=2

  ans+=str(r)

  n-=r
  n//=(-2)

print(ans[::-1])
# Judge status: Accepted
import statistics
n = int(input())
a = list(map(int,input().split()))

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

a.sort()

mid = statistics.median_low(a)
mid1 = statistics.median_high(a)
ans = [0,0]

for i, aa in enumerate(a):
    ans[0] += abs(aa - mid)
    ans[1] += abs(aa - mid1)
print(min(ans))
# Judge status: Wrong Answer
def main():

    N = int(input())
    A = list(map(int, input().split()))
    SA = [0]
    for i in range(N + 1):
        SA.append(SA[-1] + A[N - i])
    SA.reverse()
    res = 0
    t = 1
    for i in range(N + 1):
        if t >= SA[i]:
            t = SA[i]
        res += t
        t -= A[i]
        if t <= 0:
            if i != N:
                return -1
        t *= 2
    return res


print(main())
# Judge status: Accepted
n=int(input())
d=sorted([int(x) for x in input().split()])

if len(d)%2==1:
    print(0)
else:
    print(d[-len(d)//2]-d[-len(d)//2-1])
# Judge status: Accepted
# https://atcoder.jp/contests/abc130/tasks/abc130_c

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

num = 0
if x == W/2 and y == H/2:
    num = 1

print(W * H / 2, num)
# Judge status: Accepted
def main():
    s = input()
    n = len(s)
    
    for i in range(n):
        for j in range(i,n):
            if s[:i]+s[j:]=='keyence':
                return 'YES'
    return 'NO'
print(main())
# Judge status: Accepted
N = int(input())
count = [10*[0]for _ in range(10)]
ans = 0
for i in range(1,N+1):
  s = str(i)
  if s[0] == '0' or s[-1] == '0':
    pass
  else:
    count[int(s[0])][int(s[-1])] += 1
for j in range(1,10):
  for k in range(1,10):
    ans += count[j][k]*count[k][j]
print(ans)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline

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

ansl=-1
ansr=10**6

for _ in range(m):
    l,r=map(int,input().split())
    ansl=max(ansl,l)
    ansr=min(ansr,r)

print(max(ansr-ansl+1,0))
# Judge status: Accepted
N,A,B=map(int,input().split())

l=[]
for i in range(1,N+1):
    x=0
    for j in range(len(str(i))):
        x+=int(str(i)[j])
    if x>=A and x<=B:
        l.append(i)
#print(l)
print(sum(l))
# Judge status: Wrong Answer
N = int(input())

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

for i in range(N):
    if A_list[i] % 2 == 0:
        if A_list[i] % 3 == 0 or A_list[i] % 5 == 0:
            continue
        else:
            print("DENIED")
            exit()
    if i == N-1:
        print("APPROVED")
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
a.sort()
a.append(0)
ans=0
b=a[0]
c=0
for i in range(N+1):
  if b!=a[i]:
    if c<b:
      ans+=min((b-c),c)
    b=a[i]
    c=1
  else:
    if c==b:
      ans+=1
    else:
      c+=1
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
A = list(map(int,input().split()))
D = dict.fromkeys(range(1,n+1),0)
ans = 0
for a in A:
  D[a] += 1
D = sorted(D.items(), key=lambda x:x[1])
for i in range(n-k):
  ans += D[i][1]
print(ans)
# Judge status: Accepted
a = int(input())
b = int(input())
print(6-(a+b))
# Judge status: Accepted
import math
a, b, h, m = map(int, input().split())
x = 360*(h/12)+30*(m/60)
y = 360*(m/60)
d = math.cos(math.radians(abs(x-y)))
z = a**2 + b**2 -2*a*b*d
print (math.sqrt(z))
# Judge status: Wrong Answer
n,m=map(int,input().split())
cu=[0]*2000001
for i in range(m):
    x,y=map(int,input().split())
    cu[x]=y
f=cu[cu[1]]
print('POSSIBLE' if f==n else 'IMPOSSIBLE')
# Judge status: Accepted
N, X, T = map(int,input().split())
counter = 0
rem = N
while rem > 0:
    rem -= X
    counter += 1
print(counter*T)
# Judge status: Accepted
A, B = map(int, input().split())

X = max(A, B)

if A == B:
  print(X*2)
else:
  print(X*2 - 1)
# Judge status: Wrong Answer
n,k = map(int, input().split())
ans = 0
for i in range(n):
  a,b = map(int, input().split())
  if k > b:
    k -= b
  else:
    if ans == 0:
      ans = a
print(ans)
# Judge status: Accepted
n = list(input())
if '7' in n:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, A, B = map(int, input().split())
sums = 0
cnt = 0
for i in range(1, N+1):
    words_i = str(i)
    for word_i in words_i:
        sums += int(word_i)
    if A <= sums <= B:
        cnt += i
    sums = 0
print(cnt)
# Judge status: Accepted
K, N = map(int,input().split())
lists = list(map(int,input().split()))
maxdist = 0
for i in range(N-1):
    dist = lists[i+1] - lists[i]
    if dist > maxdist:
        maxdist = dist
adis = K-lists[N-1]+lists[0]
if adis > maxdist:
    maxdist = adis

print(K-maxdist)
# Judge status: Accepted
N=int(input())
B=list(map(int,input().split()))
B+=[max(B)]
A=[0]*N
A[0]=B[0]
for i in range(1,N):
    A[i]=min(B[i-1],B[i])
print(sum(A))
# Judge status: Accepted
r,b,g= raw_input().split()
x= int(r+b+g)
if x%4==0:
  print "YES"
else:
  print "NO"
# Judge status: Accepted
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7
def main():
  w = input()
  dic = {}
  for i in range(len(w)):
    if w[i] in dic:
      dic[w[i]] +=1
    else:
      dic[w[i]] = 1
  for k,v in dic.items():
    if v % 2 != 0:
      print('No')
      exit()
  print('Yes')
if __name__ == '__main__':
  main()
# Judge status: Accepted
import sys
import math
import bisect

def main():
    s = input()
    if '9' in s:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys
input = sys.stdin.readline

W,H,N = list(map(int,input().split()))
x0 = 0
y0 = 0
x1 = W
y1 = H

for i in range(N):
    x,y,a = list(map(int,input().split()))

    if a == 1:
        x0 = max(x,x0)
    elif a == 2:
        x1 = min(x,x1)
    elif a == 3:
        y0 = max(y,y0)
    elif a == 4:
        y1 = min(y,y1)
X = [x0,x1,y0,y1]

print(max(0,x1-x0)*max(0,y1-y0))
# Judge status: Accepted
import math
N, D = map(int, input().split())

print(math.ceil(N / (2 * D + 1)))
# Judge status: Accepted
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))
# Judge status: Accepted
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  xs = [int(input()) for i in range(5)]
  k = int(input())
  for i in range(len(xs)):
    for j in range(i+1, len(xs)):
      if xs[j] - xs[i] > k:
        print(':(')
        return
  print('Yay!')


if __name__=='__main__':
  main()
# Judge status: Wrong Answer
a1=input()
a2=[i for i in a1.split()]
x,y=int(a2[0]),int(a2[1])
if 1<=(x and y)<=20:
    if 1<=(x and y)<=9:
        print(x*y)
    else:
        print('-1')
# Judge status: Accepted
N=int(input())
a=input().split()
a=[int(x) for x in a]
a.sort(reverse=True)
s=0
for i in range(N):
    s+=a[2*i+1]

print(s)
# Judge status: Wrong Answer
N,a,b = (int(x) for x in input().split())
z = 0
for I in range (N):
    o = 0
    i = I+1
    while True:
        o += i%10
        i = round (i/10)
        if i == 0:
            if a <= o <= b:
                z += I+1
            break
print (z)
# Judge status: Accepted
a,b=map(int,input().split())
x=a+b
print(x//2+x%2)
# Judge status: Accepted
N = int(input())
a = list(map(int,(input().split())))
b = list(map(int,(input().split())))

nega = []
c = 0
gap = [0]*N
for i in range(N):
    gap[i] = a[i]-b[i]
    if gap[i] > 0:
        c += gap[i]
    elif gap[i] < 0:
        nega.append((-gap[i])//2)

nc = sum(nega)

if nc >= c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, m = map(int, input().split())

ret = 0

if (n >= 3) and (m >= 3):
    ret += (n-2) * (m-2)

if (n == 1) and (m >= 3):
    ret += m - 2

if (m == 1) and (n >= 3):
    ret += n - 2

if (m == 1) and (n == 1):
    ret += 1

print(ret)
# Judge status: Wrong Answer
n = int(input())
s = input()
print(s.count('I') - s.count('D'))
# Judge status: Wrong Answer
from itertools import product
c = [list(map(int, input().split())) for _ in range(3)]

b2 = c[0][1]
b3 = c[0][2]
a2 = c[1][1] - b2
a3 = c[2][2] - b3

if (a2 + b2 == c[1][1] and
    a2 + b3 == c[1][2] and
    a3 + b2 == c[2][1] and
    a3 + b3 == c[2][2]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import math

a, b, x = map(int, input().strip().split())

vol = a * a * b
if vol <= 2 * x:
    theta = math.atan(2 * (vol - x) / a**3)
else:
    theta = math.atan(vol / (2 * x))

print(theta * 360 / (2 * math.pi))
# Judge status: Wrong Answer
a, b, c, x, y = map(int, input().split())
if min(a, b) >= 2 * c:
    print(c * 2 * max(x, y))
    # print("1")
elif (a + b) / 2 >= c:
    if x >= y:
        print(c * 2 * y + a * (x - y))
        # print("2-1")
    else:
        print(c * 2 * x + b * (y - x))
        # print("2-2")
else:
    print(a * x + b * y)
    # print("3")
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if abs(b-a)<=d and abs(c-b)<=d:
    print("Yes")
elif abs(c-a)<=d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M = mapint()
boxes = [0]*N
balls = [1]*N
boxes[0] = 1
for _ in range(M):
    x, y = mapint()
    boxes[y-1] = 1 if boxes[x-1]==1 else boxes[y-1]
    balls[x-1] -= 1
    balls[y-1] += 1
    if balls[x-1]==0:
        boxes[x-1] = 0

print(sum(boxes))
# Judge status: Accepted
from sys import stdin

n = int(stdin.readline().strip())
x_lst = [int(x) for x in stdin.readline().strip().split()]

p1 = sum(x_lst) // n
p2 = sum(x_lst) // n + 1

p1_sum = sum([(x-p1) ** 2 for x in x_lst])
p2_sum = sum([(x-p2) ** 2 for x in x_lst])

print(min(p1_sum, p2_sum))
# Judge status: Accepted
s = list(map(int, input().split('/')))

if s[0] <= 2019 and s[1] <= 4 and s[2] <= 30:
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
s=input()
lens=len(s)
sets=len(list(set(s)))
if(lens==sets):
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
N = int(input())
G0,G1,G2,G3=0,0,0,0
for i in range(N):
    Si=input()
    if Si == 'AC':
        G0 = G0+1

    elif Si=='WA':
        G1=G1+1

    elif Si=='TLE':
        G2=G2+1
    
    else:
        G3=G3+1
 
print('AC G' +str(G0))
print('WA G' +str(G1))
print('TLE G'+str(G2))
print('RE G' +str(G3))
# Judge status: Accepted
n = int(input())
a = int(input())

if n % 500 <= a:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s = input()
t = input()
minCount = 100000000
i = 0
while i < len(s):
    countSame = 0
    j = 0
    while j < len(t) and i+j < len(s):
        if t[j] == s[i+j]:
            countSame += 1
        j += 1
        minCount = min(len(t) - countSame, minCount)
    i += 1
if len(t) == 0:
  print(0)
print(minCount)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 5)

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w') 

readline =sys.stdin.readline

# time - O(n2)
def process():
    k,s = map(int,readline().rstrip().split())
    cnt=0

    for i in range(0,k+1):
        for j in range(0,k+1):
            z = s-(i+j)
            if z>=0 and z<=k:
                cnt+=1
    
    return cnt



# for _ in range(int(readline().rstrip())):
print(process())
# Judge status: Accepted
import itertools

n, m, q = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(q)]
mx=0
l=itertools.combinations_with_replacement(range(1,m+1),n)
for y in l:
    temp=0
    for a, b, c, d in x:
        if y[b-1] - y[a-1] == c:
            temp += d
    mx=max(mx,temp)
print(mx)
# Judge status: Wrong Answer
a, b, c, k = map(int, input().split())

if k - a <= 0:
  print(k)
elif k - a + b <= 0:
  print(a)
else:
  k -= (a + b)
  for i in range(1, c+1):
    if k - i == 0:
      print(a-i)
# Judge status: Accepted
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


if __name__ == '__main__':
    data = list(map(int, input().split()))
    for i, d in enumerate(data):
        if d == 0:
            print(i + 1)

    #print('\33[32m' + 'end' + '\033[0m') # debug
# Judge status: Wrong Answer
import sys

sys.setrecursionlimit(10 ** 7)

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

P.sort(reverse=True)

sk = sum(P[:K])
ans = sk / 2. + K / 2.

print(ans)
# Judge status: Accepted
m,n = map(int,input().split())
if m == n:print(m+n)
else:print(max(m,n)*2-1)
# Judge status: Accepted
n = int(input())

answer = int((n + 1) * n / 2)

print(answer)
# Judge status: Accepted
s=input().replace("eraser","0").replace("erase","0").replace("dreamer","0").replace("dream","0").replace("0", "")
if s:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
import math
n,k = map(int,input().split())
A = list(map(int,input().split()))
print(math.ceil((n-1)/(k-1)))
# Judge status: Accepted
a,b = map(int,input().split())
cnt = 0

for i in range(a,b+1):
  lis_i = list(str(i))
  lis_i.reverse()
  rev_i = int(''.join(lis_i))
  if rev_i == i:
    cnt += 1
    
print(cnt)
# Judge status: Wrong Answer
import math
x=int(input())
a=0
if x==1:
    print(1)
    exit()
for i in range(1,math.ceil(math.sqrt(x))):
    a=max(a,i**2)
print(a)
# Judge status: Accepted
from random import randint

n = int(input())

for i in range(n):
  print(randint(1,26))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans = 1
a.sort()
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        quit()
print(ans)
# Judge status: Accepted
a, b, c = [int(i) for i in input().split()]

if b - a == c - b:
    print('YES')
else :
    print('NO')
# Judge status: Accepted
w = input()
cdict = {}
for c in w:
  if c in cdict:
    cdict[c] += 1
  else:
    cdict[c] = 1
    
if all(cdict[c]%2==0 for c in cdict):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n, m = map(int, input().split())
dic = {}
ok = True
for i in range(m):
    a, b = map(int, input().split())
    if a in dic:
        if b != dic[a]:
            ok = False
    else:
        dic[a] = b

if 1 in dic:
    if n != 1 and dic[1] == 0:
        ok = False

if ok:
    l = ['0'] * n
    for i in dic.keys():
        l[i-1] = str(dic[i])
    if n != 1 and l[0] == '0':
        l[0] = '1'
    print(''.join(l))
else:
    print(-1)
# Judge status: Wrong Answer
n = int(input())
s = input()

ans = 0
tmp = []
for i, v in enumerate(s):

    if v not in tmp:
        ans += (1 if s[i+1:].count(v) > 0 else 0)
        tmp.append(v)

print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
i = 0
if a == b == c:
    print(-1)
else:
    while a%2==0 and b%2==0 and c%2==0:
        at = a//2
        bt = b//2
        ct = c//2
        a = bt + ct
        b = at + ct
        c = at + bt
        i+=1
    print(i)
# Judge status: Accepted
def main():
    n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    s = input()

    ans = ""

    for i in s:
        ans += chr((ord(i) - ord("A") + n)% 26 + ord("A"))

    print(ans)


if __name__ == '__main__':
    main()