Harryxun/stf_run huggingface dataset:
import math

n = int(input())
d = list(map(int,input().split()))

ans = -1

d_count = [0] * (max(d)+1)
for i in range(n):
  d_count[d[i]] += 1

if d[0] != 0 or d_count[0] != 1:
  print(0)
  exit()

ans = 1
for i in range(1,len(d_count)-1):
  ans = ans *  math.pow(d_count[i], d_count[i+1])
  ans = ans % 998244353

ans = ans % 998244353

print(int(ans))


### FIXED CODE ###

import math

n = int(input())
d = list(map(int,input().split()))

ans = -1

d_count = [0] * (max(d)+1)
for i in range(n):
  d_count[d[i]] += 1

if d[0] != 0 or d_count[0] != 1:
  print(0)
  exit()

ans = 1
for i in range(1,len(d_count)-1):
  for j in range(d_count[i+1]):
    ans = ans * d_count[i]
    ans = ans % 998244353

ans = ans % 998244353

print(int(ans))
from sys import stdin
import sys
sys.setrecursionlimit(2000)
N,M,K=list(map(int,input().split()))
friend_list=[set() for _ in range(N+1)]
block_list=[set() for _ in range(N+1)]
def friend_tansaku(i,j):
    color.add(j)
    for friend in friend_list[j]:
        if friend not in color:
            # if friend not in block_list[i] and friend not in candidate and friend not in friend_list[i]:
            #     candidate.add(friend)
            #     count[0]+=1
            friend_tansaku(i,friend)




for _ in range(M):
   a,b= list(map(int, input().split()))
   friend_list[a].add(b)
   friend_list[b].add(a)
for _ in range(K):
    a, b = list(map(int, input().split()))
    block_list[a].add(b)
    block_list[b].add(a)
for i in range(1,N+1):
    count=[0]
    color =set()
    candidate=set()
    friend_tansaku(i,i)
    if i==N:print(count[0])
    else:print(count[0],end=" ")

### FIXED CODE ###

from sys import stdin
import sys
import copy
sys.setrecursionlimit(200000)
N,M,K=list(map(int,input().split()))
counter=[[None,None] for i in range(N+1)]
friend_list=[set() for _ in range(N+1)]
block_list=[set() for _ in range(N+1)]
def friend_tansaku(i,j):
    color.add(j)
    cnt[0]+=1
    for friend in friend_list[j]:
        if friend not in color :
            friend_tansaku(i,friend)





for _ in range(M):
   a,b= list(map(int, input().split()))
   friend_list[a].add(b)
   friend_list[b].add(a)
for _ in range(K):
    a, b = list(map(int, input().split()))
    block_list[a].add(b)
    block_list[b].add(a)
for i in range(1,N+1):
    cnt=[0]
    color =set()
    if counter[i][0] is None:
        friend_tansaku(i,i)
        cnt=cnt[0]
        for aa in color:
            counter[aa]=[color,cnt]
    color,cnt =counter[i][0],counter[i][1]
    for k in block_list[i]:
        if k not in color:
            cnt+=1

    count=cnt-(len(friend_list[i])+len(block_list[i]))-1
    if i==N:print(count)
    else:print(count,end=" ")
def blackjack(A1, A2, A3):
    if (A1+A2+A3) >= 22:
        return "bust"
    else:
        return "win"

A1 = int(input('Input A1:'))
A2 = int(input('Input A2:'))
A3 = int(input('Input A3:'))
print(blackjack(A1, A2, A3))

### FIXED CODE ###

a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")
s=input()
if(s-'2019/04/30' >0):
   print("TBD")
else:
   print("Heisei")

### FIXED CODE ###

s=input()
if(s>"2019/04/30"):
   print("TBD")
else:
   print("Heisei")
