Harryxun/stf_run huggingface dataset:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

OFS=20
KK = 41
n = inn()
d = [[0]*KK for i in range(KK)]
for i in range(n):
    a = ins()
    p = a.find('.')
    if p<0:
        v = int(a)
        k = 0
    else:
        b = a[:p]+a[p+1:]
        v = int(b)
        k = len(a)-1-p
    x2 = 0
    while v%2==0:
        x2 += 1
        v //= 2
    x5 = 0
    while v%5==0:
        x5 += 1
        v //= 5
    d[x2-k+OFS][x5-k+OFS] += 1

#if DBG:
#    for i in range(KK):
#        for j in range(KK):
#            if d[i][j]!=0:
#                ddprint(f"i {i-OFS} j {j-OFS} {d[i][j]}")

ans = 0
h = {}
for p in range(KK):
    for q in range(KK):
        sm = 0 if p<OFS or q<OFS else (d[p][q]*(d[p][q]-1)//2)
        #if sm>0:
        #ddprint(f"p {p-OFS} q {q-OFS} d {d[p][q]} {sm=}")
        for r in range(-p+2*OFS,KK):
            #if r==p:
            #    continue
            for s in range(-q+2*OFS,KK):
                if (r,s)==(p,q) or (r,s,p,q) in h:
                    continue
                h[(p,q,r,s)] = 1
                sm += d[p][q]*d[r][s]
                #if d[p][q]*d[r][s]>0:
                #    ddprint(f"p {p-OFS} q {q-OFS} r {r-OFS} s {s-OFS} d {d[p][q]} {d[r][s]}")
        ans += sm
print(ans)


### FIXED CODE ###

#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

OFS=20
KK = 41
n = inn()
d = [[0]*KK for i in range(KK)]
for i in range(n):
    a = ins()
    p = a.find('.')
    if p<0:
        v = int(a)
        k = 0
    else:
        b = a[:p]+a[p+1:]
        v = int(b)
        k = len(a)-1-p
    x2 = 0
    while v%2==0:
        x2 += 1
        v //= 2
    x2 = min(x2,OFS)
    x5 = 0
    while v%5==0:
        x5 += 1
        v //= 5
    x5 = min(x5,OFS)
    d[x2-k+OFS][x5-k+OFS] += 1

#if DBG:
#    for i in range(KK):
#        for j in range(KK):
#            if d[i][j]!=0:
#                ddprint(f"i {i-OFS} j {j-OFS} {d[i][j]}")

ans = 0
h = {}
for p in range(KK):
    for q in range(KK):
        sm = 0 if p<OFS or q<OFS else (d[p][q]*(d[p][q]-1)//2)
        #if sm>0:
        #ddprint(f"p {p-OFS} q {q-OFS} d {d[p][q]} {sm=}")
        for r in range(-p+2*OFS,KK):
            #if r==p:
            #    continue
            for s in range(-q+2*OFS,KK):
                if (r,s)==(p,q) or (r,s,p,q) in h:
                    continue
                h[(p,q,r,s)] = 1
                sm += d[p][q]*d[r][s]
                #if d[p][q]*d[r][s]>0:
                #    ddprint(f"p {p-OFS} q {q-OFS} r {r-OFS} s {s-OFS} d {d[p][q]} {d[r][s]}")
        ans += sm
print(ans)
N = int(input())
L = [2, 1]
if N > 2:
  for i in range(N - 1):
    L.append(L[i]+L[i+1])
print(L[N])

### FIXED CODE ###

N = int(input())
L = [2, 1]
if N >= 2:
  for i in range(N-1):
    L.append(L[i]+L[i+1])
print(L[N])
[ print(["YES", "NO"][0 if d[0] ** 2 + d[1] ** 2 == d[2] ** 2 else 1]) for i,d in enumerate([sorted([int(x) ** 2 for x in input().split()])]) for _ in range(int(input()))]

### FIXED CODE ###

[print("YES" if i[0] + i[1] == i[2] else "NO") for _ in range(int(input())) for i in [sorted([int(x) ** 2 for x in input().split()])]]
import math
N = int(input())
n = int(math.sqrt(N))
ans = 0
for x in range(1, n+1):
    m = N // x - 1
    if N % x == 0 and x == N % m:
        ans += m
print(ans)

### FIXED CODE ###

import math
N = int(input())
n = int(math.sqrt(N))
ans = 0
for x in range(1, n+1):
    m = N // x - 1
    if m > 0 and N % x == 0 and x == N % m:
        ans += m
print(ans)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
As.sort()
mini = As.pop(0)
maxi = As.pop()

ans = []
for a in As:
    if a>=0:
        ans.append((mini, a))
        mini -= a
    else:
        ans.append(print(maxi, a))
        maxi -= a

print(maxi-mini)
for a in ans:
    print(*a)
    print(maxi, mini)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
As.sort()
mini = As.pop(0)
maxi = As.pop()

ans = []
for a in As:
    if a>=0:
        ans.append((mini, a))
        mini -= a
    else:
        ans.append((maxi, a))
        maxi -= a

print(maxi-mini)
for a in ans:
    print(*a)
print(maxi, mini)
# A - 01 Matrix
H,W,A,B = map(int,input().split())
if H==1:
    for _ in range(A):
        print(1,end='')
    for _ in range(W-A):
        print(0,end='')
    print('')
elif W==1:
    for _ in range(B):
        print(1)
    for _ in range(H-B):
        print(0)
elif H*A!=W*B:
    print('No')
else:
    for i in range(H):
        for j in range(W):
            if (-A*(i//B)+j)%W<A:
                print(1,end='')
            else:
                print(0,end='')
        print('')

### FIXED CODE ###

# A - 01 Matrix
H,W,A,B = map(int,input().split())
for i in range(H):
    for j in range(W):
        print((int(i<B)+int(j<A))%2,sep='',end='')
    print('')
X,Y,Z = map(int,input().split)
X,Y,Z = Z,X,Y
print(X,Y,Z)

### FIXED CODE ###

X,Y,Z = map(int,input().split())
X,Y = Y,X
X,Z = Z,X
print(X,Y,Z)
N, Y = map(int, input().split())
a = -1
b = -1
c = -1
judge = False

money = x * 10000 + y * 5000 + z * 1000
for x in range(20, -1, -1):
    money_max = x * 10000 + (N-x) * 5000
    money_min = x * 10000 + (N-x) * 1000
    if money_min <= Y and Y <=money_max:
        for y in range(N-x, -1, -1):
            money = x * 10000 + y * 5000 + (N - x - y)* 1000
            if money == Y:
                a = x
                b = y
                c = N - (x + y)
                judge = True
                break
    if judge:
        break
print(a, b, c)


### FIXED CODE ###

N, Y = map(int, input().split())

a = -1
b = -1
c = -1
judge = False

for x in range(N, -1, -1):
    money_max = x * 10000 + (N-x) * 5000
    money_min = x * 10000 + (N-x) * 1000
    if money_min <= Y and Y <= money_max:
        for y in range(N-x, -1, -1):
            money = x * 10000 + y * 5000 + (N - x - y)* 1000
            if money == Y:
                a = x
                b = y
                c = N - (x + y)
                judge = True
                break
    if judge:
        break
print(a, b, c)
import math
A, B, C, X, Y = map(int, input().split())

# xn, yn = 0, 0
# price = 0
# 
# if (A+B) >= 2*C and A >= 1 and B >= 1:
#     ammount = min(X, Y)
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# if A >= 2*C and X > xn:
#     ammount = X - xn
#     price += C * X * 2
#     xn += X
#     yn += X
# 
# if B >= 2*C and Y > yn:
#     ammount = Y - yn
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# price += A * (X - xn)
# price += B * (Y - yn)
# 
# print(price)
# 

min_price = math.inf
for i in range(max(X, Y)+1):
    xn, yn = i, i
    price = (2*C) * i
    price += (max(0, X - xn)) * A
    price += (max(0, Y - yn)) * B
    min_price = min(min_price, price)

print(min_price)

### FIXED CODE ###

A, B, C, X, Y = map(int, input().split())

# xn, yn = 0, 0
# price = 0
# 
# if (A+B) >= 2*C and A >= 1 and B >= 1:
#     ammount = min(X, Y)
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# if A >= 2*C and X > xn:
#     ammount = X - xn
#     price += C * X * 2
#     xn += X
#     yn += X
# 
# if B >= 2*C and Y > yn:
#     ammount = Y - yn
#     price += C * ammount * 2
#     xn += ammount
#     yn += ammount
# 
# price += A * (X - xn)
# price += B * (Y - yn)
# 
# print(price)
# 

min_price = 1 << 32 
for i in range(max(X, Y)+1):
    xn, yn = i, i
    price = (2*C) * i
    price += (max(0, X - xn)) * A
    price += (max(0, Y - yn)) * B
    min_price = min(min_price, price)

print(min_price)
import math

s=input()
l=len(s)

ans=0
mindiff=1000

for i in range(l-2):
  if mindiff > math.abs(int(s[i:i+3])-753):
    ans=int(s[i:i+3])
    mindiff=math.abs(int(s[i:i+3])-753)

print(ans)
            

### FIXED CODE ###

s=input()
l=len(s)

mindiff=1000

for i in range(l-2):
  if mindiff > abs(int(s[i:i+3])-753):
    mindiff=abs(int(s[i:i+3])-753)

print(mindiff)
n = int(input())
a = []
ans = 0
flag = True
for i in range(n):
    A = int(input())
    a.append(A)
next = 0
for i in range(n-1,-1,-1):
    if a[i] == 0:
        next = 0
        continue
    if next - a[i] == 1:
        next = a[i]
        continue
    if next - a[i] >= 2:
        flag = False
        break
    next = a[i]
    ans += a[i]
if a[0] != 0:
    flag = False
if flag:
    #print(ans)
else:
    #print(-1)
print(-1)


### FIXED CODE ###

n = int(input())
a = []
ans = 0
flag = True
for i in range(n):
    A = int(input())
    a.append(A)
next = 0
for i in range(n-1,-1,-1):
    if next - a[i] >= 2:
        flag = False
        break
    if a[i] == 0:
        next = 0
        continue
    if next - a[i] == 1:
        next = a[i]
        continue
    next = a[i]
    ans += a[i]
if a[0] != 0:
    flag = False
if flag:
    print(ans)
else:
    print(-1)
n=int(input())
for i in range(int(n**0.5),0,-1):
    if n%i==0:
        ptint(i+n//1)
        exit()


### FIXED CODE ###

n=int(input())
for i in range(int(n**0.5),0,-1):
    if n%i==0:
        print(i+n//i-2)
        exit()
a = input()
b = int(a[:2])
c = int(a[2:])
if 0 < b <= 12 and a < c <= 12:
    print("AMBIGUOUS")
elif 0 < b <= 12 and c > 12:
    print("MMYY")
elif b > 12 and 0 < c <= 12:
    print("YYMM")
else:
    print("NA")


### FIXED CODE ###

a = input()

if 1 <= int(a[:2]) <= 12 and 1 <= int(a[2:]) <= 12:
    print("AMBIGUOUS")
elif 1 <= int(a[:2]) <= 12:
    print("MMYY")
elif 1 <= int(a[2:]) <= 12:
    print("YYMM")
else:
    print("NA")
s=input()
p="KIHBR"
j=0
c=0
for i in range(len(s)):
	if s[i]==p[j]:
		j+=1
		c=0
	elif s[i]=="A" and j!=1 and c==0:
		c+=1
		continue
	else:
		print("NO")
		exit()
if j==5:
	print("YES")
else:
	print("NO")

	

### FIXED CODE ###

s=input()
ans=set()
def two(k):
	 qq="0"*(9-len(bin(k)[2:]))+bin(k)[2:]
	 return qq

for i in range(1,2**9):
	p=""
	for j in range(9):
		if two(i)[j]=="1":
			p+="AKIHABARA"[j]
		if "KI" in p and "H" in p and "B" in p and "R" in p:
			ans.add(p)
if s in ans:
	print("YES")
else:
	print("NO")
x=input(int)
print(x**3)

### FIXED CODE ###

x=int(input())
print(x*x*x)
# -*- coding: utf-8 -*-
import numpy as np

def mk_prime_list(num):
    num_list = np.array(range(2, num + 1))
    prime_list = np.array([])

    i = num_list[0]
    while i <= np.sqrt(num):
        prime_list = np.append(prime_list, i)
        num_list = num_list[~(num_list % i == 0)]
        i = num_list[0]

    return prime_list


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

if a > b:
    max_num = a
else:
    max_num = b

prime_list = mk_prime_list(max_num)

ans = 1

for i in prime_list:
    if a % i == 0 and b % i == 0:
        ans += 1

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np

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

soin_a = np.array([], dtype='int')
for i in range(2, int(np.sqrt(a)) + 1):
    if a % i == 0:
        soin_a = np.append(soin_a, i)
        while a % i == 0:
            a //= i
if a != 1:
    soin_a = np.append(soin_a, a)

soin_b = np.array([], dtype='int')
for i in range(2, int(np.sqrt(b)) + 1):
    if b % i == 0:
        soin_b = np.append(soin_b, i)
        while b % i == 0:
            b //= i
if b != 1:
    soin_b = np.append(soin_b, b)

ans = 1
for j in soin_a:
    if soin_b[soin_b == j].size != 0:
        ans += 1

print(ans)
n=int(input())
h=list(map(int,input().split()))
k=list()
sum=0
if n==1: print(0)
else:
	for i in range(n-1):
		if h[i] < h[i+1]:
			k.append(sum)
			sum=0
		else:
			sum+=1
	k=max(k)
	ans=max(k,sum)
	print(ans)


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
k=list()
sum=0
ans=0
if n==1: print(0)
else:
	for i in range(n-1):
		if h[i] < h[i+1]:
			sum=0
		else:
			sum+=1
			ans=max(ans,sum)
	print(ans)
n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def count(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if say != 2:
			continue
		if say != honest[x]:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
		if not checkHonest(sayTable[i]):
			return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n;
		if checkHonestAll(sayTable, honest):
			return count(honest)
		else:
			return 0

	count = 0
	h = honest[i]
	if (h == 0 or h == 2) and checkHonest(sayTable, honest):
  		copyHonest = honest[:]
        setHonest(honest, sayTable[i])
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i + 1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0));


### FIXED CODE ###

n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def countHonest(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if honest[x] == 0:
				continue
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
		sayArray = sayTable[i]
		for x, y in sayArray:
			if y != honest[x]:
				return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n:
		if checkHonestAll(sayTable, honest):
			return countHonest(honest)
		else:
			return 0

	count = 0
	h = honest[i]
	sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i+1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0))
set = input()
words = []
for i in range(len(set)):
    if set[i] == "0":
        words.append("0")
    if set[i] == "1":
        words.append("1")
    if set[i] == "B":
        words.pop(-1)
word = ""
for i in words:
    word += i
print(word)


### FIXED CODE ###

set = input()
words = []
for i in range(len(set)):
    if set[i] == "0":
        words.append("0")
    if set[i] == "1":
        words.append("1")
    if set[i] == "B":
        try:
            words.pop(-1)
        except:
            pass
word = ""
for i in words:
    word += i
print(word)
import sys
from collections import deque

# input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


def main():
    BLACK = '#'
    WHITE = '.'
    H, W = map(int, input().split())
    graph = [None] * H
    # w_score = [[0 for i in range(W)] for i in range(H)]
    # h_score = [[0 for i in range(W)] for i in range(H)]
    options = [(-1, 0), (0, 1), (1, 0), (0, -1)]
    visited = [[False for i in range(W)] for i in range(H)]
    initial = []

    for i in range(H):
        graph[i] = list(input())

        for j in range(W):
            if graph[i][j] == BLACK:
                initial.append((i, j))
                visited[i][j] = True

    q = deque()
    q.append(initial)
    ans = 0
    while len(q) != 0:
        n = q.popleft()
        # print(ans, n)

        items = set()
        for p in n:
            for d in options:
                i = p[0] + d[0]
                j = p[1] + d[1]

                if i >= 0 and i < W and j >= 0 and j < H and not visited[i][j] and graph[i][j] == WHITE:
                    visited[i][j] = True
                    graph[i][j] = BLACK
                    items.add((i, j))
                # else:
                #     print(i, j)

        if len(items) > 0:
            ans += 1
            q.append(items)

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###


import sys
from collections import deque

# input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


def main():
    BLACK = '#'
    WHITE = '.'
    H, W = map(int, input().split())
    graph = [None] * H
    # w_score = [[0 for i in range(W)] for i in range(H)]
    # h_score = [[0 for i in range(W)] for i in range(H)]
    options = [(-1, 0), (0, 1), (1, 0), (0, -1)]
    visited = [[False for i in range(W)] for i in range(H)]
    initial = []

    for i in range(H):
        graph[i] = list(input())

        for j in range(W):
            if graph[i][j] == BLACK:
                initial.append((i, j))
                visited[i][j] = True

    # print(visited)
    # print(graph)

    q = deque()
    q.append(initial)
    ans = 0
    while len(q) != 0:
        n = q.popleft()
        # print(ans, n)

        items = set()
        for p in n:
            for d in options:
                i = p[0] + d[0]
                j = p[1] + d[1]

                if i >= 0 and i < H and j >= 0 and j < W and not visited[i][j] and graph[i][j] == WHITE:
                    visited[i][j] = True
                    graph[i][j] = BLACK
                    items.add((i, j))
                # else:
                #     print(i, j)

        if len(items) > 0:
            ans += 1
            q.append(items)

    print(ans)


if __name__ == '__main__':
    main()
#ABC047.B
w,h,n = map(int,input().split())

#座標を作る
right = w
left = 0
upper = h
under = 0

for _ in range(n):
    x,y,a = map(int,input().split())

if a ==1:
    left = max(x,left)
elif a ==2:
    right = min (x,right)
elif a ==3:
    under = max(y,under)
elif a ==4:
    upper = min(y,upper)

if　(upper-under)>0 and (right-left)>0:
    c = (upper-under)*(right-left)
    print(c)
else:
    print(0)

### FIXED CODE ###

#ABC047.B

w,h,n = map(int,input().split())
#座標を作る
right = w
left = 0
upper = h
under = 0

for _ in range(n):
    x,y,a = map(int,input().split())

    if a ==1:
        left = max(x,left)
    elif a ==2:
        right = min(x,right)
    elif a ==3:
        under = max(y,under)
    else:
        upper = min(y,upper)

if(upper-under)>0 and (right-left)>0:
    c = (upper-under)*(right-left)
    print(c)
else:
    print(0)
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def modfact(n):
    fact=[1]*(n+1)
    invfact=[1]*(n+1)
    for i in range(1,n+1):
        fact[i]=i*fact[i-1]%MOD
    invfact[n]=pow(fact[n],MOD-2,MOD)
    for i in range(n-1,-1,-1):
        invfact[i]=invfact[i+1]*(i+1)%MOD
    return fact,invfact

def prime_factorization(n):
    factor=[]
    sqrt=int(n**.5)
    for d in range(2,sqrt+1):
        while(n%d==0):
            n//=d
            factor.append(d)
    if n!=1: factor.append(n)
    return factor

def resolve():
    from collections import Counter
    n,m=map(int,input().split())
    if(n==1):
        print(1)
        return
        
    P=prime_factorization(m)
    C=Counter(P)
    C=list(C.values())

    N=max(C)
    fact,invfact=modfact(N+n)

    ans=1
    for v in C:
        ans*=fact[v+n-1]*invfact[n-1]*invfact[v]
        ans%=MOD
    print(ans)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def modfact(n):
    fact=[1]*(n+1)
    invfact=[1]*(n+1)
    for i in range(1,n+1):
        fact[i]=i*fact[i-1]%MOD
    invfact[n]=pow(fact[n],MOD-2,MOD)
    for i in range(n-1,-1,-1):
        invfact[i]=invfact[i+1]*(i+1)%MOD
    return fact,invfact

def prime_factorization(n):
    assert(n>=2)
    factor=[]
    sqrt=int(n**.5)
    for d in range(2,sqrt+1):
        while(n%d==0):
            n//=d
            factor.append(d)
    if n!=1: factor.append(n)
    return factor

def resolve():
    from collections import Counter
    n,m=map(int,input().split())
    if(m==1):
        print(1)
        return
        
    P=prime_factorization(m)
    C=Counter(P)
    C=list(C.values())

    N=max(C)
    fact,invfact=modfact(N+n)

    ans=1
    for v in C:
        ans*=fact[v+n-1]*invfact[n-1]*invfact[v]
        ans%=MOD
    print(ans)
resolve()
N = int(input())
infants = []
for i, A in enumerate(map(int, input().split(' '))):
    infants.append((-A, i + 1))
infants.sort()
dp = [{} for _ in range(N)]


def search(i, l):
    # i番目の幼児を見ていて左にl人配置している
    if i == N:
        return 0
    if l in dp[i]:
        return dp[i][l]
    (act_val, pos) = infants[i]
    act_val = -act_val
    ans = max(search(i + 1, l + 1) + abs(l + 1 - pos) * act_val,
              search(i + 1, l) + abs(N - i + l - pos) * act_val)
    dp[i][l] = ans
    return ans


print(search(0, 0))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())
infants = []
for i, A in enumerate(map(int, input().split(' '))):
    infants.append((-A, i + 1))
infants.sort()
dp = [[-1 for _ in range(N + 1)] for _ in range(N + 1)]


def search(i, l):
    # i番目の幼児を見ていて左にl人配置している
    if i == N:
        return 0
    if dp[i][l] != -1:
        return dp[i][l]
    (act_val, pos) = infants[i]
    act_val = -act_val
    ans = max(search(i + 1, l + 1) + abs(l + 1 - pos) * act_val,
              search(i + 1, l) + abs(N - i + l - pos) * act_val)
    dp[i][l] = ans
    return ans


print(search(0, 0))
s=input().split()
a=s[0]
b=s[1]

if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else
    print("a < b")


### FIXED CODE ###

s=input().split()
a=int(s[0])
b=int(s[1])

if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")
S = list(input())
pair = []
cnt = 0
now = S[0]
s, t = 0, 0
for i in range(1, len(S)-1):
  if now == 'R' and S[i+1] == 'L':
    pair += [[i, i+1]]
    now = 'L'
  if now == 'L' and S[i+1] == 'R':
    pair[-1] += [s, t+1]
    now = 'R'
    s = t+2
  t += 1


pair[-1] += [s, t+1]
result = [0]*len(S)
for a, b, s, t in pair:
  p = t - s + 1
  if p % 2 == 0:
    result[a] = p // 2
    result[b] = p // 2
  else:
    a_even = (a-s)//2 + (t-a)//2 + 1
    b_even = p-a_even
    result[a] = a_even
    result[b] = b_even
result = list(map(str, result))
print(" ".join(result))

### FIXED CODE ###

S = list(input())
pair = []
cnt = 0
now = S[0]
if len(S) == 2:
  print(1, 1)
  exit()
s, t = 0, 0
for i in range(len(S)-1):
  if now == 'R' and S[i+1] == 'L':
    pair += [[i, i+1]]
    now = 'L'
  if now == 'L' and S[i+1] == 'R':
    pair[-1] += [s, t]
    now = 'R'
    s = t+1
  t += 1


pair[-1] += [s, t]
result = [0]*len(S)
for a, b, s, t in pair:
  p = t - s + 1
  if p % 2 == 0:
    result[a] = p // 2
    result[b] = p // 2
  else:
    a_even = (a-s)//2 + (t-a)//2 + 1
    b_even = p-a_even
    result[a] = a_even
    result[b] = b_even
result = list(map(str, result))
print(" ".join(result))
s = [x for x in input()]
print('yes' if all(s.count(c)==1 for c in s else 'no')

### FIXED CODE ###

s = [x for x in input()]
print('yes' if all([(s.count(c)==1) for c in s])  else 'no')