Harryxun/stf_run huggingface dataset:
n = int(input())
s = list(input())
leng = []
cnt = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        leng.append([s[i], cnt])
        cnt = 1
if s[-1] == "(":
    leng.append(["(", cnt])
else:
    leng.append([")", cnt])
if s[0] == ")":
    leng.insert(0,["(", leng[0][1]])
if s[-1] == "(":
    leng.insert(len(leng),[")", leng[-1][1]])

leng2 = []
for i in range(0, len(leng), 2):
    l = leng[i]
    r = leng[i+1]
    if l[1] == r[1]:
        pass
    elif l[1] < r[1]:
        leng2.append([")",r[1]-l[1]])
    else:
        leng2.append(["(", l[1]-r[1]])

lc = 0
rc = 0
while leng2:
    if leng2[0][0] == ")":
        leng[0][1] += leng2[0][1]
        u = leng2.pop(0)
    else:
        break
while leng2:
    if leng2[-1][0] == "(":
        leng[-1][1] += leng2[-1][1]
        u = leng2.pop()
    else:
        break
lc = 0
rc = 0
for i in range(len(leng2)):
    tar = leng2[i]
    if tar[0] == "(":
        lc += tar[1]
    else:
        rc += tar[1]
if lc > rc:
    s[-1][1] += lc-rc
elif lc < rc:
    s[0][1] += rc-lc

ans = []
for i in range(len(leng)):
    tar = leng[i]
    for j in range(tar[1]):
        ans.append(tar[0])
print("".join(ans))










### FIXED CODE ###

n = int(input())
s = list(input())
leng = []
cnt = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        leng.append([s[i], cnt])
        cnt = 1
if s[-1] == "(":
    leng.append(["(", cnt])
else:
    leng.append([")", cnt])
if s[0] == ")":
    leng.insert(0,["(", leng[0][1]])
if s[-1] == "(":
    leng.insert(len(leng),[")", leng[-1][1]])

leng2 = []
for i in range(0, len(leng), 2):
    l = leng[i]
    r = leng[i+1]
    if l[1] == r[1]:
        pass
    elif l[1] < r[1]:
        leng2.append([")",r[1]-l[1]])
    else:
        leng2.append(["(", l[1]-r[1]])

lc = 0
rc = 0
for i in range(len(leng2)):
    if leng2[i][0] == "(":
        lc += leng2[i][1]
    else:
        rc += leng2[i][1]
    if rc - lc > 0:
        leng[0][1] += rc-lc
        lc = 0
        rc = 0
leng[-1][1] += lc-rc

ans = []
for i in range(len(leng)):
    tar = leng[i]
    for j in range(tar[1]):
        ans.append(tar[0])
print("".join(ans))
#include <bits/stdc++.h>
using namespace std;
string solve()
{
    int N;
    cin>>N;
    int last = 1;
    for(int i=2; i*i<=N; i++){
        if(N%i==0){
            last = i;
        }
    }
    N = N/last;
    if(N>9 || last>9)return "No";
    return "Yes";
}
int main()
{
    cout << solve() << endl;
}

### FIXED CODE ###

a = int(input())
if(a > 81 or a==0):
    print("No")
elif(0<a<10):
    print("Yes")
else:
    for i in range(9, 0, -1):
        if(a%i==0):
            a = a//i
            break
    if(a>9):
        print("No")
    else:
        print("Yes")
r, c = input().split()
r = int(r)
c = int(c)

a = [0]*c

for i in range(r):
    a[i] = list(map(int, input().split()))
    a[i].append(sum(a[i]))
    print(*a[i])

b = list(zip(*a))
print(*[sum(b[i]) for i in range(len(b))])

### FIXED CODE ###

r, c = input().split()
r = int(r)
c = int(c)

a = [0]*r

for i in range(r):
    a[i] = list(map(int, input().split()))
    a[i].append(sum(a[i]))
    print(*a[i])