def main():
    H, W = map(int, input().split())
    A = []
    for _ in range(H):
        A.append(list(map(int, input().split())))

    ope = []

    for i in range(H):
        if i % 2 == 0:
            for j in range(W):
                if A[i][j] % 2 == 1:
                    if j != W - 1:
                        A[i][j] -= 1
                        A[i][j+1] += 1
                        ope.append([i+1,j+1,i+1,j+2])
                    elif i == H - 1 and j == W - 1:
                        continue
                    elif j == W - 1:
                        A[i][j] -= 1
                        A[i+1][j] += 1
                        ope.append([i+1,j+1,i+2,j+1])
        else:
            for j in range(W-1,-1,-1):
                if A[i][j] % 2 == 1:
                    if j != 0:
                        A[i][j] -= 1
                        A[i][j-1] += 1
                        ope.append([i+1,j+1,i+1,j])
                    elif i == 0 and j == 0:
                        continue    
                    elif j == 0:
                        A[i][j] -= 1
                        A[i+1][j] += 1
                        ope.append([i+1,j+1,i+2,j+1])

    print(len(ope))
    for o in ope:
        print(*o) 

main()

### FIXED CODE ###

def main():
    H, W = map(int, input().split())
    A = []
    for _ in range(H):
        A.append(list(map(int, input().split())))

    ope = []

    for i in range(H-1):
        for j in range(W):
            if A[i][j] % 2 == 1:
                A[i][j] -= 1
                A[i+1][j] += 1
                ope.append([i+1,j+1,i+2,j+1])
    for j in range(W-1):
        if A[H-1][j] % 2 == 1:
            A[H-1][j] -= 1
            A[H-1][j+1] += 1
            ope.append([H,j+1,H,j+2])
            

    print(len(ope))
    for o in ope:
        print(*o) 

main()
from bisect import *
if __name__ == '__main__':
    N = int(input())
    L = sorted(map(int, input().split()))
    print(sum(jdx - bisect(L, a - L[jdx], 0, jdx) for idx, a in enumerate(L) for jdx in range(idx)))

### FIXED CODE ###

if __name__ == '__main__':
    A, B = map(int, input().split())
    if A <= 2 * B:
        print(0)
    else:
        print(A - 2 * B)
n = int(input())
a = [int(input()) for _ in range(n)]
def search(i, p):
    if p > n:
        print(-1)
        exit()
    if i == 2:
        print(p)
        exit()
    else:
        search(a[i-1], p+1)

