Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
B = [A[i] - 1 - i for i in range(N)]
B.sort()
if N % 2 == 0:
    med = [int((B[int(N / 2) - 1] + B[int(N / 2)]) / 2)]
else:
    med = [B[int((N + 1) / 2) - 1]]
S = 0
for i in range(N):
    S += abs(B[i] - b)
print(S)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [A[i] - 1 - i for i in range(N)]
B.sort()
if N % 2 == 0:
    med = [B[int(N / 2) - 1], int((B[int(N / 2) - 1] + B[int(N / 2)]) / 2), B[int(N / 2)]]
else:
    med = [B[int((N + 1) / 2) - 1]]
ans = 10 ** 100
for b in med:
    S = 0
    for i in range(N):
        S += abs(B[i] - b)
    ans = min(ans, S)
print(ans)
N,M=int(input())
if N==M:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N,M=map(int,input().split())
if N==M:
    print("Yes")
else:
    print("No")
def cost( i,k,j ):
  return m[i][k] + m[k+1][j] + p[i][0] * p[k][1] * p[j][1]
 
n = input()
M = []
m = [ [ 0 for i in range(n) ] for j in range(n) ]
for i in range(n):
  M.append( map ( int , raw_input().split() ) )

M_long = len(M)
for l in range( 2,n+1 ):
  for i in range( 0,n-l+1 ):
    j = i + l - 1
    m[i][j] = min( cost( i,k,j ) for k in range( i,j ) )
 
print m[0][M_long-1]

### FIXED CODE ###

def cost( i,k,j ):
  return m[i][k] + m[k+1][j] + M[i][0] * M[k][1] * M[j][1]
 
n = input()
M = []
m = [[ 0 for i in range(n) ] for j in range(n) ]
for i in range(n):
  M.append( map (int, raw_input().split() ) )
 
M_long = len(M)
for l in range( 2,M_long+1 ):
  for i in range( 0,M_long-l+1 ):
    j = i+l-1
    m[i][j] = min( cost( i,k,j ) for k in range( i,j ) )
 
print m[0][M_long-1]
in_rating = 0
N = int(input())
R = int(input())

if N >= 10:
  in_rating = R
  print(in_rating)
else:
  in_rating = R + 100(10-N)
  print(in_rating)

### FIXED CODE ###

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

if n >= 10:
  print(r)
else:
	in_rate = r + 100 * (10-n)
	print(in_rate)
n = int(input())
a = list(map(int,input().split()))
a.sort()
b = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 
     131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 
     67108864, 134217728, 268435456, 536870912]

t = []
bIdx = 0
for aa in a :
    while b[bIdx] <= aa:
        bIdx += 1   
    t.append(b[bIdx]-aa)
t.reverse()
a.sort(reverse=True)

c = {}
for aa in a:
    if aa in c:
        c[aa] += 1
    else:
        c[aa] = 1

#print(t)
#print(a)        
#print(c)

sum = 0
i = 0

for i in range(len(a)-1):

    if t[i] in c :
        #print("\t",a[i],t[i])
        if c[t[i]] > 0 :
            if c[t[i]] == 1 and a[i] == t[i]:
                pass
            else:
                #print("\t",a[i],t[i])                
                sum += 1
                c[t[i]] -= 1
print(sum)

### FIXED CODE ###

from bisect  import bisect_left

n = int(input())
a = list(map(int,input().split()))
a.sort()
#print(a)

sum = 0
for i in range (len(a)-1,-1,-1):

    b = 1
    while b <= a[i]:
        b = b<<1
    t = b - a[i]
    #print("2^",t)

    k = bisect_left(a,t)
    if a[k] == t and k < i:
        sum += 1
        a[k] -= 0.1
        a[i] += 0.1
print(sum)
n = int(input())
a = []
for _ in range(n):
    A = int(input())
    a.append(A)
    
s = sorted(a)
for i in range(n):
    if max(a) == a[i]:
        print(ans[-2])
    else:
        print(max(a))

### FIXED CODE ###

