Harryxun/stf_run huggingface dataset:
n, k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10 ** 9 + 7

p = []
m = []
for i in a:
    if i > 0:p.append(i)
    elif i < 0:p.append(i)

p.sort(reverse=True)
m.sort()
double = []

for i in range(len(p) - 1):
    if i % 2 == 0:
        temp = p[i] * p[i + 1]
        double.append([temp, 1])
for i in range(len(m) - 1):
    if i % 2 == 0:
        temp = m[i] * m[i + 1]
        double.append([temp, 2])

double.sort(reverse=True)
res = 1
flag = 0
while k:
    if double and k - 2 >= 0:
        temp, ind = double.pop(0)
        if ind == 1:
            p.pop(0)
            p.pop(0)
        else:
            m.pop(0)
            m.pop(0)
        res = (res * temp) % mod
        k -= 2
    else:
        if p:
            res = (res * p.pop(0)) % mod
        else:
            res = (res * m.pop(0)) % mod
        k -= 1
        
print(res)

### FIXED CODE ###

from collections import deque
n, k = map(int,input().split())
a = list(map(int,input().split()))
mod = 10 ** 9 + 7

p = []
m = []
for i in a:
    if i >= 0:p.append(i)
    elif i < 0:m.append(i)

p.sort(reverse=True)
m.sort()
res = 1
if n == k:
    for i in a:
        res = (res * i) %mod
    print(res)
    exit()
    
if len(p) == 0 and k % 2 == 1:
    for i in range(k):
        res = (res * m[-(i + 1)]) %mod
    print(res)

else:
    p_ind = 0
    m_ind = 0
    while k:
        if k == 1:
            res = (res * p[p_ind]) % mod
            break
        
        temp = p[p_ind] * p[p_ind + 1] if p_ind + 1 < len(p) else 0
        temp1 = m[m_ind] * m[m_ind + 1] if m_ind + 1 < len(m) else 0
        if temp > temp1:
            res = (res * p[p_ind]) %mod
            p_ind += 1
            k -= 1
        else:
            res = (res * temp1) %mod
            m_ind += 2
            k -= 2
    print(res)
X = int(input())
Y = int(input())

x = X + Y/2
print(x)

### FIXED CODE ###