print(*list(map(sum, zip(*a))))
n = int(input())
li = list(map(int,input().split()))
lis = []
x = 0
y = 0
z = 0
for i in range(n):
    if li[i] % 4 == 0:
        x += 1
    elif li[i] % 2 == 0:
        y = 1
    else:
        z += 1
if y = 0:
    if x >= y + 1:
        print("Yes")
    else:
        print("No")
else:
    if x >= y:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

n = int(input())
li = list(map(int,input().split()))
lis = []
x = 0
y = 0
z = 0
for i in range(n):
    if li[i] % 4 == 0:
        x += 1
    elif li[i] % 2 == 0:
        y = 1
    else:
        z += 1
if y == 0:
    if x + 1 >= z:
        print("Yes")
    else:
        print("No")
else:
    if x >= z:
        print("Yes")
    else:
        print("No")
nv,ne = [int(i) for i in input().split()]

a = []

for i in range(nv):
    a.append([])

for i in range(ne):
    s,t = [int(j) for j in input().split()]
    a[s].append(t)

done = []

flag = 0

def put_forword(index):
    global f

    if index in done:
        return

    done.append(index)

    for s in a[index]:

        if s == 0:
            f = 1
            return
        put_forword(s)

put_forword(0)
print(f)



### FIXED CODE ###


nv,ne = [int(i) for i in input().split()]

g = [[] for i in range(nv)]

for i in range(ne):
    s,t = [int(j) for j in input().split()]
    g[s].append(t)

visited = []
f = 0

def pursue_from(index, origin):

    if visited[index]:
        return

    visited[index] = True

    for next_index in g[index]:

        if next_index == origin:
            global f
            f = 1
            return
        pursue_from(next_index, origin)

for i in range(nv):
    visited = [False for i in range(nv)]

    pursue_from(i, i)

    if f == 1:
         break

print(f)
N = int(input())
K = int(input())
*A = map(int, input().split())
print(sum([min(a,K-a)*2 for a in A]))

### FIXED CODE ###

N = int(input())
K = int(input())
*A, = map(int, input().split())
print(sum([min(a,K-a)*2 for a in A]))
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse = True)
ans = A[0]

if N%2 == 0:
  for i in range(1,int(N/2)):
    ans = ans + A[i]*2
if N%2 == 1:
  for i in range(1,int((N-1)/2)):
    ans = ans + A[i]*2
  ans += A[(N+1)/2]
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse = True)
ans = A[0]

if N%2 == 0:
  for i in range(1,int(N/2)):
    ans = ans + A[i]*2
if N%2 == 1:
  for i in range(1,int((N-1)/2)):
    ans = ans + A[i]*2
  ans += A[int((N-1)/2)]
print(ans)
A, B = map(int, input())
print(max(A+B, A-B, A*B))

### FIXED CODE ###

A, B = map(int, input().split())
print(max([A+B, A-B, A*B]))
N, K=map(int, input())
a=1
T=0
if a<=N:
	a+=1
	P=input()
    if P>=K:
		T+=1
print(T)

### FIXED CODE ###

N, K=map(int, input().split())
A=list(map(int, input().split()))
a=0
for i in A:
	if i>=K:
		a+=1
print(a)
S = input()
nQ = int(input())

Ques = []
nReverse = 0
nAddFront= 0
nAddBack = 0
for i in range(nQ):
  line = input().split()
  if int(line[0]) == 1:
    nReverse += 1
    Ques.append([int(line[0])])
  else:
    if int(line[1]) == 1:
      if nReverse % 2 == 0:
        nAddFront += 1
      else:
        nAddBack  += 1
    else:
      if nReverse % 2 == 0:
        nAddBack += 1
      else:
        nAddFront  += 1      
    Ques.append([int(line[0]),int(line[1]),line[2]])

#print(nAddFront,nAddBack)
SS = [-1] * (nAddFront + len(S) + nAddBack)
for i in range(len(S)):
   SS[nAddFront + i] = S[i]

left = nAddFront -1
right= nAddFront + len(S)