n = int(input())
a = []
for _ in range(n):
    A = int(input())
    a.append(A)
    
s = sorted(a)
for i in range(n):
    if a[i] == s[-1]:
        print(s[-2])
    else:
        print(s[-1])
a,b,c = map(int,input().split())

if a < b :
 if b < c:
  print(a,b,c)
 else:
  print(a,c,b)    
else:
 if a < c:
  print(b,a,c)
else:
  print(b,c,a)



### FIXED CODE ###

d = list(map(int,input().split()))
d.sort()
print(d[0],d[1],d[2])
s = raw_input("Please enter your numbers: ")
p= int(s[0]) 
q= int(s[1])
r= int(s[2])
s= int(s[3])
def area(a,b,c, d):
    if a*b > c*d:
        print a*b
    elif c*d > a*b:
        print c*d
    else:
        print a*b
x = area(p,q,r,s)

### FIXED CODE ###

numbers = list(map(lambda x: int(x), input().split(" ")))

sq1 = numbers[0] * numbers[1]
sq2 = numbers[2] * numbers[3]

if sq1 > sq2:
    print(sq1)
else:
    print(sq2)
input();a=list(map(int,input().split()));print("YNEOS"[len(A)>len(set(A))::2])

### FIXED CODE ###

input();A=list(map(int,input().split()));print("YNEOS"[len(A)>len(set(A))::2])
import sys
import itertools
import numpy as np

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

N, M, Q = map(int, readline().split())

# 1～Mまでの数を複数回用いて、長さNの要素の部分列返す
#（combinations：複数使用なし、combinations_with_replacement：複数使用あり）
A = np.array(list(itertools.combinations_with_replacement(range(1, M + 1), N)))

n = len(A) # 組合せ総数
score = np.zeros(n) [0,0,...,0] # 0が n個のaraay

m = map(int, read().split())
for a, b, c, d in zip(m, m, m, m):
    cond = A[:, b - 1] - A[:, a - 1] == c
    score += d * cond

print(score.max())

### FIXED CODE ###

import sys
import itertools
import numpy as np

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

N, M, Q = map(int, readline().split())

# 1～Mまでの数を複数回用いて、長さNの要素の部分列返す
#（combinations：複数使用なし、combinations_with_replacement：複数使用あり）
A = np.array(list(itertools.combinations_with_replacement(range(1, M + 1), N)))

n = len(A) # 組合せ総数
score = np.zeros(n, np.int32) # [0,0,...,0] :0が n個のaraay

m = map(int, read().split())
for a, b, c, d in zip(m, m, m, m):
    cond = A[:, b - 1] - A[:, a - 1] == c
    score += d * cond

print(score.max())
A,B = (int(_) for _ in input().split())

if a>=b:
    print(a-1)
else:
    print(b)


### FIXED CODE ###

a,b = (int(_) for _ in input().split())

if a>b:
    print(a-1)
else:
    print(a)
import math
A = int(input())
B = int(input())
C = int(input())

if B >= A * C:
    print(C)
else :
    print(math.floor(B/A))
if A > B:
    print(0)

### FIXED CODE ###

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

if a > b:
    print("0")
else :
    if b >= a * c:
        print(c)
    else :
        print(math.floor(b/a))
n=int(input())
List=list(map(int, input().split()))
cnt=[0]*(n-1)
for i in range(n-1):
  if List[i]>=List[i+1]:
    if i==0:
      cnt[i]=1
    else:
      cnt[i]=cnt[i-1]+1
print(max(cnt))

### FIXED CODE ###

n=int(input())
List=list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(n-1):
  if List[i]>=List[i+1]:
    if i==0:
      cnt=1
    else:
      cnt+=1
      ans = max(ans, cnt)
  else:
    cnt=0
print(ans)
while true:
  H, W = map(int, raw_input().split())
  for i in range(H):
    width = ""
    for j in range(W):
      width += "#"
    print width
  print ""

### FIXED CODE ###

