Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

##C
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
b = [k]*n

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

for i in b:
    if i >= 1:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

##C
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
b = [k]*n

for j in range(n):
        b[j] += -q

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

for i in b:
    if i >= 1:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
k = []
j = 0
na= 0
c = 0
for i in range(n):
    if a[i]<b[i]:
        na +=b[i]-a[i]
        c+=1
    elif a[i] > b[i]:
        k.append(a[i]-b[i])
    k.sort()
while na > 0 and k:
    na -=k[-1]
    k.pop(-1)
    c +=1
if na > 0:print(-1)
else:print(c)

### FIXED CODE ###

import sys
input=sys.stdin.readline
mii=lambda:map(int,input().split())

n=int(input())
a=list(mii())
b=list(mii())
k = []
j = 0
na= 0
c = 0
for i in range(n):
    if a[i]<b[i]:
        na +=b[i]-a[i]
        c+=1
    elif a[i] > b[i]:
        k.append(a[i]-b[i])
k.sort()
while na > 0 and k:
    na -=k[-1]
    k.pop(-1)
    c +=1
if na > 0:print(-1)
else:print(c)
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
BC = [list(map(int, input().split())) for _ in range(M)]
BC.sort(key=lambda x:x[1],reverse=True)
for chenge in BC:
    kaisuu = chenge[0];  value = chenge[1]
    cnt = 0
    for i in range(len(A)):
        if A[i] < value:
            A[i] = value
            cnt += 1
        if cnt == kaisuu:
            break
print(sum(A))

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
BC = [list(map(int, input().split())) for _ in range(M)]
BC.sort(key=lambda x:x[1],reverse=True)
i = 0
for bc in BC:
    for _ in range(bc[0]):
        if i > len(A)-1:
            break
        if A[i] > bc[1]:
            break
        A[i] = bc[1]
        i += 1
print(sum(A))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n = int(input())

#ss = [sorted(list(input())) for _ in range(n)]
ss = []
for i in range(n):
    tmp = list(input())
    tmp.sort()
    ss.append(str(tmp))

checked = set()
count = 0

for i, t_ss in enumerate(ss[:-1]):
    if t_ss in checked:
        continue
    checked.add(t_ss)
    add_count = 1
    for t_j_ss in ss[i+1:]:
        if t_ss == t_j_ss:
            count += add_count
            add_count += 1

print(count)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())

#ss = [sorted(list(input())) for _ in range(n)]
ss = []
checked = {}
count = 0
for i in range(n):
    tmp = list(input())
    tmp.sort()
    tmp = str(tmp)
    if not(tmp in checked):
        checked[tmp] = 1
    else:
        count += checked[tmp]
        checked[tmp] += 1

print(count)
### BUGGY CODE ###

n=int(input())
for i in range(n):
    if i==0:
        x,y=map(int,input().split())
    else:
        t,a=map(int,input().split())
        v=t
        w=a
        while v<x or w<y:
            v+=t
            w+=a
        x=v
        y=w
print(x+y)
        



### FIXED CODE ###