nReverseLoc = 0
for iQ in Ques:
   print(SS)
   if iQ[0] == 1:
      nReverseLoc += 1
   if iQ[0] == 2:
    if int(iQ[1]) == 1:
      if nReverseLoc % 2 == 0:
        #nAddFront += 1
        SS[left] = iQ[2]
        left -= 1
      else:
        SS[right] = iQ[2]
        right += 1
    else:
      if nReverseLoc % 2 == 0:
        SS[right] = iQ[2]
        right += 1
      else:
        SS[left] = iQ[2]
        left  += 1 

S = "".join(SS)
if nReverse % 2 == 1:
  S = S[::-1]
  
print(S)

### FIXED CODE ###

S = input()
nQ = int(input())

Ques = []
nReverse = 0
nAddFront= 0
nAddBack = 0
for i in range(nQ):
  line = input().split()
  if int(line[0]) == 1:
    nReverse += 1
    Ques.append([int(line[0])])
  else:
    if int(line[1]) == 1:
      if nReverse % 2 == 0:
        nAddFront += 1
      else:
        nAddBack  += 1
    else:
      if nReverse % 2 == 0:
        nAddBack += 1
      else:
        nAddFront  += 1      
    Ques.append([int(line[0]),int(line[1]),line[2]])

#print(nAddFront,nAddBack)
SS = [-1] * (nAddFront + len(S) + nAddBack)
for i in range(len(S)):
   SS[nAddFront + i] = S[i]

left = nAddFront -1
right= nAddFront + len(S)

nReverseLoc = 0
for iQ in Ques:
   if iQ[0] == 1:
      nReverseLoc += 1
   if iQ[0] == 2:
    if int(iQ[1]) == 1:
      if nReverseLoc % 2 == 0:
        #nAddFront += 1
        SS[left] = iQ[2]
        left -= 1
      else:
        SS[right] = iQ[2]
        right += 1
    else:
      if nReverseLoc % 2 == 0:
        SS[right] = iQ[2]
        right += 1
      else:
        SS[left] = iQ[2]
        left  -= 1 

S = "".join(SS)
if nReverse % 2 == 1:
  S = S[::-1]
  
print(S)
n = int(input().split())
flag = False
for i in range(1, 10):
	for j in range(1, 10):
		if i*j == n:
        	flag = True
if flag is True:
    print("Yes")
else:
	print("No")

### FIXED CODE ###

n = int(input())
flag = False
for i in range(1, 10):
	for j in range(1, 10):
		if i*j == n:
			flag = True
if flag is True:
	print("Yes")
else:
	print("No")
x、y = map(input().split())
group1 = (1,3,5,7,8,10,12)
group2 = (4,6,9,11)
group3 = (2)
if (x in group1) and (y in group1) :
    print("Yes")
if (x in group2) and (y in group2) :
    print("Yes")
if (x in group3) and (y in group3) :
    print("Yes")
else:
    print("No")

### FIXED CODE ###

x, y = map(int,input().split())
group1 = {1,3,5,7,8,10,12}
group2 = {4,6,9,11}
group3 = {2}
if (x in group1) and (y in group1) :
    print("Yes")
elif (x in group2) and (y in group2) :
    print("Yes")
elif (x in group3) and (y in group3) :
    print("Yes")
else:
    print("No")
import itertools
n=int(input())
l=[]
for i in range(n):
  d=int(input())
  x,y=map(int,input().split())
  l.append([i,x-1,y])
out=0
for p in itertools.product([0,1],repeat=n):
  for ll in l:
    if p[ll[0]]==1 and p[ll[1]]!=ll[2]:
      out+=1
      break
print(n-out)
      

### FIXED CODE ###

import itertools
n=int(input())
la=[]
for _ in range(n):
  d=int(input())
  for dd in range(d):
    x,y=map(int,input().split())
    la.append([_,x-1,y])
ans=0
for i in itertools.product([0,1],repeat=n):
  s=sum(list(i))
  for l in la:
    if i[l[0]]==1 and i[l[1]]!=l[2]:
      break
  else:
    ans=max(ans,s)
print(ans)
import math
x = int(input())
ans = []
for j in range(math.ceil(math.sqrt(x))):
    for k in range(2,x):
        if j ** k <= x:
            ans.append(j ** k)