search(1, 0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(500*500)
n = int(input())
a = [int(input()) for _ in range(n)]
def search(i, p):
    if p > n:
        print(-1)
        exit()
    elif i == 2:
        print(p)
        exit()
    else:
        search(a[i-1], p+1)

search(1, 0)
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(k[input()-1])

### FIXED CODE ###

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])
n=int(input());print([0,pow(2,(n//2),(10**9+7))][sorted(map(int,input().split()))==[i+(i+N+1)%2for i in range(N)]])

### FIXED CODE ###

n=int(input());print([0,2**(n//2)%(10**9+7)][sorted(map(int,input().split()))==[(i+n%2)//2*2+1-n%2for i in range(n)]])
# Edit: 2014/11/15
# Lang: Python3
# Time: 00.xxs

# File: pc0021.py


if __name__ == "__main__":

    nset = int(input())

    for i in range(0, nset):

        x1, y1, x2, y2, x3, y3, x4, y4 = list(map(float, input().strip("\n").split(" ")))
        vABx = x2 - x1
        vABy = y2 - y1
        vCDx = x4 - x3
        vCDy = y4 - y3

        mx = vCDx / vABx
        my = vCDy / vABy

        if abs(mx - my) < 1e-10:
            print("YES")
        else:
            print("NO")
        #print(mx-my)

#

### FIXED CODE ###

# Edit: 2014/11/15
# Lang: Python3
# Time: 00.xxs

# File: pc0021.py


if __name__ == "__main__":

    nset = int(input())

    for i in range(0, nset):

        x1, y1, x2, y2, x3, y3, x4, y4 = list(map(float, input().strip("\n").split(" ")))
        vABx = x2 - x1
        vABy = y2 - y1
        vCDx = x4 - x3
        vCDy = y4 - y3

        #mx = vCDx / vABx
        #my = vCDy / vABy

        #if abs(mx - my) < 1e-10:
        if abs(vABx*vCDy - vCDx*vABy) < 1e-10:
            print("YES")
        else:
            print("NO")
        #print(mx-my)

#
A,B,C,K=int(input().split(" "))
if(A>=K):
  print(A)
else:
  if(K<=A+B):
    print(A)
  else:
    print(A-(K-A-B))


### FIXED CODE ###

A,B,C,K=map(int,input().split())
if(A>=K):
  print(K)
elif(A<K and A+B>=K):
  print(A)
else:
  print(A-(K-(A+B)))
import math
A=int(input())
B=int(input())
C=int(input())
X=int(input())

ans=0
a=math.floor(X/500)
for i in range(min(A,a)+1):
    X2=X-500*i
    b=math.floor(X2/100)
    for j in range(min(B,b)+1):
        X3=X2-100*j
        if X3%50==0:
            c=X3/50
            if c<=C:
                ans+=1
            else:
                continue
        else:
            continue
print(ans)

### FIXED CODE ###

import math
X=int(input())
A=int(input())
B=int(input())
num=math.floor((X-A)/B)
print(X-A-B*num)
n=[]
line=''
i=0
while line != '0':
    line=input()
    if line != '0'
        n.append(int(line))
        i=i+1
        print(i)
for x in range(len(n)):
    print('Case %d: %d'%(x, n[x]))

### FIXED CODE ###

n=[]
line=''
while line != '0':
    line=input()
    if line != '0': n.append(int(line))
for x in range(len(n)): print('Case %d: %d'%(x+1, n[x]))
print(int(input())+int(input())/2)

### FIXED CODE ###

x, y = map(int, input().split())
print(x+y//2)
N,K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
minTotalCostList = [0 for i in range(N)]
minTotalCostList[0] = 0
for i in range(1,N) :
	for j in range(1,K+1) :
		if j <= i and minTotalCostList[i] != 0 and j != 1 :
			minTotalCostList[i] = min(minTotalCostList[i], (abs(h[i] - h[i-j]) + minTotalCostList[i-j] ))
		elif j > i or minTotalCostList[i] == 0 :
			break
		elif j == 1 :
			minTotalCostList[i] = (abs(h[i] - h[i-j]) + minTotalCostList[i-j] )

print(minTotalCostList[N-1])


N = int(input())
h = [int(i) for i in input().split()]
minTotalCostList = [0 for i in range(N)]

for i in range(N) :
	if i > 1 :
		minTotalCostList[i] = min( abs(h[i] - h[i-1]) + minTotalCostList[i-1], abs(h[i] - h[i-2]) + minTotalCostList[i-2] )
	elif i == 1:
		minTotalCostList[i] = abs(h[i] - h[i-1])
	else :
		minTotalCostList[i] = 0

print(minTotalCostList[N-1])

### FIXED CODE ###

N = int(input())
h = [int(i) for i in input().split()]
minToatalCostList = [0 for i in range(N)]

for i in range(N) :
	if i > 1 :
		minToatalCostList[i] = min( abs(h[i] - h[i-1]) + minToatalCostList[i-1], abs(h[i] - h[i-2]) + minToatalCostList[i-2] )
	elif i == 1:
		minToatalCostList[i] = abs(h[i] - h[i-1])
	else :
		minToatalCostList[i] = 0

print(minToatalCostList[N-1])
import math

n, k = map(int, input().split())
mod = 10 ** 9 + 7


def cmb_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    print(((cmb_count((n - k + 1), i) % mod) * (cmb_count(k - 1, i - 1)) % mod))


### FIXED CODE ###

import math

n, k = map(int, input().split())
mod = 10 ** 9 + 7

def cmb_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    if n -k +1 >=i:
        print(((cmb_count((n - k + 1), i) % mod) * (cmb_count(k - 1, i - 1)) % mod))
    else:
        print(0)
w = input()
cnt = 0
while(True):
    t = input()
    if t == "END_OF_TEXT":
        break
    t = t.lower
    tlist = t.split()
    for i in tlist:
        if i == w:
            cnt += 1
print(cnt)


### FIXED CODE ###

w = input()
cnt = 0
while(True):
    t = input()
    if t == "END_OF_TEXT":
        break
    t = t.lower().split()
    for i in t:
        if i == w:
            cnt += 1
print(cnt)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


n,k = MAP()
s = input()
k*=2

lst = [0]
for i in range(n-1):
    if s[i]!=s[i+1]:
        lst.append(i+1)

r = len(lst)
lst += [n]*10
ans=[]
for i in range(r):
    if s[lst[i]]=="0":
        ans.append(lst[i+k] - lst[i])
    else:
        ans.append(lst[i+k+1] - lst[i])

print(max(ans))

### FIXED CODE ###

def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7


n,k = MAP()
s = input()
k*=2

lst = [0]
for i in range(n-1):
    if s[i]!=s[i+1]:
        lst.append(i+1)

r = len(lst)
lst += [n]
ans=[]
for i in range(r):
    if s[lst[i]]=="0":
        ans.append(lst[min(i+k,r)] - lst[i])
    else:
        ans.append(lst[min(i+k+1,r)] - lst[i])

print(max(ans))
N ,K = input().strip().split()
N = int(N)
K = int(K)
a = list(map(int, input().strip().split()))
for i range (N):
  if a[i] >= K:
    p += 1
print(p)

### FIXED CODE ###

N,K = input().strip().split()
N = int(N)
K = int(K)
a = list(map(int, input().split()))
p = 0
for i in range(N):
  if a[i] >= K:
    p += 1
print(p)
a,b = map(int,input().split())
from fractions import gcd
import math
ab_gcd = fractions.gcd(a,b)
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return []
    else:
        factor.append(n)
        return factor
res = trial_division(ab_gcd)
print(len(set(res+[1])))

### FIXED CODE ###

a,b = map(int,input().split())
from fractions import gcd
import math
ab_gcd = gcd(a,b)
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return [1,n]
    else:
        factor.append(n)
        return factor
res = trial_division(ab_gcd)
print(len(set(res+[1])))
card = []       #リスト型の変数カードを定義する。
for i in range(3):      #変数カードに三列のリスト型の数字を三行文加える。
    card.append(list(map(int,input().split())))

N = int(input())        #呼ばれる数字の数を指定する。

result = [[0,0,0],[0,0,0],[0,0,0]]      #変数resultを定義する。
for _ in range(N):      #以下の動作をN回繰り返す。
    b = int(input())        #数字を読み上げる。
    for i in range(3):      #bがAijと対応していた場合、変数resultのAijと同じ位置に1を代入する。
        for j in range(3):
            if b == card[i][j]:
                result[i][j] = 1

judge = "No"        #以下の条件に当てはまらなければNoと表示する

for i in range(3):      #横のビンゴの確認
    if result[i][0] * result[i][1] * result[i][2] == 1:
        judge = "Yes"

for i in range(3):      #縦のビンゴの確認
    if result[0][i] * result[1][i]*result[2][i] == 1:
        judge = "Yes"

if result[0][0] * result[1][1] * result[2][2] == 1:     #斜めのビンゴの確認
    judge = "Yes"

if result[0][2] * result[1][1] : result[2][1] == 1:     #斜めのビンゴの確認
    judge = "Yes"

print(judge)    
 

### FIXED CODE ###

card = []       #リスト型の変数カードを定義する。
for i in range(3):      #変数カードに三列のリスト型の数字を三行文加える。
    card.append(list(map(int,input().split())))

N = int(input())        #呼ばれる数字の数を指定する。

result = [[0,0,0],[0,0,0],[0,0,0]]      #変数resultを定義する。
for _ in range(N):      #以下の動作をN回繰り返す。
    b = int(input())        #数字を読み上げる。
    for i in range(3):      #bがAijと対応していた場合、変数resultのAijと同じ位置に1を代入する。
        for j in range(3):
            if b == card[i][j]:
                result[i][j] = 1

judge = "No"        #以下の条件に当てはまらなければNoと表示する

for i in range(3):      #横のビンゴの確認
    if result[i][0] * result[i][1] * result[i][2] == 1:
        judge = "Yes"

for i in range(3):      #縦のビンゴの確認
    if result[0][i] * result[1][i] * result[2][i] == 1:
        judge = "Yes"

if result[0][0] * result[1][1] * result[2][2] == 1:     #斜めのビンゴの確認
    judge = "Yes"

if result[0][2] * result[1][1] * result[2][0] == 1:     #斜めのビンゴの確認
    judge = "Yes"

print(judge)
s = input()
z = ''
ans = ''
for i in range(len(s)):
  if s[i] in 'ACGT':
    z = s[i]
	for j in range(i+1, len(s)):
      if s[j] in 'ACGT':
        z += s[j]
      else:
        if len(s) > len(ans):
          ans = s
        z = ''
  else:
    continue
print(ans)

### FIXED CODE ###

s = input()
z = ''
ans = 0
for i in range(len(s)):
    if s[i] in 'ACGT':
        ans = max(ans, 1)
        for j in range(i+1, len(s)):
            if s[j] in 'ACGT':
                ans = max(ans, j-i+1)
            else:
                break
    else:
        continue
print(ans)
N = int(input())
abc = [list(map(int,input().split())) for _ in range(N)]
dp = [[0]*N for _ in range(N)] #i日目の活動をa,b,cで終えた幸福度のmax
dp[0][0] = abc[0][0]
dp[1][0] = abc[0][1]
dp[2][0] = abc[0][2]

def chmax(a,b):
    if a < b:
        return b
    else:
        return a 

for i in range(N-1):
    dp[0][i+1] =  chmax(dp[1][i]+abc[i+1][0],dp[2][i]+abc[i+1][0])
    dp[1][i+1] =  chmax(dp[0][i]+abc[i+1][1],dp[2][i]+abc[i+1][1])
    dp[2][i+1] =  chmax(dp[1][i]+abc[i+1][2],dp[0][i]+abc[i+1][2])


ans = chmax(dp[0][N-1],dp[1][N-1])
ans = chmax(ans,dp[2][N-1])
    
print(ans)

### FIXED CODE ###

#C
N = int(input())
abc = [list(map(int,input().split())) for _ in range(N)]
dp = [[0]*N for _ in range(3)] #i日目の活動をa,b,cで終えた幸福度のmax
dp[0][0] = abc[0][0]
dp[1][0] = abc[0][1]
dp[2][0] = abc[0][2]

def chmax(a,b):
    if a < b:
        return b
    else:
        return a 

for i in range(N-1):
    dp[0][i+1] =  chmax(dp[1][i]+abc[i+1][0],dp[2][i]+abc[i+1][0])
    dp[1][i+1] =  chmax(dp[0][i]+abc[i+1][1],dp[2][i]+abc[i+1][1])
    dp[2][i+1] =  chmax(dp[1][i]+abc[i+1][2],dp[0][i]+abc[i+1][2])


ans = chmax(dp[0][N-1],dp[1][N-1])
ans = chmax(ans,dp[2][N-1])
    
print(ans)
import bisect

n = int(input())

a_list=[]
for i in range(n):
  a_list.append(int(input()))

ans_head=[a_list[-1]]

for i in range(n-2,0,-1):
  a=a_list[i]
  if a>ans_head[-1]:
    ans_head.append(a)
  else:
    insert_index = bisect.bisect_right(ans_head,a)
    ans_head[insert_index]=a

  #print(ans_head)
print(len(ans_head))


### FIXED CODE ###

import bisect
n=int(input())
A=[]
for i in range(n):
  A.append(int(input()))
Ans=[A[-1]]
for i in reversed(range(n-1)):
  a=A[i]
  if a>=Ans[-1]:
    Ans.append(a)
  else:

    Ans[bisect.bisect_right(Ans,a)]=a

print(len(Ans))
N = input()
if N == "1":
    print("Hello World")
elif N == "2":
    a,b = map(int, input().split())
    print(a+b)

### FIXED CODE ###

N = input()
if N == "1":
    print("Hello World")
elif N == "2":
    a,b = [int(input()) for i in range(2)]
    print(a+b)
# -*- coding: utf-8 -*-
from math import factorial

N, M = map(int, input().split())
a = [int(input()) for x in range(M)]

def fibo(dan):
    if dan == 0 or dan == 1: return 1
    else: return fibo(dan-1) + fibo(dan-2)

routes = 1
prev = 0
for x in a:
    if x == prev:
        routes = 0
        break
    else:
        dan = (x-1) - prev
        routes = (routes * fibo(dan)) % 1000000007
        prev = x+1

routes = (routes * fibo(N-prev)) % 1000000007
print(int(routes))

### FIXED CODE ###

# -*- coding: utf-8 -*-
from math import factorial

N, M = map(int, input().split())
a = [int(input()) for x in range(M)]

def fibo(dan):
    tmp = [1, 1]
    for i in range(2, dan+1):
        tmp.append(tmp[i-1] + tmp[i-2])
    return tmp[dan]

routes = 1
prev = 0
for x in a:
    if x == prev:
        routes = 0
        break
    else:
        dan = (x-1) - prev
        routes = (routes * fibo(dan))
        prev = x+1

routes = (routes * fibo(N-prev)) % 1000000007
print(int(routes))
N, P = map(int, raw_input().split())
i = 2
res = 1
while i ** N <= P and N > 1:
    if P % (i ** N) == 0:
        res = i
    i += 1
print res


### FIXED CODE ###

N = raw_input()
print len([i for i in N if i == '2'])
N = int(input())
A = list(map(int, input().split()))

dic = {}

for a in A:
    if a in dic.keys():
        dic[a] += 1
    else: dic[a] = 1

flag = True
ini = 0
if N % 2 == 1:
    if dic[0] == 1:
        ini = 2
    else:
        flag = False
else:
    ini = 1

flag = True
for i in range(ini,N,2):
    if not flag: break
    if dic[i] != 2:
        flag = False

if flag:
    print(2**(N//2)%(10**9+7))
else:
    print(0)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

# N が奇数なら、Aはすべて偶数であり、かつ0を除いてすべて1ペア、かつ0が1つあるはず
# N が偶数なら、Aはすべて奇数であり、かつすべて1ペア
# 上記を確認するための辞書
dic = {}

for a in A:
    if a in dic.keys():
        dic[a] += 1
    else: dic[a] = 1

flag = True
ini = N
if N % 2 == 1:
    if 0 in A:
        if dic[0] == 1:
            ini = 2
        else:
            flag = False
    else:
        flag = False
else:
    ini = 1

for i in range(ini,N,2):
    if not flag: break
    if i in dic:
        if dic[i] != 2:
            flag = False
    else: flag = False

if flag:
    print(2**(N//2)%(10**9+7))
else:
    print(0)
L, R, d = input().split()
L = int(L)
R = int(R)
d = int(d)
cnt = 0
for t in Range(L,R+1):
  if t % d == 0:
    cnt = cnt + 1

print(cnt)


### FIXED CODE ###

L, R, d = input().split()
L = int(L)
R = int(R)
d = int(d)
cnt = 0
for t in range(L,R+1):
    if t % d == 0:
        cnt = cnt + 1

print(cnt)
from collections import Counter


N = int(input())
c = Counter(map(int, input().split()))
usables = sorted([(k, v) for k, v in c.items() if v >= 2])
if len(usables) <= 1:
    print(0)
else:
    if usables[-1][2] >= 4:
        print(usables[-1][1] ** 2)
    else:
        print(usables[-1][1] * usables[-2][1])


### FIXED CODE ###

from collections import Counter


N = int(input())
c = Counter(map(int, input().split()))
usables = sorted([(k, v) for k, v in c.items() if v >= 2])
if len(usables) <= 1:
    print(0)
else:
    if usables[-1][1] >= 4:
        print(usables[-1][0] ** 2)
    else:
        print(usables[-1][0] * usables[-2][0])
a,b = map(int,str(input()).split())

if (a%2==0) or (b%2==0):
	print("Even)
else:
    print("Odd")

### FIXED CODE ###

a,b = map(int,str(input()).split())
 
if (a%2==0) or (b%2==0):
    print("Even")
else:
    print("Odd")
K=int(input())
A,B=int(input().split())
check=False
for i in range(0,B-A):
  if (B-A-i)%K==0:
    check=True
if check==True:
  print("OK")
else:
  print("NG")
  

### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())
ans="NG"
for i in range(A,B+1):
    if  i%K==0:
        ans="OK"
print(ans)
n = int(input())
s = input()
list = []

for i in s:
    if ord(i)+N > 90:
        list.append(chr(ord(i)+N-26))
    else:
        list.append(chr(ord(i)+N))
        
ans = "".join(list)
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
list = []

for i in s:
    if ord(i)+n > 90:
        list.append(chr(ord(i)+n-26))
    else:
        list.append(chr(ord(i)+n))
        
ans = "".join(list)
print(ans)
a,b,c=map(int,input().split())

d=c-a-b

if d<0:
    print('No')
elif 4*a*b<d*d
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

d=c-a-b

if d<0:
    print('No')
elif 4*a*b<d*d:
    print('Yes')
else:
    print('No')
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path

N, M = map(int, input().split())
edge = np.array([input().split() + ['1'] for _ in range(M)], dtype=np.int64).T
graph = csr_matrix((edge[2], (edge[:2] - 1)), (N, N))

path = list(shortest_path(graph, method='D', directed=False)[0][1:])
judge = 'Yes' if all([p > 0 for p in path]) else 'No'

if judge == 'Yes':
    print(judge)
    for p in path:
        print(int(p))
else:
    print(judge)


### FIXED CODE ###

from collections import deque

N, M = map(int, input().split())
arr = [[] for n in range(N)]
que = deque([1])

for m in range(M):
    a, b = map(int, input().split())
    arr[a - 1].append(b)
    arr[b - 1].append(a)

dist = [-1] * N
dist[0] = 0
arr2 = [0] * (N - 1)

print("Yes")
while que:
    c = que.popleft()
    for i in arr[c - 1]:
        if dist[i - 1] != -1:
            continue

        dist[i - 1] = 0
        arr2[i - 2] = c
        que.append(i)

for i in arr2:
    print(i)
cases = int(input())

account = {'AC': 0, 'WA' : 0, 'TLE':0, 'RE':0}

while cases-- > 0:
  account[input()]++
  
print('AC x '+ account['AC'])
print('WA x '+ account['WA'])
print('TLE x '+ account['TLE'])
print('RE x '+ account['RE'])
  
  

### FIXED CODE ###

import sys
input = sys.stdin.readline

cases = int(input())
account = {'AC': 0, 'WA' : 0, 'TLE':0, 'RE':0}

while cases > 0:
  account[input().split()[0]] += 1
  cases -= 1
  
print('AC x '+ str(account['AC']))
print('WA x '+ str(account['WA']))
print('TLE x '+ str(account['TLE']))
print('RE x '+ str(account['RE']))