n=int(input())
x=1
y=1
for i in range(n):
    t,a=map(int,input().split())
    c=max(-(-x//t),-(-y//a))
    x=t*c
    y=a*c      
print(int(x+y))
### BUGGY CODE ###

n,m,k=map(int,input().split())
mod=998244353
if m==1:print(0 if k!=n-1 else 1);exit()

fact=[1]*(n-1+1)
inv=[1]*(n-1+1)
for i in range(2,n-1+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n-1,1,-1):
    inv[i-1]=inv[i]*i%mod
ans=0
po=pow(m-1,n-1,mod)
ue=fact[n-1]
iii=pow(m-1,mod-2,mod)
for i in range(k+1):
    ans+=ue*inv[n-1-i]*inv[i]*m*po%mod
    po*=iii
print(ans%mod)

### FIXED CODE ###

n,m,k=map(int,input().split())
mod=998244353
if m==1:print(0 if k!=n-1 else 1);exit()
fact=[1]*(n-1+1)
inv=[1]*(n-1+1)
for i in range(2,n-1+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n-1,1,-1):
    inv[i-1]=inv[i]*i%mod
ans=0
po=pow(m-1,n-1,mod)*m%mod
ue=fact[n-1]
iii=pow(m-1,mod-2,mod)%mod
for i in range(k+1):
    ans+=ue*inv[n-1-i]%mod*inv[i]%mod*po%mod
    po*=iii
    po%=mod
print(ans%mod)
### BUGGY CODE ###

n = int(input())

six_list = [6 ** i for i in range(7)]
nine_list = [9 ** i for i in range(6)]

import bisect

def six_nine(n):
    if n == 0:
        return 0
    else:
        six = six_list[bisect.bisect_right(six_list , n) - 1]
        nine = nine_list[bisect.bisect_right(nine_list , n) - 1]
        m = min(six_nine(n - six) , six_nine(n - nine))
        return 1 + m

print(six_nine(n))

### FIXED CODE ###

import bisect
 
x = int(input())
six_list = [6 ** i for i in range(7)]
nine_list = [9 ** i for i in range(6)]
 
 
def six_nine(n):
    if n == 0:
        return 0
    else:
        six = six_list[bisect.bisect_right(six_list, n) - 1]
        nine = nine_list[bisect.bisect_right(nine_list, n) - 1]
        return min(n // six + six_nine(n % six), 1 + six_nine(n - nine))
 
 
print(six_nine(x))
### BUGGY CODE ###

level0 = 'BPPPB'
N, X = map(int, input().split())

dp = [[0 for _ in range(X)] for _ in range(N)]
layers_num = [0 for _ in range(N)]

layers_num[0] = len(level0)

for x in range(X):
    if x < len(level0):
        pb = level0[x]
        if x == 0:
            if pb == 'P':
                dp[0][x] = 1
        else:
            if pb == 'P':
                dp[0][x] = dp[0][x-1] + 1
            else:
                dp[0][x] = dp[0][x-1]
    else:
        dp[0][x] = dp[0][x - 1]

for n in range(1, N):
    layers_num[n] = 2 * layers_num[n-1] + 3

    for x in range(X):
        if x == 0:
            dp[n][x] = 0
        elif 0 < x and x <= layers_num[n - 1]:
            dp[n][x] = dp[n - 1][x - 1]
        elif x == layers_num[n-1] + 1:
            dp[n][x] = dp[n - 1][x - 1] + 1
        else:
            dp[n][x] = dp[n - 1][x - 1] + 1 + dp[n - 1][x - layers_num[n-1] - 2]

print(dp[-1][-1])


### FIXED CODE ###

def f(n, x):
    if n == 0:
        return min(x, 3)
    elif x == 0:
        return 0
    elif 0 < x and x <= layers_num[n - 1]:
        return f(n - 1, x - 1)
    elif x == 1 + layers_num[n - 1]:
        return p[n - 1] + 1
    elif 1 + layers_num[n - 1] < x <= 1 + 2 * layers_num[n - 1]:
        return p[n - 1] + 1 + f(n - 1, x - 2 - layers_num[n - 1])
    else:
        return 2 * p[n - 1] + 1


level0 = 'BPPPB'
N, X = map(int, input().split())

layers_num = []
p = []
for n in range(N):
    if n == 0:
        layers_num.append(len(level0))
        p.append(level0.count('P'))
    else:
        layers_num.append(layers_num[n - 1] * 2 + 3)
        p.append(2 * p[n - 1] + 1)

print(f(N - 1, X - 1))
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

class BIT():
    def __init__(self, max_n):
        self.size = max_n + 1
        self.tree = [0] * self.size

    def get_sum(self,i):
        s = 0
        while i:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i < self.size:
            self.tree[i] += x
            i += i & -i

n,q = map(int,readline().split())
c = list(map(int,readline().split()))
lr = list(map(int,read().split()))
it = iter(lr)
lr2 = []
for i,l,r in zip(range(q),it,it):
    lr2.append((r-1,l-1,i))

lr2.sort()
st = BIT(n+1)
ans = [0] * q
before = [-1] * (n+1)
c_ind = 0
for r,l,i in lr2:
    while(c_ind <= r):
        st.add(c_ind+1,1)
        bef = before[c[c_ind]]
        if(bef!=-1):
            st.add(bef+1,-1)
        before[c[c_ind]] = c_ind
        c_ind += 1

    ans[i] = st.get_sum(r+1) - st.get_sum(l)

print('\n'.join(map(str,ans)))

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

class Seg_sum():
    def __init__(self,x):
        #####単位元######
        self.ide_ele_min = 0
        self.func = lambda a,b : a+b

        self.n = len(x)

        #num_max:n以上の最小の2のべき乗
        self.num_max =2**(self.n-1).bit_length()
        self.x = [self.ide_ele_min]*2*self.num_max

        for i,num in enumerate(x, self.num_max):
            self.x[i] = num
        for i in range(self.num_max-1,0,-1):
            self.x[i] = self.func(self.x[i<<1],self.x[(i<<1) + 1])

    def update(self,i,x):
        i += self.num_max
        self.x[i] = x
        while(i>0):
            i = i//2
            self.x[i] = self.func(self.x[i<<1],self.x[(i<<1) + 1])

    def query(self,i,j):
        res = self.ide_ele_min
        if i>=j:
            return res
        i += self.num_max
        j += self.num_max -1
        while(i<=j):
            if(i==j):
                res = self.func(res,self.x[i])
                break
            if(i&1):
                res = self.func(res,self.x[i])
                i += 1
            if(not j&1):
                res = self.func(res,self.x[j])
                j -= 1
            i = i>>1
            j = j>>1
        return res

n,q = map(int,readline().split())
c = tuple(map(int,readline().split()))
lr = tuple(map(int,read().split()))
it = iter(lr)
lrq = [[] for _ in range(n)]
for i,l,r in zip(range(q),it,it):
    lrq[r-1].append((l-1,i))

st = Seg_sum([1]*(n+1))
ans = [0] * q
before = [-1] * (n+1)
c_ind = 0
for r in range(n):
    for l,i in lrq[r]:
        while(c_ind <= r):
            bef = before[c[c_ind]]
            if(bef!=-1):
                st.update(bef,0)
            before[c[c_ind]] = c_ind
            c_ind += 1

        ans[i] = st.query(l,r+1)

print('\n'.join(map(str,ans)))
### BUGGY CODE ###

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

for i in range(n):
    print(max(A[i+1:] + A[:i]))

### FIXED CODE ###

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

B = sorted(A)
max = B[-1]
for i in range(n):
    if A[i] != max:
        print(max)
    else:
        print(B[-2])
### BUGGY CODE ###

from sys import stdin
def main():
    n = int(stdin.readline().rstrip())
    a = list(map(int,stdin.readline().rstrip().split()))
    mod = 10**9+7
    point = 0
    kai = [2**i%mod for i in range(61)]
    for i in range(61):
        now = sum(1 for j in a if(j >> i)&1)
        now *= n-now
        now *= kai[i]
        point += now
    print(point%mod)
if __name__ == "__main__":
    main()

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
point = 0
for i in range(61):
    now = 0
    for j in a:
        now += (j >> i&1)
    now *= n-now
    now %= mod
    for k in range(i):
        now *= 2
        now %= mod
    point += now
    point %= mod
print(point)
### BUGGY CODE ###

n = int(input())
l = [0 for _ in range(n)]
already = []
next = 1
c = 0
for i in range(n):
  a = int(input())
  l[i] = a
while c <= n:
  next = l[next-1]
  c += 1
  if next == 2:
    print(c)
    break
  elif next in already:
    print(-1)
    break
  already.append(next)

### FIXED CODE ###

n = int(input())
l = [0 for _ in range(n)]
already = set()
next = 1
c = 0
for i in range(n):
  a = int(input())
  l[i] = a
while c <= n:
  next = l[next-1]
  c += 1
  if next == 2:
    print(c)
    break
  elif next in already:
    print(-1)
    break
  already.add(next)
### BUGGY CODE ###

from fractions import gcd
N,M=map(int,input().split())
S=input()
T=input()

L=N*M//gcd(N,M)
#print(L)
U=["#" for _ in range(L)]
ans=L

for i in range(N):
  U[i*(L//N)]=S[i]
#print(U)

for j in range(M):
  if U[j*(L//M)]!="#" and U[j*(L//M)]!=T[j]:
    ans=-1
    break
  else:
    U[j*(L//M)]=T[j]

#print(U)
print(ans)

### FIXED CODE ###

from fractions import gcd
N,M=map(int,input().split())
S=input()
T=input()
L=N*M//gcd(N,M)
p=[]
q=[]

if S[::L//M]==T[::L//N]:
  print(L)
else:
  print(-1)
### BUGGY CODE ###

n, k = map(int, input().split())
*p, = map(int, input().split())

*ev, = map(lambda x: (x*(x+1)/2)/x, p)

ans = 0
for i in range(n-k+1):
    ans = max(ans, sum(ev[i:i+k]))

print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
*p, = map(int, input().split())

*ev, = map(lambda x: (x*(x+1)/2)/x, p)
cusum = [0]*(n+1)
for i in range(n):
    cusum[i+1] = cusum[i] + ev[i]

ans = 0
for i in range(n-k+1):
    ans = max(ans, cusum[i+k] - cusum[i])
print(ans)
### BUGGY CODE ###

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

ans = -1*(10**18)
for si in range(N):
  x = si
  s = list()
  total = 0
  while(1):
    x = PList[x]-1
    s.append(CList[x])
    total += CList[x]
    if x == si:
      break
  l = len(s)
  t = 0
  for i in range(l):
    t += s[i]
    if i+1 > K:
      break
    now = t
    if total > 0:
      e = (K-i-1)//l
      now += total*e
    ans = max(ans, now)  
print(ans)
    

### FIXED CODE ###

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

ans = -1*(10**18)
for si in range(N):
  x = si
  s = list()
  total = 0
  l = 0
  while(1):
    x = PList[x]-1
    s.append(CList[x])
    l += 1
    total += CList[x]
    if x == si:
      break
  t = 0
  for i in range(l):
    t += s[i]
    if i+1 > K:
      break
    now = t
    if total > 0:
      e = (K-i-1)//l
      now += total*e
    ans = max(ans, now)  
print(ans)
### BUGGY CODE ###

import itertools

if __name__ == '__main__':
    k, s = list(map(int,input().split()))

    a = 0
    for i in itertools.product(range(0, k+1), range(0, k+1), range(0, k+1)):
        if sum(i) == s:
            a += 1
    print(a)

### FIXED CODE ###

k, s = list(map(int, input().split()))
count = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        z = s - x - y
        if (0 <= z and z <= k):
            count+=1
print(count)
### BUGGY CODE ###

from bisect import bisect_left
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans = 0
for i  in range(n-2):
    a = l[i]
    for j in range(i+1,n-1):
        b = l[j]
        max_c = a+b
        ans += bisect_left(l[j+1:],max_c)
print(ans)

### FIXED CODE ###

from bisect import bisect_left
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans = 0
for i  in range(n-2):
    a = l[i]
    for j in range(i+1,n-1):
        b = l[j]
        k = bisect_left(l,a+b)
        ans += k-j-1
print(ans)
### BUGGY CODE ###

N = int(input())
X = tuple(map(int, input().split()))

import statistics

for i in range(N):
    tempX = list(X)
    del tempX[i]
    print(statistics.median(tempX))


### FIXED CODE ###

N = int(input())
X = tuple(map(int, input().split()))

Y = list(X)
Y.sort()

greater_median = Y[N//2]
smaller_median = Y[N//2-1]
average = (greater_median + smaller_median)/2

for x in X:
    if x <= average:
        print(greater_median)
    else:
        print(smaller_median)
### BUGGY CODE ###

#coding:utf-8

s = input()
s_arr = list(s)

n = 0
l = len(s_arr)
while True:
    counter = 0
    for i in range(l):
        if i == l-1:
            break
        if (s_arr[i] == 'B')&(s_arr[i+1]=='W'):
            s_arr[i] = 'W'
            s_arr[i+1] = 'B'
            counter += 1
            n += 1
    if counter == 0:
        break

print(n)

### FIXED CODE ###

#coding:utf-8

s = input()
s_arr = list(s)

n = 0
l = len(s_arr)

ans = 0
b_count = 0
for i in range(l, 0, -1):
    if i == l:
        if s_arr[i-1] == 'B':
            b_count += 1
    else:
        if s_arr[i-1]=='B':
            ans += l - i - b_count
            b_count += 1


print(ans)
### BUGGY CODE ###

#import numpy as np
import sys
from collections import defaultdict
import math
import itertools
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10000)

N = int(readline())
tmp = list(map(int,input().split()))
A = []  
[bisect.insort_right(A, x) for x in tmp]
tmp = list(map(int,readline().rstrip().split()))
B = []
[bisect.insort_right(B,x) for x in tmp ]
tmp = list(map(int,readline().rstrip().split()))
C = []
[bisect.insort_right(C,x) for x in tmp]

listb = []
for i , b in enumerate(B[::-1]):
    if i == 0:
        listb.append(N - bisect.bisect_right(C,b))
    else:
        listb.append(N - bisect.bisect_right(C,b) + listb[i-1])

ans = 0
for a in A :
    indexb = bisect.bisect_right(B,a)
    if indexb == N :
        break
    ans += listb[N-1 - indexb]

print(ans)

### FIXED CODE ###

#import numpy as np
import sys
from collections import defaultdict
import math
import itertools
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10000)

N = int(readline())
A = list(map(int,input().split()))
#A = []  
#[bisect.insort_right(A, x) for x in tmp]
B= list(map(int,readline().rstrip().split()))
#B = []
#[bisect.insort_right(B,x) for x in tmp ]
C = list(map(int,readline().rstrip().split()))
#C = []
#[bisect.insort_right(C,x) for x in tmp]

A.sort()
C.sort()

ans = 0
for b in B :
    indA = bisect.bisect_left(A,b)
    indC = bisect.bisect_right(C,b)
    ans += indA * (N-indC)

print(ans)
### BUGGY CODE ###

from operator import mul
from functools import reduce


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


N = int(input())
s = ["".join(sorted(input())) for _ in range(N)]
number_of_anagrams = []

for string in set(s):
    cnt = s.count(string)
    if cnt > 1:
        number_of_anagrams.append(cnt)

ans = sum(combinations_count(num, 2) for num in number_of_anagrams)
print(ans)

### FIXED CODE ###

N = int(input())
unique_string = {}
ans = 0

for _ in range(N):
    s = "".join(sorted(input()))
    try:
        ans += unique_string[s]
        unique_string[s] += 1
    except KeyError:
        unique_string[s] = 1

print(ans)
### BUGGY CODE ###

s = input()
K = int(input())

l = {s}
for n in range(1, len(s)):
    for i in range(0, len(s)-n+1):
        l.add(s[i:i+n])

l = list(l)

l.sort()

print(l[K-1])

### FIXED CODE ###

s = input()
K = int(input())

l = {s}
for n in range(1, K+1):
    for i in range(0, len(s)-n+1):
        l.add(s[i:i+n])

l = list(l)

l.sort()

print(l[K-1])
### BUGGY CODE ###

import copy
import collections
n = int(input())

a_list = list(map(str, input().split()))
c = collections.Counter(a_list)


for k in range(n):
    ans = 0
    #tmp = c[str(a_list[k])] # a_list[k]の数の個数
    #print('tmp')
    #print(tmp)
    for j in c:
        if str(a_list[k]) == j:
            tmp = c[str(a_list[k])]-1
            #print('tmp')
            #print(tmp)
        else:
            tmp = c[str(j)]
            #print('tmp')
            #print(tmp)
        ans += (tmp-1)*tmp/2

    print(int(ans))




### FIXED CODE ###

import copy
import collections
n = int(input())

a_list = list(map(str, input().split()))
c = collections.Counter(a_list)

tmp_list = []

ans = 0
for j in c:
    tmp = c[str(j)]
    #print('tmp')
    #print(tmp)
    ans += (tmp-1)*tmp/2

#print('ttt')
#print(ans)


for k in range(n):
    #ans = 0
    #tmp = c[str(a_list[k])] # a_list[k]の数の個数
    #print('tmp')
    #print(tmp)
    #print(c[str(a_list[k])]-1)
    #ans -= c[str(a_list[k])]-1
    #if str(a_list[k]) == j:
    #    tmp = c[str(a_list[k])]-1
    #else:
    #    tmp = c[str(j)]

    #ans += (tmp-1)*tmp/2

    print(int(ans - (c[str(a_list[k])]-1)))
### BUGGY CODE ###

s=input()
N=len(s)
t=input()
M=len(t)

dp=[['' for i in range(0,M)] for i in range(0,N)]

firsts=N
for i in range(0,N):
    if s[i]==t[0]:
        firsts=i
        break

firstt=M
for i in range(0,M):
    if t[i]==s[0]:
        firstt=i
        break

for i in range(0,N):
    if i>=firsts:
        dp[i][0]=t[0]

for i in range(0,M):
    if i>=firstt:
        dp[0][i]=s[0]

for i in range(1,N):
    for j in range(1,M):
        if s[i]==t[j]:
            dp[i][j]=dp[i-1][j-1]+s[i]
        else:
            if len(dp[i][j-1])>len(dp[i-1][j]):
                dp[i][j]=dp[i][j-1]
            else:
                dp[i][j]=dp[i-1][j]

print(dp[N-1][M-1])

### FIXED CODE ###

s=input()
N=len(s)
t=input()
M=len(t)

alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def al(str):
    return alphabetlist.index(str)+1

dp=[[0 for i in range(0,M+1)] for i in range(0,N+1)]

for i in range(0,N):
    for j in range(0,M):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            if dp[i+1][j]>dp[i][j+1]:
                dp[i+1][j+1]=dp[i+1][j]
            else:
                dp[i+1][j+1]=dp[i][j+1]

ans=[]
i=N
j=M
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans.append(s[i-1])
        i-=1
        j-=1

ans=ans[::-1]
print(''.join(ans))
### BUGGY CODE ###

from sys import stdin

N = int(input())
readline = stdin.readline
A = list(readline().split())

def ncr(n):
    return n*(n-1) // 2

dmemo = {}
for a in A:
    dmemo.setdefault(a, 0)
    dmemo[a] += 1

cmemo = {}

for a in A:
    ans = 0
    for dk, dv in dmemo.items():
        if dk == a:
            dv -= 1
        
        if dv not in cmemo:
            val = ncr(dv)
            cmemo[dv] = val
        ans += cmemo[dv]
    print(ans)


### FIXED CODE ###

from sys import stdin

N = int(input())
readline = stdin.readline
A = list(readline().split())

def ncr(n):
    return n*(n-1) // 2

dmemo = {}
for a in A:
    dmemo.setdefault(a, 0)
    dmemo[a] += 1

max_num = 0
cmemo = {}
for dk, dv in dmemo.items():
    if dv not in cmemo:
        val = ncr(dv)
        cmemo[dv] = val
    max_num += cmemo[dv]

for a in A:
    val = dmemo[a]
    a1 = ncr(val)
    a2 = ncr(val-1)
    ans = max_num - a1 + a2
    print(ans)
### BUGGY CODE ###

import math
k = int(input())+1
ans = 0
for i in range(1,k):
  for j in range(1,k):
    for l in range(1,k):
      ans += math.gcd(math.gcd(i,j),l)
print(ans)

### FIXED CODE ###

from math import gcd
k = int(input())+1
ans = 0
for i in range(1,k):
  for j in range(1,k):
    for l in range(1,k):
      ans += gcd(gcd(i,j),l)
print(ans)