while True:
  H, W = map(int, raw_input().split())
  if H == 0 and W == 0:
    break
  for i in range(H):
    width = ""
    for j in range(W):
      width += "#"
    print width
  print ""
# D
N = int(input())
s = list(map(int, list(input())))

res = 0
i = 0



L = 0
for i in range(N):
    if s[i] == 1:
        L = i
        break
for i in range(N):
    if s[i] == 1:
        M = i        

        
def calc_add(temp_list):
    if len(temp_list) <= 1:
        return 0
    else:
        res = 0
        # use 101 for left
        dp_l = [0]*len(temp_list)
        # use 101 for right 
        dp_r = [0]*len(temp_list)
        # do not use 101
        dp_c = [0]*len(temp_list)
        for i in range(len(temp_list) - 1):
            if temp_list[i] > 1:
                dp_l[i+1] = max(dp_l[i] + temp_list[i] - 1, dp_c[i] + temp_list[i])
            else:
                dp_l[i+1] = dp_c[i] + temp_list[i]
            if temp_list[i+1] > 1:
                dp_r[i+1] = max(dp_l[i] + temp_list[i+1], dp_c[i] + temp_list[i+1], dp_r[i] + temp_list[i+1] - 1)
            else:
                dp_r[i+1] = dp_c[i] + temp_list[i+1]
            dp_c[i+1] = max(dp_l[i], dp_r[i], dp_c[i])
        
        return max(dp_l[-1], dp_r[-1], dp_c[-1])
    

cont0 = 1
cont00 = 1
temp_list = []

for i in range(L, M+1):
    if s[i] == 1:
        if cont0 == 1:
            temp_list.append(1)
            cont0 = 0
            cont00 = 0
        else:
            temp_list[-1] += 1
    else:
        if cont00 == 1:
            pass
        elif cont0 == 1:
            cont00 = 1
            res += calc_add(temp_list)
            temp_list = []
        else:
            cont0 = 1
            
    if i == M:
        res += calc_add(temp_list)
        temp_list = []
        
print(res)

### FIXED CODE ###

# D
N = int(input())
s = list(map(int, list(input())))

        
def calc_add(temp_list):
    if len(temp_list) <= 1:
        return 0
    else:
        res = 0
        # use 101 for left
        dp_l = [0]*len(temp_list)
        # use 101 for right 
        dp_r = [0]*len(temp_list)
        # do not use 101
        dp_c = [0]*len(temp_list)
        for i in range(len(temp_list) - 1):
            if temp_list[i] > 1:
                dp_l[i+1] = max(dp_l[i] + temp_list[i] - 1, dp_c[i] + temp_list[i])
            else:
                dp_l[i+1] = dp_c[i] + temp_list[i]
            if temp_list[i] > 1:
                dp_r[i+1] = max(dp_l[i] + temp_list[i+1], dp_c[i] + temp_list[i+1], dp_r[i] + temp_list[i+1] - 1)
            else:
                dp_r[i+1] = dp_c[i] + temp_list[i+1]
            dp_c[i+1] = max(dp_l[i], dp_r[i], dp_c[i])
        
        return max(dp_l[-1], dp_r[-1], dp_c[-1])
    

cont0 = 1
cont00 = 1
temp_list = []
res = 0

for i in range(N):
    if s[i] == 1:
        if cont0 == 1:
            temp_list.append(1)
            cont0 = 0
            cont00 = 0
        else:
            temp_list[-1] += 1
    else:
        if cont00 == 1:
            pass
        elif cont0 == 1:
            cont00 = 1
            res += calc_add(temp_list)
            temp_list = []
        else:
            cont0 = 1
            
    if i == N - 1:
        res += calc_add(temp_list)
        