X,Y = map(int,input().split())
print(X+Y//2)
s = input().split()
a = float(s[0])
b = float(s[1])
if a/2 != int(a/2) and b/2 != int(b/2):
  print(Odd)
else:
  print(Even)

### FIXED CODE ###

s = input().split()
a = int(s[0])
b = int(s[1])
if (a*b)%2 == 0:
  print('Even')
else:
  print('Odd')
n=int(input())
cards = [(mark,num) for mark in ['S','H','C','D'] for num in range(1,14) ]
for _ in range(n):
    mark,num=input().split()
    cards.remove((mark,int(num)))
for (mark, num) in cards:
    print(mak, num)


### FIXED CODE ###

n=int(input())
cards = [(mark,num) for mark in ['S','H','C','D'] for num in range(1,14) ]
for _ in range(n):
    mark,num=input().split()
    cards.remove((mark,int(num)))
for (mark, num) in cards:
    print(mark, num)
N, K, Q =　map(int, input().rstrip().split(" "))

pointlist = [K for i in range(N)]

for i in range(Q):
  Aperson = int(input())
  for j in range(N):
    if j+1 != Aperson:
      pointlist[j] -= 1

for i in range(N):
  if pointlist[i] <= 0:
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

N,K,Q = map(int,input().split())
judgepoint = Q - K

anslist = [0 for i in range(N)]
 
for i in range(Q):
  Aperson = int(input())
  anslist[Aperson -1] += 1

for i in range(N):
  if anslist[i] <= judgepoint:
    print("No")
  else:
    print("Yes")
N=int(input())
a=[0]*N
for i in range(N):
    a.[i]=int(input())
minimum=1
count=0
for i in  a:
   if(minimum<i):
       if i%minimum:
           count+= i//minimum
       else :
           count+= (i//minimum-1)
   else:
       minimum=max(minimum,i+1)
print(count)


### FIXED CODE ###

N=int(input())
a=[0]*N
for i in range(N):
    a[i]=int(input())

minimum=2
count=a[0]-1
a.pop(0)
for i in  a:
   if(minimum<i):
       if i%minimum:
           count+= i//minimum
       else :
           count+= (i//minimum-1)
   else:
       minimum=max(minimum,i+1)
print(count)
a, b = list(map(int, input().split()))
number = 1
while a <= b:
    a += a - 1
    number += 1
print(number)

### FIXED CODE ###

forecasts     = input()
real_weathers = input()

correct_number = 0
for date in range(len(forecasts)):
    if forecasts[date] == real_weathers[date]:
        correct_number += 1
print(correct_number)
def dfs(friends, friend, cluster, visited, belongs, index):
    for i in friends[friend]:
        if not visited[i]:
            visited[i] = True
            cluster.add(i)
            belongs[i] = index
            dfs(friends, i, cluster, visited, belongs, index)

def make_clusters(friends, N):
    clusters = []
    visited = [False] * N
    belongs = [0] * N
    index = 0
    for i in range(N):
        if not visited[i]:
            cluster = set()
            visited[i] = True
            belongs[i] = index
            cluster.add(i)
            dfs(friends, i, cluster, visited, belongs, index)
            index += 1
            clusters.append(cluster)
    return (clusters, belongs)
    
    
N, M, K = map(int, input().split())

friends = [[] for _ in range(N)]
blocks = [set() for _ in range(N)]
clusters = []

for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    friends[A].append(B)
    friends[B].append(A)

for _ in range(K):
    C, D = map(int, input().split())
    C -= 1
    D -= 1
    blocks[C].add(D)
    blocks[D].add(C)

clusters, belongs = make_clusters(friends, N)

clusters_len = len(clusters)
cluster_len = [0] * clusters_len
for i in range(clusters_len):
    cluster_len[i] = len(clusters[i])

for i in range(N):
    ans = cluster_len[belongs[i]] - len(friends[i]) - len(clusters[belongs[i]] & blocks[i]) - 1
    print(ans, end=' ')

print()

### FIXED CODE ###

import sys
sys.setrecursionlimit(50000)

def dfs(friends, friend, cluster, visited, belongs, index):
    for i in friends[friend]:
        if not visited[i]:
            visited[i] = True
            cluster.add(i)
            belongs[i] = index
            dfs(friends, i, cluster, visited, belongs, index)

def make_clusters(friends, N):
    clusters = []
    visited = [False] * N
    belongs = [0] * N
    index = 0
    for i in range(N):
        if not visited[i]:
            cluster = set()
            visited[i] = True
            belongs[i] = index
            cluster.add(i)
            dfs(friends, i, cluster, visited, belongs, index)
            index += 1
            clusters.append(cluster)
    return (clusters, belongs)
    
    
N, M, K = map(int, input().split())

friends = [[] for _ in range(N)]
blocks = [set() for _ in range(N)]
clusters = []

for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    friends[A].append(B)
    friends[B].append(A)

for _ in range(K):
    C, D = map(int, input().split())
    C -= 1
    D -= 1
    blocks[C].add(D)
    blocks[D].add(C)

clusters, belongs = make_clusters(friends, N)

clusters_len = len(clusters)
cluster_len = [0] * clusters_len
for i in range(clusters_len):
    cluster_len[i] = len(clusters[i])

for i in range(N):
    ans = cluster_len[belongs[i]] - len(friends[i]) - len(clusters[belongs[i]] & blocks[i]) - 1
    print(ans, end=' ')

print()
ad=[[],[]]
count=0
s=input()
q=int(input())
for i in range(q):
    t=input().split()
    if t[0]=='1':
        count+=1
        ad[1].reverse()
        ad[0].reverse()
        ad=[ad[1],ad[0]]
    elif t[1]=='1':
        ad[0].insert(0,t[2])
    else:
        ad[1].append(t[2])

if count%2==0:
    print(''.join(ad[0],s,ad[1]))
else:
    print(''.join(ad[0]),end='')
    for i in range(len(s)):
        print(s[-(i+1)],end='')
    print(''.join(ad[1]))

### FIXED CODE ###

s=[input()]
q=int(input())
turn=True
l=""
for i in range(q):
    qq=input().split()
    if qq[0]=='1':
        turn=not turn
    else:
        if turn==bool(int(qq[1])-2):
            l+=qq[2]
        else:
            s.append(qq[2])

text=l[::-1]+"".join(s)
print(text if turn else text[::-1])
def repeat_string(x, y):
    """Return the digit x repeated y times."""
    single_string = str(x)
    repeat_string = single_string*y
    return repeat_string


def compare_strings(a, b):
    if a>b: return(repeat_string(b, a))
    return(repeat_string(a, b))


if __name__ == "__main__":
    test1 = "4 3"
    test2 = "7 7"
    test = test2
    test_input = map(int, intput().split())
    print(compare_strings(*test_input))


### FIXED CODE ###

def repeat_string(x, y):
    """Return the digit x repeated y times."""
    single_string = str(x)
    repeat_string = single_string*y
    return repeat_string


def compare_strings(a, b):
    if a>b: return(repeat_string(b, a))
    return(repeat_string(a, b))


if __name__ == "__main__":
    test1 = "4 3"
    test2 = "7 7"
    test = test2
    test_input = map(int, input().split())
    print(compare_strings(*test_input))
import sys
for line in sys.stdin.readlines()
	a,b,c,d,e,f = [int(s) for s in line.split()]
	x = (c*e-b*f) / (a*e-b*d)
	y = (c*d-a*f) / (b*d-a*e)
	print('{0:.3f} {1:.3f}'.format(x,y))

### FIXED CODE ###

import sys
for line in sys.stdin.readlines():
#for line in data.split('\n'):
	a,b,c,d,e,f = [int(s) for s in line.split()]
	x = (c*e-b*f) / (a*e-b*d)
	y = (c*d-a*f) / (b*d-a*e)
	if round(x,3) == 0.0:
		x = 0.0
	if round(y,3) == 0.0:
		y = 0.0
	print('{0:.3f} {1:.3f}'.format(x,y))
# 全通りを計算する
# collectins.conbination 1-19，len = 19の配列用意
# その中から9個選ぶ
# それぞれの選ばれたものを仕切りと考え，左の仕切りから順に1~10まで数える．
# それらを配列とみなす．
# それで全探索し，最も得点が高いものの組み合わせが答え
# 19C9 は3万程度なのでOK

import itertools


def main():
    n, m, q = map(int, input().split())

    A, B, C, D = [], [], [], []
    for _ in range(q):
        a, b, c, d = map(int, input().split())
        A.append(a)
        B.append(b)
        C.append(c)
        D.append(d)
    ans = 0
    length = 19
    for item in itertools.combinations(range(length), m-1):
        ptn = []
        num = 1
        p = 0
        for i in range(length):
            if i == item[p]:
                num += 1
                p += 1
                p = min(m-2, p)
                continue
            ptn.append(num)
        tmp = 0
        for k in range(q):
            if (ptn[B[k]-1] - ptn[A[k]-1]) == C[k]:
                tmp += D[k]

        ans = max(tmp, ans)
    return ans

print(main())


### FIXED CODE ###

import itertools


def main():
    n, m, q = map(int, input().split())

    A, B, C, D = [], [], [], []
    for _ in range(q):
        a, b, c, d = map(int, input().split())
        A.append(a)
        B.append(b)
        C.append(c)
        D.append(d)
    if m == 1:
        return sum(D)
    ans = 0
    length = m+n-1
    for item in itertools.combinations(range(length), m-1):
        ptn = []
        num = 1
        p = 0
        for i in range(length):
            if i == item[p]:
                num += 1
                p += 1
                p = min(m-2, p)
                continue
            ptn.append(num)
        tmp = 0
        for k in range(q):
            if (ptn[B[k]-1] - ptn[A[k]-1]) == C[k]:
                tmp += D[k]

        ans = max(tmp, ans)
    return ans

print(main())
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,M,K = map(int,input().split())

def mCn(m,n):
    return math.factorial(m)//(math.factorial(n)*math.factorial(m-n)) % mod

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N1 = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N1 + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


ans = 0
for i in range(1,M):
    ans += (M-i)*N**2*i*(cmb(M*N-2,K-2,mod))
    if ans > mod:
        ans = ans % mod

for i in range(1,N):
    ans += (N-i)*M**2*i*(cmb(M*N-2,K-2,mod))
    if ans > mod:
        ans = ans % mod

print(ans)


### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,M,K = map(int,input().split())

def mCn(m,n):
    return math.factorial(m)//(math.factorial(n)*math.factorial(m-n)) % mod

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N1 = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N1 + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


ans = 0
for i in range(1,M):
    ans += (M-i)*N**2*i*(cmb(M*N-2,K-2,mod))
    if ans > mod:
        ans = ans % mod

for i in range(1,N):
    ans += (N-i)*M**2*i*(cmb(M*N-2,K-2,mod))
    if ans > mod:
        ans = ans % mod

print(ans)
if __name__ == "__main__":
    x = int(input())
    m, n = map(int, input().split())
    if m * 500 >= n:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

if __name__ == "__main__":
    m, n = map(int, input().split())
    if m * 500 >= n:
        print("Yes")
    else:
        print("No")
N = int(input())
total = 0.0
for i in range(N):
    money, tani = input().split()
    money = float(money)
    if tani = "JPY":
        total += money
    else:
        total += money * 380000.0
print("%.11f"%(total))

### FIXED CODE ###

year, month, day = map(int, input().split("/"))
if year <= 2019 and month <= 4 and day <= 30:
    print("Heisei")
else:
    print("TBD")
money = input()

oturi = 1000 - money % 1000

print(oturi)

### FIXED CODE ###

money = int(input())

rem = money % 1000

oturi = 0
if rem != 0:
  oturi = 1000 - rem

print(oturi)
def resolve():
    n,m = map(int,input().split())
    ac_list = [1]*n
    ac = 0
    wa = 0
    for _ in range(m):
        p,s = input().split()
        if s == 'WA' and ac_list[int(p)-1]==1:
            wa += 1
        elif s == 'AC' and ac_list[int(p)-1]==1:
            ac += 1
            ac_list[int(p)-1] = 0
    print(f'{ac} {wa}')
resolve():

### FIXED CODE ###

def resolve():
    n,m = map(int,input().split())
    ac_list = [0]*n
    wa_count = [0]*n
    ac = 0
    wa = 0
    for _ in range(m):
        p,s = input().split()
        if s == 'WA' and (ac_list[int(p)-1]==0):
            wa_count[int(p)-1] += 1
        elif s == 'AC' and (ac_list[int(p)-1]==0):
            ac += 1
            ac_list[int(p)-1] = 1
    for (i,j) in zip(wa_count,ac_list):
        if j: wa+=i
    print(f'{ac} {wa}')
resolve()
N=int(input());p=[[]for _ in range(N)]
for _ in range(N-1):u,v,w=map(int,input().split());p[u].append((v,w));p[v].append((u,w))
s=[(1,0)];l=[-1]*N
while s:
 a,w=s.pop()
 l[a-1]=w%2
 for b,c in p[a]:
  if l[b-1]==-1:s.append((b,w+c))
for i in l:print(i)

### FIXED CODE ###

def dfs(graph, start):
    stack = [(start, 0)]
    visited = set()
    li = [0] * N
    while stack:
        d = stack.pop()
        li[d[0] - 1] = d[1] % 2
        for node, w in graph[d[0]]:
            if node not in visited:
                visited.add(node)
                stack.append((node, d[1] + w))
    return li


N = int(input())
g = {i: []for i in range(1, N + 1)}
for i in range(N - 1):
    u, v, w = map(int, input().split())
    w %= 2
    g[u].append((v, w))
    g[v].append((u, w))
for c in dfs(g, 1):
    print(c)
def resolve():
    a, b = list(map(int, input().split()))
    l = list(range(a, b + 1))
    l.sort()
    minus = list(filter(lambda x: x < 0, l))
    minus = len(minus)

    if a <= 0 and b >= 0:
        print('Zero')
        return
    else:
        if minus % 2 == 1:
            print('Negative')
            return
        else:
            print('Positive')
            return
    return


resolve()

### FIXED CODE ###

def resolve():
    a, b = list(map(int, input().split()))

    if a <= 0 and b >= 0:
        print('Zero')
    elif b < 0 and (b - a + 1) % 2 == 1:
        print('Negative')
    else:
        print('Positive')
    return


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

if a*n>=b:
  print(a*n)
else:
  prinb(b)

### FIXED CODE ###

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

if a*n <= b:
  print(a*n)
else:
  print(b)
n,k,x,y=(int(input().split()) for i in range(4))
j = 0
if n > k:
   j = (n - k)  * y
print(k * x + j)

### FIXED CODE ###

n,k,x,y=(int(input()) for i in range(4))
if n - k > 0:
  ans = k * x + (n - k) * y
else:
  ans = n * x
print(ans)
from collections import defaultdict
N, M = map(int, input().split())
E = defaultdict(list)
for i in range(M):
    x, y = map(int, input().split())
    E[x].append(y)
dp = [-1] * N
def solve(n):
    global dp, E
    if dp[n-1] != -1:
        return dp[n-1]
    dp[n-1] = 0
    for nn in E[n]:
        dp[n-1] = max(dp[n-1], solve(nn)+1)
    return dp[n-1]
ans = 0
for i in range(N):
    ans = max(ans, solve(i+1))
print(ans)

### FIXED CODE ###

from collections import deque
from collections import defaultdict
N, M = map(int, input().split())
d = [0]*N
G = defaultdict(list)
for i in range(M):
    s, t = map(int, input().split())
    d[t-1] += 1
    G[s-1].append(t-1)
q = deque([])
for i in range(N):
    if d[i] == 0:
        q.append(i)
ans = []
while q:
    s = q.popleft()
    ans.append(s)
    for t in G[s]:
        d[t] -= 1
        if d[t] == 0:
            q.append(t)
dp = [0] * (N+1)
num = 0
for i in range(0,N):
    for n in G[ans[i]]:
        dp[n] = max(dp[n], dp[ans[i]]+1)
print(dp[ans[-1]])
x=int(input())
s=input()
if s==0:
  return 1
elif s==1:
  return 0

### FIXED CODE ###

x=int(input())

if x==0:
  print(1)
elif x==1:
  print(0)
import math

N = int(input())
ans = 0
for i in range(1, math.ceil(math.sqrt(N)) + 1):
    n = N // i - 1
    if N % n == N // n:
        ans += n
print(ans)


### FIXED CODE ###

import math

N = int(input())
ans = 0
for i in range(1, math.ceil(math.sqrt(N)) + 1):
    if N % i:
        continue
    n = N // i - 1
    if n and N % n == N // n:
        ans += n
print(ans)
a,b,c = map(int,input().split())
k = int(input())
ans = max(a,b,c)
for i in range(k):
  ans ×= 2
print(ans)


### FIXED CODE ###

a,b,c = map(int,input().split())
k = int(input())
ans = max(a,b,c)
for i in range(k):
  ans = ans + ans
print(ans+min(a,b,c)+a+b+c-max(a,b,c)-min(a,b,c))
n, x, y = map(int, input().split())
a = list(map(int, input().split()))

if n == 1:
    print(abs(a[-1] - y))
else:
    print(max(abs(a[-1] - y), abs(a[-1] - a[-2])))


### FIXED CODE ###

n, m = map(int, input().split())
print(2**m * (1800 * m + 100 * n))
s = list(input().split())
ans="No"
if s[0]==s[1] and s[2]==s[3] or s[0]==s[2] and s[1]==s[3] or s[0]==s[4] and s[1]==s[2]:
	ans="Yes"
print(ans)

### FIXED CODE ###

s = sorted(input())


if s[0]!=s[1] or s[2]!=s[3] or s[0]==s[3]:
	print("No")
else :
	print("Yes")
s = int(input())
n = len(s)
s1 = s[0:(n-1)//2]
s2 = s[(n +2)//2:n]
if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = str(input())
n = len(s)
s1 = s[0:n//2]
s2 = s[(n+2)//2:n]
if s == s[::-1] and s1 == s1[::-1] and s2 == s2[::-1]:
    print('Yes')
else:
    print('No')
S = str(input())
p = S.count('+') 
m = S.sount('-')
print(p-m)

### FIXED CODE ###

S = str(input())
p = S.count('+') 
m = S.count('-')
print(p-m)
a,b,c = input().split()

if a == b and a == c:
  print('No')
else:
  print('Yes)

### FIXED CODE ###

a = input()
 
if a[0] == a[1] and a[0] == a[2]:
  print('No')
else:
  print('Yes')
a,b,c,d=map(int,input().split())
if a+b>c+d:print("Left")
elif a+b==c+d:print("Balanced")
else print("Right")

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if a+b>c+d:print("Left")
elif a+b==c+d:print("Balanced")
else:print("Right")
n,m = map(int,input().split())
ac = [0]*n
wa = [0]*n
pena = 0

for i in range(m):
    p,s = map(str,input().split())
    p = int(p)-1 
    if s == "WA" and ac[p] == 0:
        wa[p] += 1
    elif s == "AC" and ac[p] == 0:
        ac[p] = 1
        pena += wa[p]   #waのみの問題はペナルティカウントされないため、acして初めてwaの回数を加算する
    elif ac[p] == 1:
        continue

print(str(sum(ac)) + " " + str(pena)

### FIXED CODE ###

n,m = map(int,input().split())
ac = [0]*n
wa = [0]*n
pena = 0

for i in range(m):
    p,s = map(str,input().split())
    p = int(p)-1 
    if s == "WA" and ac[p] == 0:
        wa[p] += 1
    elif s == "AC" and ac[p] == 0:
        ac[p] = 1
        pena += wa[p]   #waのみの問題はペナルティカウントされないため、acして初めてwaの回数を加算する
    elif ac[p] == 1:
        continue

print(str(sum(ac)) + " " + str(pena))
n=int(input())
s=input()
sorted(s)
print((s-s[n:])+s[n:])

### FIXED CODE ###

n=int(input())
s=input()
word=""
for i in range(len(s)):
    if ord(s[i])+n>90:
        word+=chr(ord(s[i])+n-26)
    else:
        word+=chr(ord(s[i])+n)
print(word)
def population(n):
    if n == 0:
        return 0
    if n % 2 == 0:
        return population(n // 2)
    return 1 + population(n // 2)

N = int(input())
X = [0] * N
Y = [0] * N
P = [0] * N
for i in range(N):
    X[i], Y[i], P[i] = map(int, input().split())

ans = [10**10] * (N + 1)
for i in range(1 << (2 * N)):
    K = population(i)
    if K > N:
        continue
    cost = 0
    for j in range(N):
        if i & (1 << j) or i & (1 << (j + N)):
            continue
        cost2 = min(abs(X[j]), abs(Y[j]))
        for l in range(2 * N):
            if (i & (1 << l)) == 0:
                #print('cont', i)
                continue
            if l < N:
                #print('x')
                cost2 = min(cost2, abs(X[l] - X[j]))
            else:
                #print('y')
                cost2 = min(cost2, abs(Y[l - N] - Y[j]))
        cost += cost2 * P[j]
    ans[K] = min(ans[K], cost)
    #print(K, cost)
for i in range(N + 1):
    print(ans[i])

### FIXED CODE ###

def rank(X):
    if X >= 1800:
        return 1
    if X >= 1600:
        return 2
    if X >= 1400:
        return 3
    if X >= 1200:
        return 4
    if X >= 1000:
        return 5
    if X >= 800:
        return 6
    if X >= 600:
        return 7
    if X >= 400:
        return 8


X = int(input())
ans = rank(X)
print(ans)
def isprime(z):
    if z < 2:return False
    if z == 2:return True
    i = 2
    while i*i <= z:
        if z % i == 0:
            return False
        i+=1
    return True
n = int(input())
for i in range(n):
    l, r = map(int, input().split())
    c = 0
    for j in range(l, r+1):
        if isprime(j) and isprime((j+1)/2):
            c+=1
    print(c)
            

### FIXED CODE ###

print(48-int(input()))
n,k = map(int, input().split())
print(input().replace(s[k-1], s[k-1].lower()))

### FIXED CODE ###

n, k = map(int, input().split())
s = input()
print(s[:k-1] + s[k-1].lower() + s[k:])
#C Colorful
import numpy as np
a = int(input())
x = list(map(int,input().split()))
x.sort()
x = x[::-1]
n =0
k = [0,0,0,0,0,0,0]
for i in x:
    if i > 3199:
        n +=1
    elif i < 400:
        k[0] = 1
    elif i < 800:
        k[1] = 1
    elif i < 1200:
        k[2] = 1
    elif i < 1600:
        k[3] = 1
    elif i < 2000:
        k[4] = 1
    elif i < 2400:
        k[5] = 1
    elif i < 2800:
        k[6] = 1
    elif i < 3200:
        k[7] = 1

c = np.array(k)
s = ss= c.sum()

if s < 8:
    ss += n
    if ss > 8:
        ss = 8
print (s)
print (ss)

### FIXED CODE ###

n=input()
l=list(map(int,input().split()))
c=[0]*8
ma=0
for i in l:
    if i<3200:c[i//400]=1
    else:ma+=1
mi=sum(c)
print(max(mi,1),mi+ma)
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

d = defaultdict(int)
n = readInt()
for i in readChars():
	d[i]+=1

d = [i for i in sorted(d.items(), reverse=True) if i[1]>1]

if len(d)==0:
	print(0)
	exit()
elif len(d)==1:
	if d[0][1]>=4:
		continue
	else:
		print(0)
		exit()

if d[0][1]>=4:
	print(int(d[0][0])**2)
else:
	print(int(d[0][0])*int(d[1][0]))


### FIXED CODE ###

from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()

d = Counter(readInts())

d = [i for i in sorted(d.items(), reverse=True) if i[1]>=2]

if len(d)==0:
	print(0)
	exit()
elif len(d)==1:
	if d[0][1]>=4:
		pass
	else:
		print(0)
		exit()
if d[0][1]>=4:
	print(int(d[0][0])**2)
else:
	print(int(d[0][0])*int(d[1][0]))