print(max(ans))

### FIXED CODE ###

import math
x = int(input())
ans = []
for j in range(1, math.ceil(math.sqrt(x)) + 1):
    for k in range(2,x + 2):
        if j ** k <= x:
            ans.append(j ** k)
print(max(ans))
x = int(input()
print(x * x * x)

### FIXED CODE ###

x=int(input()) 
print(x*x*x)
N,K = [int(i) for i in input().split()]
D = [int(i) for i in input().split()]
use = [0,1,2,3,4,5,6,7,8,9]
Keta = []
Keta.append(N // 1000)
Keta.append(N % 1000 // 100)
Keta.append(N % 1000 % 100 // 10)
Keta.append(N % 1000 % 100 % 10)
Keta_Min = []

for i in range(len(D)):
    use.remove(D[i])

for i in range(4):
    A = []
    for j in range(len(use)):
        if Keta[i] == 0:
            Keta_Min.append(0)
        elif Keta[i] <= use[j]:
            A.append(use[j])
            Keta_Min.append(min(A))

Answer = 0
Answer = Keta_Min[0] * 1000 + Keta_Min[1] * 100 + Keta_Min[2] * 10 + Keta_Min[3]
print(Answer)


### FIXED CODE ###

N,K = [int(i) for i in input().split()]
#D = [int(i) for i in input().split()]は数値代入
#文字列を複数代入
D = input().split()
#集合に置き換える(型はset)
D = set(D)
use = set(['0','1','2','3','4','5','6','7','8','9'])
use -= D

for i in range(N,100*N):
    if use >= set(str(i)):
        print(i)
        break
import statistics
data=[]
while True:
    n=eval(input())
    if n==0:break
    data.append(list(map(int,input().split())))
Data=iter(data)
for i in Data:
    print(statistics.stdev(i))

### FIXED CODE ###

import statistics
data=[]
while True:
    n=eval(input())
    if n==0:break
    data.append(list(map(int,input().split())))
Data=iter(data)
for i in Data:
        print(statistics.pstdev(i))
"""
in1 = '7 4 4'
in2 = ['1 2', '2 3', '2 5', '6 7', '3 5', '4 5', '3 4', '6 7']
N, K, L = [int(_) for _ in in1.split()]
pqrs = [[int(_) for _ in _.split()] for _ in in2]
"""
N, K, L = [int(idx1) for idx1 in input().split()]
pqrs = [[int(idx1) for idx1 in item1.split()] for item1 in input()]

def makeTree(a):
    aT = list(range(N + 1))
    for p, q in a:
        rootp     = getRoot(aT, p)
        rootq     = getRoot(aT, q)
        thisRoot  = max(rootp, rootq, q)
        aT[p]     = thisRoot
        aT[q]     = thisRoot
        aT[rootp] = thisRoot
        aT[rootq] = thisRoot
    return aT

def getRoot(a,i):
    if a[i] == i:
        return i
    else:
        a[i] = getRoot(a, a[i])
        return a[i]

MTree = makeTree(pqrs[0:K])
TTree = makeTree(pqrs[K:])

aRet = []
dRet = {}
for idx1 in range(1, N + 1):
    Comb = (getRoot(MTree, idx1), getRoot(TTree, idx1))
    aRet.append(Comb)
    if Comb in dRet:
        dRet[Comb] += 1
    else:
        dRet[Comb] = 1

print(" ".join([str(dRet[_]) for _ in aRet]))


### FIXED CODE ###

"""
in1 = '7 4 4'
in2 = ['1 2', '2 3', '2 5', '6 7', '3 5', '4 5', '3 4', '6 7']
N, K, L = map(int, in1.split())
pqrs = []
for idx1 in range(K + L):
    temp0, temp1 = map(int, in2[idx1].split())
    pqrs.append([temp0, temp1])
"""

def makeTree(a):
    aT = list(range(N + 1))
    for p, q in a:
        rootp     = getRoot(aT, p)
        rootq     = getRoot(aT, q)
        thisRoot  = max(rootp, rootq, q)
        aT[p]     = thisRoot
        aT[q]     = thisRoot
        aT[rootp] = thisRoot
        aT[rootq] = thisRoot
    return aT

def getRoot(a,i):
    if a[i] == i:
        return i
    else:
        a[i] = getRoot(a, a[i])
        return a[i]

N, K, L = map(int, input().split())
pqrs = []
for idx1 in range(K + L):
    temp0, temp1 = map(int, input().split())
    pqrs.append([temp0, temp1])

MTree = makeTree(pqrs[0:K])
TTree = makeTree(pqrs[K:])

aRet = []
dRet = {}
for idx1 in range(1, N + 1):
    Comb = (getRoot(MTree, idx1), getRoot(TTree, idx1))
    aRet.append(Comb)
    if Comb in dRet:
        dRet[Comb] += 1
    else:
        dRet[Comb] = 1

print(" ".join([str(dRet[_]) for _ in aRet]))
a = 0
b = 0
while True:
    n = input()
    i = 0
    if n != 0:
        while i != n:
            set = raw_input().split()
            set[0] = int(set[0])
            set[1] = int(set[1])

            if set[0] == set[1]:
                a += set[0]
                b += set[1]

            elif set[0] > set[1]:
                a += ( set[0] + set[1] )
            else:
                b += ( set[0] + set[1] )

            i += 1

        print a,b
    else:
        n=0

### FIXED CODE ###

printlist = []
while True:
    n = input()
    if n == 0:
        break
    a = 0
    b = 0
    i = 0
    if n != 0:
        while i != n:
            set = raw_input().split()
            set[0] = int(set[0])
            set[1] = int(set[1])

            if set[0] == set[1]:
                a += set[0]
                b += set[1]

            elif set[0] > set[1]:
                a += ( set[0] + set[1] )
            else:
                b += ( set[0] + set[1] )

            i += 1

        printlist.append(a)
        printlist.append(b)
    else:
        break

#print 'hoge'
p = len(printlist)
i = 0
while i != p:
    print printlist[i],printlist[i+1]
    i += 2
# PrimeNumber
# エラトステネスの篩

from itertools import product
import math

if __name__ == "__main__":
    while True:
        try:
            # 数値の入力があった
            n = int(input())
            nlist = []
            nlist2 = []
            plist = []

            # for i in range(2, n + 1):
            #    nlist.append(i)  # [2,3,4,5,6,...,n]
            nlist = range(3, n + 1, 2)

            while True:
                #print(nlist, " ", math.sqrt(n))
                sqrtn = math.sqrt(n)
                if nlist[0] > sqrtn:  # 終了条件
                    #plist.append(map(int,nlist))
                    plist.extend(nlist)
                    break
                else:
                    plist.append(nlist[0])

                    #i = 0
                    for j in nlist:
                        if j % nlist[0] != 0:
                            #nlist.pop(i)
                            #nlist.remove(j)
                            nlist2.append(j)
                            #i += 1
                    nlist = nlist2
                    nlist2 = []
            #print("fin: {}".format(plist))
            print(len(plist)+1) # 2の分を追加

        except EOFError:
            break  # escape from while loop

pass
#

### FIXED CODE ###

if __name__ == "__main__":
	maxn = 1000000
	plist = [False if i%2==0 or i%3==0 or i%5==0 else True for i in range(maxn)]

	plist[0] = plist[1] = False
	plist[2] = plist[3] = plist[5] = True

	for chki in range(3, maxn, 2):
		for j in range(chki**2, maxn, chki):
			plist[j] = False

	while True:
		try:
			#start = time.time()
			inn = int(raw_input())
			print plist[0:inn+1].count(True)
			#print plist
			#print plist.count(True)
			#print plist[0:10].count(True)
			#print plist[0:100000].count(True)
			#print plist[0:1000000].count(True)

			#elapsedTime = time.time() -start
			#print elapsedTime
		except:
			break
def solve():
    N = int(input())

    xs, ys = [], []
    for _ in range(N):
        x, y = map(int, input().split())
        xs.append(x)
        ys.append(y)
    
    T, B = max(ys), min(ys)
    L, R = min(xs), max(xs)

    # print(T, B, L, R)

    if T == B:
        return abs(R - L)

    if L == R:
        return abs(T - B)

    # T, B
    top_l, top_r = 10**10, -1
    bot_l, bot_r = 10**10, -1
    for i in range(N):
        if ys[i] == T:
            top_l = min(top_l, xs[i])
            top_r = max(top_r, xs[i])
        if ys[i] == B:
            bot_l = min(bot_l, xs[i])
            bot_r = max(bot_r, xs[i])

    # print(top_l, top_r)
    # print(bot_l, bot_r)

    # L, R
    left_t, left_b = -1, 10**10
    right_t, right_b = -1, 10**10
    for i in range(N):
        if xs[i] == L:
            left_t = max(left_t, ys[i])
            left_b = min(left_b, ys[i])
        if xs[i] == R:
            right_t = max(right_t, ys[i])
            right_b = min(right_b, ys[i])

    # print(left_t, left_b)
    # print(right_t, right_b)

    ans = -1
    for i in range(N):
        if ys[i] == T:
            d1 = abs(T - B) + abs(xs[i] - bot_l)
            d2 = abs(T - B) + abs(xs[i] - bot_r)
            ans = max(ans, max(d1, d2))
        if ys[i] == B:
            d1 = abs(T - B) + abs(xs[i] - top_l)
            d2 = abs(T - B) + abs(xs[i] - top_r)
            ans = max(ans, max(d1, d2))
        if xs[i] == L:
            d1 = abs(R - L) + abs(ys[i] - right_t)
            d1 = abs(R - L) + abs(ys[i] - right_b)
            ans = max(ans, max(d1, d2))
        if xs[i] == R:
            d1 = abs(R - L) + abs(ys[i] - left_t)
            d1 = abs(R - L) + abs(ys[i] - left_b)
            ans = max(ans, max(d1, d2))
    return ans


print(solve())
            

### FIXED CODE ###

N = int(input())
xs, ys = [], []
for _ in range(N):
    x, y = map(int, input().split())
    xs.append(x)
    ys.append(y)
A = [x + y for x, y in zip(xs, ys)]
B = [x - y for x, y in zip(xs, ys)]
ans = max([max(A) - min(A), max(B) - min(B)])
print(ans)
import math

n = (input())
a = int(n.split(" ")[0])
b = int(n.split(" ")[1])
lcm = int((a * b / math.gcd(a, b)))
print(lcm)

### FIXED CODE ###

import fractions

n = (input())
a = int(n.split(" ")[0])
b = int(n.split(" ")[1])
lcm = int((a * b / fractions.gcd(a, b)))
print(lcm)
N = int(input())

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

a = round((sum(X) / N), 3)
integer = int(a)
f = a - i

if f < 0.5:
    P = integer
else:
    P = integer + 1

total = 0
for i in X:
    total += (i - P) ** 2

print(total)

### FIXED CODE ###

N = int(input())
 
X = list(map(int, input().split()))
 
a = round((sum(X) / N), 3)
integer = int(a)
f = a - integer
 
if f < 0.5:
    P = integer
else:
    P = integer + 1
 
total = 0
for i in X:
    total += (i - P) ** 2
 
print(total)
import bisect

N,K = map(int,input().split())
N = [int(n) for n in str(N)]
D = set(map(int,input().split()))
nums = []
for i in range(10):
  if i not in D:nums.append(i)

if len(nums) == 0:
  print(N)
  exit()

nums.sort()

i = len(N)-1
while i>=0:
  if N[i] not in nums:
    if nums[-1] < N[i]:
      prv_len = len(N)
      tmp_N = [int(s) for s in str(int(''.join([str(n) for n in N[:i]])) + 1)]
      N = tmp_N + [nums[0]]
      if len(N) > prv_len: i += 1
    else:
      j = bisect.bisect(nums,N[i])
      j = j if j != -1 else 0
      N[i] = nums[j]
  i -= 1
print(''.join([str(n) for n in N]))

### FIXED CODE ###

import bisect

N,K = map(int,input().split())
N = [int(n) for n in str(N)]
D = set(map(int,input().split()))
nums = []
for i in range(10):
  if i not in D:nums.append(i)
nums.sort()

i = len(N)-1
while i>=0:
  if N[i] not in nums:
    if nums[-1] < N[i]:
      prv_len = len(N)
      tmp_N = [int(s) for s in str(int(''.join([str(n) for n in N[:i]])) + 1)] if len(N[:i])>0 else [1]
      N = tmp_N + [nums[0] for _ in range(prv_len-i)]
      if len(N) > prv_len: i += 1
    else:
      j = bisect.bisect(nums,N[i])
      N[i:] = [nums[j]] + [nums[0] for _ in range(len(N)-i-1)]
  #print(i,N)
  i -= 1
print(''.join([str(n) for n in N]))
#print(N)
import sys
import math
from collections import Counter
n = int(sys.stdin.readline())
A = map(int, sys.stdin.readline().split())
def comb(n):
  return int(math.factrial(n)/(math.factrial(n-2)*2))
for k in range(n):
  ans =0
  L=A[:k]+A[k+1:]
  for v in Counter(L).values():
    if v>=2:
      ans +=comb(v)
  print(ans)


### FIXED CODE ###

#ABC159D
import sys, math
from collections import Counter

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

def comb(n):
    return int(math.factorial(n)/(2*math.factorial(n-2)))

total = 0
L = Counter(A)
for v in L.values():
    if v>=2:
        total += comb(v)

for k in range(N):
    print(total - (L[A[k]]-1))
s=input()
resutl=''
for i in s:
    if i==',':
        result+=' '
    else:
        result+=i
print(result)

### FIXED CODE ###

s=input()
result=''
for i in s:
    if i==',':
        result+=' '
    else:
        result+=i
print(result)
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

V = sum(v)
# dp[i][j]:i番目までの品物から価値がj以上になるよう選んだときの重さの総和の最小値
dp = [[-1] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
	for j in range(V + 1):
		# i+1番目を選ぶ場合
		if j - v[i] >= 0:
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i])
		# i+1番目を選ばない場合
		dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

# dp[N][j]がW以下であるようなjの最大値が答えになる
ans = 0
for j in range(V + 1):
	if dp[N][j] <= W:
		ans = j

print(ans)

### FIXED CODE ###

from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

def score(li,n):
    dp = [-1 for _ in li]
    dp[0] = 0
    dp[1] = abs(li[1]-li[0])
    if n == 1:
        return dp[0]
    elif n == 2:
        return dp[1]
    else:
        for i in range(2,n):
            dp[i] = min(dp[i-2]+abs(li[i]-li[i-2]),dp[i-1]+abs(li[i]-li[i-1]))
        return(dp[n-1])
    
print(score(li,n))
import numpy as np
import collections
N=int(raw_input())
A=map(int, raw_input().split())
count_A=collections.Counter(A).most_common(1)

cnt = 0
if N%2 == 0:
    if A.count(0) >= 1:
        print 0
        cnt = 1
    elif count_A [0][1] != 2:
        print 0
        cnt = 1
    if cnt == 0:
        print 2**(N/2)%(10**9+7)
else:
    if A.count(0) >= 2:
        print 0
        cnt = 1
    elif count_A[0][1] != 2:
        print 0
        cnt = 1
    if cnt == 0:
        print 2**(N/2)%(10**9+7)

### FIXED CODE ###

str = raw_input().split()
print int(str[0]) + int(str[2]) if str[1] == "+" else int(str[0]) - int(str[2])
s=input()
if s='hi' or s='hihi' or s='hihihi' or s='hihihihi' or s='hihihihihi':
  print(Yes)
else:
  print(No)

### FIXED CODE ###

s=input()
if s=='hi' or s=='hihi' or s=='hihihi' or s=='hihihihi' or s=='hihihihihi':
    print('Yes')
else:
    print('No')