print(res)
N = int(input()
print(int(((N-1)*N)/2))


### FIXED CODE ###

N = int(input())

print(round(((N-1)*N)//2))
A,B,T = map(int, input()split())
X = (T+0.5)/A
print(B*X)

### FIXED CODE ###

A,B,T = map(int, input().split())
X = T//A
print(B*X)
l=list(map(int(input().split()))
n=1
ml=[]
for i in l:
 if i not in ml:
  ml.append(i)
print(len(ml))


### FIXED CODE ###

l=map(int,input().split())
ls=[]
for i in l:
     ls.append(i)
k=set(ls)
n=len(k)
print(n)
H,W=map(int,input().split())
if H%3==0 or W%3==0:
    print(0)

elif H%2==0 or W%2==0:
    if W%2==0:
        H,W=W,H
    A1=(H//2 )* W
    A3=0
    value=A1-A3
    for i in range(1,W//2 +):
        A3+=H
        A1-=H//2
        value=min(int(abs(A1-A3)),value)
    print(value)
else:
    A1=(H//2 +1)* W
    A2=(H//2)* W
    A3=0
    value=max(A1,A2,A3)-min(A1,A2,A3)
    for i in range(1,W//2):
        A3+=H
        A1-=H//2 + 1
        A2-=H//2
        value=min(max(A1,A2,A3)-min(A1,A2,A3),value)

    H,W=H,W
    A1=(H//2 +1)* W
    A2=(H//2) * W
    A3=0
    value=min(max(A1,A2,A3)-min(A1,A2,A3),value)
    for i in range(1,W//2):
        A3+=H
        A1-=H//2 + 1
        A2-=H//2
        value=min(max(A1,A2,A3)-min(A1,A2,A3),value)
    print(value)


### FIXED CODE ###

H,W=map(int,input().split())
if H%3==0 or W%3==0:
    print(0)

else:
    for m in range(2):
        H,W=W,H
        if H%2==0:
            A1=(H//2)* W
        else:
            A1=(H//2 +1)* W
        A2=(H//2)* W
        A3=0
        if m == 0:
            value=max(A1,A2,A3)-min(A1,A2,A3)
        else:
            value=min(max(A1,A2,A3)-min(A1,A2,A3),value)
        for i in range(W):
            A3+=H
            if H%2==0:
                A1-=H//2
            else:
                A1-=H//2 + 1
            A2-=H//2
            value=min(max(A1,A2,A3)-min(A1,A2,A3),value)
    value=min(value,H,W)



    print(value)
n=int(input())
if n=1:
  print("Hello World")
else:
  A=int(input())
  B=int(input())
  print(A+B)

### FIXED CODE ###

n=int(input())
if n==1:
  print("Hello World")
else:
  A=int(input())
  B=int(input())
  print(A+B)
def when_sunday(day):
    week_d = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
    if day == "SUN":
        return 7
    return 6 - week_d.index(day)
  

print(when_sunday(input())

### FIXED CODE ###

def when_sunday(day):
    week_d = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
    if day == "SUN":
        return 7
    return 6 - week_d.index(day)
  
print(when_sunday(input()))
a,b,c,d = [int(x) for x in input().split()]

nums = [a*c,a*d,b*c,b*d]
print(max(nums))

### FIXED CODE ###

x = int(input())
if x == 1:
    print("0")
elif x == 0:
    print("1")
import collections
h, w, si, sj, ti, tj, *s = open(0).read().split()
INF = 10**9
dist = [[INF] * w for _ in range(h)]
q = collections.deque([[si, sj]])
dist[si][sj] = 0
while q:
    i, j = q.popleft()
    d = dist[i][j]
    for di, dj in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        ni, nj = i + di, j + dj
        if not (0 <= ni < h and 0 <= nj < j):
            continue
        if s[ni][nj] == '#':
            continue
        dist[ni][nj] = d
        q.appendleft([ni, nj])
    for ei in range(-2, 3):
        for ej in range(-2, 3):
            ni, nj = i + di, j + dj
            if not (0 <= ni < h and 0 <= nj < j):
                continue
            if s[ni][nj] == '#':
                continue
            if dist[ni][nj] < d + 1:
                continue
            dist[ni][nj] = d + 1
            q.append([ni, nj])
ans = dist[ti][tj]
if ans == INF or ans == 0:
    ans = -1
print(ans)


### FIXED CODE ###

import collections, itertools
H, W, ch, cw, dh, dw, *S = open(0).read().split()
H, W, ch, cw, dh, dw = [int(_) + 1 for _ in [H, W, ch, cw, dh, dw]]
H += 3
W += 3
S = ['#' * W] + ['#' * W] + ['##' + s + '##'
                             for s in S] + ['#' * W] + ['#' * W]
Dist = [[None] * W for _ in range(H)]
Q = collections.deque([(0, ch, cw)])
while Q:
    d, ox, oy = Q.popleft()
    if Dist[ox][oy] is not None:
        continue
    stack = [[ox, oy]]
    warp = set()
    while stack:
        x, y = stack.pop()
        if (x, y) == (dh, dw):
            print(d)
            exit()
        Dist[x][y] = d
        for dx, dy in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
            nx, ny = x + dx, y + dy
            if Dist[nx][ny] is None:
                if S[nx][ny] == '.':
                    stack += [[nx, ny]]
                else:
                    warp.add((x, y))
    for x, y in warp:
        for dx, dy in itertools.product(range(-2, 3), repeat=2):
            nx, ny = x + dx, y + dy
            if Dist[nx][ny] is None and S[nx][ny] == '.':
                Q += [(d + 1, nx, ny)]
print(-1)
N, S = map(int, input().split())
x = [int(x) for x in input().split()]
x = [0, *x]
 
# 状態リストを作成
m = [[[0 for _ in range(3)] for _ in range(S+1)] for _ in range(N+1)]
m[0][0][0] = 1
 
for i in range(1,N+1):
    
    for k in range(S+1):

        # x を含めない
        m[i][k][0] += m[i-1][k][0] # まだ開始しない
        m[i][k][1] += m[i-1][k][0] + m[i-1][k][1]  # 今回から開始して加えない、もしくは既に開始しているが、加えない
        m[i][k][2] += m[i-1][k][0] + m[i-1][k][1] + m[i-1][k][2]  # 今回、開始・終了して加えない、今回開始して加えず終了。

        # x を含める場合
        if k - x[i] >= 0:
            m[i][k][1] += m[i-1][k - x[i]][0] + m[i-1][k - x[i]][1]
            m[i][k][2] += m[i-1][k - x[i]][0] + m[i-1][k - x[i]][1]
        
        m[i][k][0] = m[i][k][0] % 998244353
        m[i][k][1] = m[i][k][1] % 998244353
        m[i][k][2] = m[i][k][2] % 998244353
            
print(m[N][S][2])

### FIXED CODE ###

import numpy as np

N, S = map(int, input().split())
x = [int(x) for x in input().split()]
 
# 状態リストを作成
m = np.zeros((S+1,3))
p = np.zeros((S+1,3))
p[0,0] = 1

# 前状態から次状態の場合数を計算
for i in range(1,N+1):
    
    # x[i] を加えない場合
    m[:,0] = p[:,0]
    m[:,1] = p[:,0] + p[:,1]  # 今回から開始して加えない、もしくは既に開始しているが、加えない
    m[:,2] = p[:,0] + p[:,1] + p[:,2]  # 今回、開始・終了して加えない、今回開始して加えず終了。

    # x[i] を加える場合
    m[x[i-1]:,1] += p[:-x[i-1],0] + p[:-x[i-1],1]
    m[x[i-1]:,2] += p[:-x[i-1],0] + p[:-x[i-1],1]

    p[:,0] = m[:,0] % 998244353
    p[:,1] = m[:,1] % 998244353
    p[:,2] = m[:,2] % 998244353
            
print(int(p[S,2]))
S = raw_input()
res = (S[0] == S[1] == S[2])
if res:
  print "No"
 else:
  print "Yes"

### FIXED CODE ###

S = str(raw_input())
res = (S[0] == S[1] == S[2])
if res:
  print "No"
else:
  print "Yes"
N = int(input())
W = list(map(int, input().split()))
dif = [sum(W[:T + 1] - W[T + 1:]) for T in range(N - 1)]
print(min(dif))

### FIXED CODE ###

N = int(input())
W = list(map(int, input().split()))
dif = [abs(sum(W[:T + 1]) - sum(W[T + 1:])) for T in range(N - 1)]
print(min(dif))
#coding:utf-8
while 1:
    try:
        #初期化
        key=[0]*101
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2=1,key[3:]))==0):
            print "OK"
        else:
            print "NG"
    except:
        break

### FIXED CODE ###

#coding:utf-8
while 1:
    try:
        #初期化
        key=[0]*101
        #オイラー路：すべての頂点のうち、次数が奇数であるものがちょうど２つ(入口と出口)
        while 1:
            input = map(int, raw_input().split())
            if(input[0] == 0 and input[1] == 0):
                break
            key[input[0]]+=1
            key[input[1]]+=1

        if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2==1,key[3:]))==0):
            print "OK"
        else:
            print "NG"
    except:
        break
n, p = map(int,input().split())
D = input()
count = [0] * p
out = 0

if 10 % p == 0:
    for i, d in enumerate(D):
        if int(d) % p == 0:
            out += i + 1
else:
    ten = 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * ten) % p
        count[mod] += 1
        ten *= 10
    for c in count:
        out += (c * (c - 1)) // 2
print(int(out) + count[0])

### FIXED CODE ###

n, p = map(int,input().split())
D = input()
out = 0


if 10 % p == 0:
    for i in range(n):
        if int(D[i]) % p == 0:
            out += i + 1
else:
    mod = 0
    count = [0] * p
    ten = 1
    count[mod] += 1
    for i in range(n):
        mod = (mod + int(D[n-i-1]) * ten) % p
        ten = ten * 10 % p
        count[mod] += 1
    for c in count:
        out += (c * (c - 1)) // 2
print(out)
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

s = [0]*4
N = i()
S = l()
for i in range(N):
    if S[i] == 'P':
        s[0] = 1
    if S[i] == 'W':
        s[1] = 1
    if S[i] == 'G':
        s[2] = 1
    if S[i] == 'Y':
        s[3] = 1
print(sum(s))

### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

s = [0]*4
N = i()
S = L()
for i in range(N):
    if S[i] == 'P':
        s[0] = 1
    if S[i] == 'W':
        s[1] = 1
    if S[i] == 'G':
        s[2] = 1
    if S[i] == 'Y':
        s[3] = 1
if sum(s) == 3:
    print('Three')
else:
    print('Four')
# coding: utf-8

weather = input()
if weather == "Sunny":
    print("Cloudy")
elif wether == "Cloudy":
    print("Rainy")
elif wether == "Rainy":
    print("Sunny")


### FIXED CODE ###

# coding: utf-8

weather = input()
if weather == "Sunny":
    print("Cloudy")
elif weather == "Cloudy":
    print("Rainy")
elif weather == "Rainy":
    print("Sunny")
def func():
    input_num = int(input(''))
    a_i = [int(input('')) for i in range(input_num) ]
    frag, count = True, [0]*input_num
    count = [1 for i in range(input_num) if a_i[0] == a_i[i]]
    frag = False if sum(count) >= 2 else True
    value = [[a_i[i] if a_i[i] != a_i[j] else 0 for i in range(input_num )] for j in range(input_num)] if frag == True else [[a_i[i]for i in range(input_num )] for j in range(input_num)]
    for i in range(input_num):
        print(max(value[i]))
if __name__ == '__main__':
    func()
    


### FIXED CODE ###

def func():
    input_num = int(input(''))
    return 3*input_num**2


if __name__ == "__main__":
    print(func())
N, K, Q = map(int, input().split()) 

def change_score(N ,A, score):
    score = score - np.array([1]*N)
    score[A-1] = score[A-1] + 1
    return score

score = np.array([K]*N)
for i in range(Q):
    A = int(input())
    score = change_score(N, A, score)
    #print(score)
    f_score = score

for i in f_score:
    if i > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

import numpy as np

N, K, Q = map(int, input().split()) 
score = np.array([0]*N)

def change_score(N ,A, score):
    #score = score - np.array([1]*N)
    score[A-1] = score[A-1] + 1
    return score

for i in range(Q):
    A = int(input())
    score = change_score(N, A, score)
    #print(score)
    f_score = score

for i in f_score:
    if i + K - Q > 0:
        print("Yes")
    else:
        print("No")
import sys
import math
input = sys.stdin.readline

n = int(input())
root = int(math.sqrt(n))
for i in reversed(range(root)):
    if(n%i == 0):
        j=int(n/i)
        print(i+j-2)
        break

### FIXED CODE ###

import math

n=int(input())

root = int(math.sqrt(n))
for i in reversed(range(root+1)):
    if(n%i == 0):
        j=int(n/i)
        print(i+j-2)
        break
x,y,a,b,c = list(map(int, input().split(' ')))
p = sorted(list(map(int, input().split(' '))))[-x:]
q = sorted(list(map(int, input().split(' '))))[-y:]
r = sorted(list(map(int, input().split(' '))))[-x-y:]

pidx = 0
qidx = 0
for i in range(c):
  ptmp = p[pidx]
  qtmp = q[pidx]
  rtmp = r[c - 1 - i] # 逆順
  if ptmp < qtmp:
    if ptmp < rtmp:
      p[pidx] = rtmp
      pidx += 1
  else:
    if qtmp < rtmp:
      q[qidx] = rtmp
      qidx += 1
print (sum(p) + sum(q))

### FIXED CODE ###

x,y,a,b,c = list(map(int, input().split(' ')))
p = sorted(list(map(int, input().split(' '))))[-x:]
q = sorted(list(map(int, input().split(' '))))[-y:]
r = sorted(list(map(int, input().split(' '))))[-x-y:]

z = sorted(p+q+r)[-x-y:]

print (sum(z))
N,M=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A,reverse=True)

Pair=[0 for i in range(N)]
for i in range(N-1):
    Pair[i]=A[i]+A[i+1]

print(A)

ans=0
cnt=0
mode=0
Next=[]
i=0
while i<M:
    if mode==0:
        ans+=2*A[cnt]
        mode=1
        Next.append([cnt,cnt+1])
        cnt+=1
        i+=1
    else:
        Max=0
        for j in Next:
            if Max<=A[j[0]]+A[j[1]]:
                Max=A[j[0]]+A[j[1]]
                p_cnt=j
        ans+=A[p_cnt[0]]+A[p_cnt[1]]
        i+=1
        
        if i<=M-1:
            ans+=A[p_cnt[0]]+A[p_cnt[1]]
            i+=1
        Next.remove(p_cnt)
        if p_cnt[1]+1<N:
            p_cnt[1]+=1
            Next.append(p_cnt)
            
        Max=max(Max,A[p_cnt[0]]+A[p_cnt[1]])
        if Max<=A[cnt]*2:
            mode=0
        
print(ans)

### FIXED CODE ###

#E
from bisect import bisect_left
from itertools import accumulate

N,M=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A)
A_r=list(reversed(A))
B=[0]+list(accumulate(A_r))

def f(x):
    count=0
    for i in A:
        idx=bisect_left(A,x-i)
        count+=N-idx
    if count>=M:
        return True
    else:
        return False
    
MIN=0
MAX=2*10**5+1
while MAX-MIN>1:
    MID=(MIN+MAX)//2
    if f(MID):
        MIN=MID
    else:
        MAX=MID

ans=0
count=0
for i in A_r:
    idx=bisect_left(A,MIN-i)
    ans+=i*(N-idx)+B[N-idx]
    count+=N-idx
print(ans-(count-M)*MIN)
N = int(input())
A = [int(i) for i in input()]
sum = 1

for i in range(N):
  sum = sum * A[i]

if sum > 10 ** 18:
  sum = -1

print(sum)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
A.sort()
num = A[0]
for a in A[1:]:
  num *= a
  if num > 10 ** 18:
    print(-1)
    exit()
print(num)