Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
def check(t,x,y,nt,nx,ny):
    # print(t)
    # print(x)
    # print(y)
    tempt = nt
    tempx = nx
    tempy = ny
    judge = True
    if (x+y) > (nx+ny+t):
        print("No")
        sys.exit()
    #x方向の移動
    while x != tempx:
        if (x>tempx):
            tempx += 1
            tempt += 1
        elif(x<tempx):
            tempx -= 1
            tempt += 1
    #y方向の移動
    if tempt<=t:
        while y != tempy:
            if (y>tempy):
                tempy += 1
                tempt += 1
            elif(x<tempy):
                tempy -= 1
                tempt += 1
    else:
        print("No")
        sys.exit()
    if (t-tempt)%2 != 0:
        print("No")
        sys.exit()     

    return tempt,tempx,tempy
N = int(input())
nt = 0
nx = 0
ny = 0
t = []
x = []
y = []
#入力
for i in range(N):
    temp = input().split(" ")
    t.append(temp[0])
    x.append(temp[1])
    y.append(temp[2])

for i in range(N):
    nt,nx,ny = check(int(t[i]), int(x[i]), int(y[i]),nt,nx,ny)

print("Yes")

### FIXED CODE ###

import sys
def check_ans(t,x,y,nt,nx,ny):
    if (x+y) > (nx+ny+t):
        print("No")
        sys.exit()    
    if (x >= nx):
        nt += (x-nx)
    elif(x <= nx):
        nt += (nx-x)
    if (y >= ny):
        nt += (y-ny)
    elif(y <= ny):
        nt += (ny-y)
    if (t-nt)%2 != 0:
        print("No")
        sys.exit()

N = int(input())
nt = 0
nx = 0
ny = 0
t = []
x = []
y = []
#入力
for i in range(N):
    temp = input().split(" ")
    t.append(temp[0])
    x.append(temp[1])
    y.append(temp[2])
for i in range(N):
    if i == 0:
        check_ans(int(t[i]), int(x[i]), int(y[i]), nt, nx, ny)
    else:
        nt = int(t[i-1])
        nx = int(x[i-1])
        ny = int(y[i-1])
    check_ans(int(t[i]), int(x[i]), int(y[i]), nt, nx, ny)
print("Yes")
### BUGGY CODE ###

h = int(input())
m = [h]
ans = 0
while(sum(m)>0):
    for i in range(len(m)):
        while m[i]>0:
            if m[i]==1:
                ans += 1
                m[i]=0
            elif m[i]>1:
                ans+= 1
                m[i]/=2
                m.append(m[i])
print(ans)

### FIXED CODE ###

import math
h = int(input())
ans = 1

for i in range(1,int(math.sqrt(10**12))):
    if  h > ans:
        ans+= 2**i
    else:
        break
print(ans)
### BUGGY CODE ###

N = int(input())
A = [int(a) for a in input().split()]
ans = []
for i in range(1, N+1):
  ans.append(A.index(i) + 1)
for i in range(N):
  print(ans[i], end = " ")

### FIXED CODE ###

N = int(input())
A = [int(a) for a in input().split()]
ans = [0] * N
for i in range(N):
  ans[A[i] - 1] = i + 1
print(*ans)
### BUGGY CODE ###

from heapq import heapify, heappop, heappush 
N, M = map(int, input().split())
A = list(map(int, input().split()))
heapify(A)
for i in range(M):
    B, C = map(int, input().split())
    for i in range(B):
        e = heappop(A)
        if e < C:
            heappush(A, C)
        else:
            heappush(A, e)
            break

ans = sum(A)
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
D = {}
for a in A:
    if a in D:
        D[a] += 1
    else:
        D[a] = 1

for i in range(M):
    B, C = map(int, input().split())
    if C in D:
        D[C] += B
    else:
        D[C] = B

K = sorted(D.keys(), reverse=True)
ans = 0
cnt = N
for k in K:
   a = min(D[k], cnt)
   ans += k * a
   cnt -= a
   if cnt == 0: break
print(ans)
### BUGGY CODE ###

from collections import deque, defaultdict
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
edge = [[] for _ in range(N + 1)]
Redge = [[] for _ in range(N + 1)]
for _ in range(M):
    s, t = map(int, input().split())
    edge[s].append(t)
    Redge[t].append(s)

dp = [0.0] * (N + 1)
for s in reversed(range(1, N)):
    dp[s] = sum(dp[t] + 1.0 for t in edge[s]) / len(edge[s])
ans = dp[1]


cut = set()
for s in range(1, N):
    if len(edge[s]) > 1:
        i = edge[s][0]
        for j in edge[s]:
            if dp[i] < dp[j]:
                i = j
        cut.add((s, i))

for ng in cut:
    dp = [0.0] * (N + 1)
    for s in reversed(range(1, N)):
        E = 0.
        prob = 0.
        for t in edge[s]:
            if (s, t) == ng:
                continue
            prob += 1.0
            E += dp[t] + 1.0
        dp[s] = E / prob
    ans = min(ans, dp[1])

print(ans)

### FIXED CODE ###

from collections import deque, defaultdict
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
edge = [[] for _ in range(N + 1)]
Redge = [[] for _ in range(N + 1)]
for _ in range(M):
    s, t = map(int, input().split())
    edge[s].append(t)
    Redge[t].append(s)

dp = [0.0] * (N + 1)
for s in reversed(range(1, N)):
    dp[s] = sum(dp[t] + 1.0 for t in edge[s]) / len(edge[s])
ans = dp[1]


cut = set()
for s in range(1, N):
    if len(edge[s]) > 1:
        i = edge[s][0]
        for j in edge[s]:
            if dp[i] < dp[j]:
                i = j
        cut.add((s, i))

for ng in cut:
    dp = [0.0] * (N + 1)
    for s in reversed(range(1, N)):
        E = 0.
        prob = 0.
        for t in edge[s]:
            if (s, t) == ng:
                continue
            prob += 1.0
            E += dp[t] + 1.0
        dp[s] = E / prob
    ans = min(ans, dp[1])

print(ans)
### BUGGY CODE ###

def main():
    N, M, V, P = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    A.sort(reverse=True)
    not_ans = 0
    for i in range(P, N):
        if A[i] + M < A[P-1]:
            not_ans += 1
            continue
        votable = M + (P-1) * M + (N - i - 1)*M
        for j in range(P-1, i):
            votable += max(0, A[i] + M - A[j])
        if votable < M*V:
            not_ans += 1

    print(N - not_ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, M, V, P = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    A.sort(reverse=True)

    def is_ok(mid):
        if mid <= P-1:
            return False  # 採用可能
        if A[mid] + M < A[P-1]:
            return True  # 採用不可能
        votable = M + (P-1) * M + (N - (mid + 1))*M
        for i in range(P-1, mid):
            votable += min(M, max(0, A[mid] + M - A[i]))
        if M*V <= votable:
            return False
        else:
            return True

    def binary_search_meguru():
        left = -1
        right = N
        while right - left > 1:
            mid = left + ((right - left) // 2)
            if is_ok(mid):
                right = mid
            else:
                left = mid
        return right
    print(binary_search_meguru())


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
l = [False] * (N + 1)
def count(n):
  ret = 0
  i = 1
  while i*i <= n:
    if n % i == 0:
      ret += 1
      if i != n // i:
        ret += 1
    i += 1
  return ret

num = [0] * (10**5 + 1)
for i in range(1, 10**5):
  num[i] = count(i)


ans = 1
l[0] = True
l[1] = True
if N==1:
  print(ans)
else:
  for i in range(2,N+1):
    if l[i]:
      continue
    if i<=10**5:
      ans += num[i] * i
    else:
      x = int(i**(1/2)) + 1
      a = 1
      while x>1:
        if num[x]!=2:
          continue
          x -= 1
        else:
          y = i
          while True:
            if y%x==0:
              y//=x
              a += 1
            else:
              break
          if y<=10**5:
            ans += a * num[y]
            break
          else:
            x -= 1
            continue
              

  print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N + 1):
  x = N//i
  ans += i * x * (x + 1) // 2
  
print(ans)
### BUGGY CODE ###

H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
h = 2*10**4
dp = [10**9 for i in range(h+1)]
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(h+1):
        if j < a:
            continue
        dp[j] = min(dp[j-a]+b,dp[j])
ans = 10**9
for i in range(H,h+1):
    ans = min(ans,dp[i])
print(ans)

### FIXED CODE ###

H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
x = max(A)
dp = [10**9 for i in range(H+x+1)]
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(H+x+1):
        if j < a:
            continue
        dp[j] = min(dp[j-a]+b,dp[j])
ans = 10**9
for i in range(H,H+x+1):
    ans = min(ans,dp[i])
print(ans)
### BUGGY CODE ###

import fractions
a,b = map(int, input().split())
g = fractions.gcd(a,b)
ans = 1
if g == 2:
  ans += 1
elif g > 2 and g%2 == 0:
  ans += 1
  while True:
    g //= 2
    if g%2 != 0:
      break
      
if g >= 3:
  for i in range(3, g+1):
    if g%i == 0:
      for j in range(2, i):
        if i%j == 0:
          break
      else:
        ans += 1
  print(ans)
else:
  print(ans)


### FIXED CODE ###

import fractions
import math
a,b = map(int, input().split())
g = fractions.gcd(a,b)
ans = 1

for i in range(2, int(math.sqrt(g))+1):
  if g%i == 0:
    ans += 1
    while True:
      g //= i
      if g%i != 0:
        break
if (g != 1):
  ans += 1
print(ans)
### BUGGY CODE ###

def LPP():
    n, m = map(int, input().split())
    edges = []
    for _ in range(m):
        temp = list(map(int, input().split()))
        edges.append(temp)
    edges.sort(key=lambda x: x[0])
    paths = []
    i = 0
    maxi = 0
    while i < len(edges):
        temp_edge = edges[i].copy()
        j = 0
        while j < len(edges):
            if edges[j][0] == temp_edge[-1]:
                temp_edge.append(edges[j][1])
                j = 0
            else:
                j += 1
        i += 1
        maxi = max(maxi, len(temp_edge))
        paths.append(temp_edge.copy())
        temp_edge.clear()
    print(maxi-1, end="")

LPP()



### FIXED CODE ###

import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**7)
def LPP():
    n, m = map(int, readline().split())
    edges = [[] for _ in range(n)]
    for _ in range(m):
        s, t = map(int, readline().split())
        s -= 1
        t -= 1
        edges[s].append(t)
    dp = [-1]*n
    def dfs(s):
        if dp[s] != -1:
            return dp[s]
        if len(edges[s]) == 0:
            dp[s] = 0
            return 0
        res = 0
        for t in edges[s]:
            res = max(res, dfs(t)+1)
        dp[s] = res
        return res
    for i in range(n):
        dfs(i)
    print(max(dp),end="")

LPP()
### BUGGY CODE ###

def Get_nC2(n):
    return int(n*(n-1) / 2);


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

all_cnt = 0
num_cnt_dict = {}
comb_cnt_dict = {}
for i in range(1, N+1):
    if i in A_i and A_i.count(i) > 1:
        num_cnt_dict[i] = A_i.count(i)
        all_cnt += Get_nC2(num_cnt_dict[i])

for a_i in A_i:
    if a_i in comb_cnt_dict:
        print(comb_cnt_dict[a_i])
    elif a_i in num_cnt_dict:
        comb_cnt_dict[a_i] = all_cnt - Get_nC2(num_cnt_dict[a_i]) + Get_nC2(num_cnt_dict[a_i]-1)
        print(comb_cnt_dict[a_i])
    else:
        print(0)


### FIXED CODE ###

from collections import Counter

def Get_nC2(n):
    return int(n*(n-1) / 2)


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

c = Counter(A_i)


total = sum(list(map(Get_nC2, c.values())))

for a_i in A_i:
    result =  total - Get_nC2(c[a_i]) + Get_nC2(c[a_i]-1)
    print(result)
### BUGGY CODE ###

n=int(input())
A=list(map(int,input().split()))
ans=[]
for i in range(n):
  ans.append(1+A.index(i+1))
print(*ans)

### FIXED CODE ###


n=int(input())
A=list(map(int,input().split()))
ans=[0]*n
for i in range(n):
  ans[A[i]-1]=i+1
print(*ans)
### BUGGY CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))

if K >= N:
    print(0)
else:
    for i in range(K):
        del H[H.index(max(H))]
    print(sum(H))


### FIXED CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))

if K >= N:
    print(0)

else:
    H.sort(reverse=True)
    print(sum(H[K:]))
### BUGGY CODE ###

# https://atcoder.jp/contests/hitachi2020/submissions/10704509

def main():
    from operator import itemgetter
    import sys
    input = sys.stdin.readline

    inf = 1 << 30
    L = 30

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

    ps = []
    coef_0 = []
    for _ in range(N):
        a, b = map(int, input().split())
        if a == 0:
            coef_0.append(b + 1)
        else:
            ps.append((a / (b + 1), a, b))  # namedtupleやめた,sort_key,coef,const

    ps.sort(key=itemgetter(0), reverse=True)
    coef_0.sort()

    dp = [inf] * (L + 1)
    dp[0] = 0
    for _, coef, const in ps:
        for visited in reversed(range(L)):
            dp[visited + 1] = min(
                dp[visited + 1],
                (dp[visited] + 1) * (coef + 1) + const
            )

    def accumulate(a):
        s = 0
        yield s  # start=x->0
        for x in a:
            s += x
            yield s

    *acc, = accumulate(coef_0)

    ans = {0}
    cnt = len(acc) - 1
    for visited, consumption_time in enumerate(dp):
        rest = T - consumption_time
        if rest < 0: continue  # le->lt
        while cnt > 0 and acc[cnt] > rest:  # bisect_right->しゃくとり
            cnt -= 1
        ans.add(visited + cnt)
    print(max(ans))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# https://atcoder.jp/contests/hitachi2020/submissions/10704509

def main():
    import sys
    input = sys.stdin.readline

    inf = 1 << 30
    L = 30

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

    ps = []
    coef_0 = []
    for _ in range(N):
        a, b = map(int, input().split())
        if a == 0:
            coef_0.append(b + 1)
        else:
            ps.append((a, b))  # namedtupleやめた,coef,const

    ps.sort(key=lambda p: p[0] / (p[1] + 1), reverse=True)
    coef_0.sort()

    dp = [inf] * (L + 1)
    dp[0] = 0
    for coef, const in ps:
        for visited in reversed(range(L)):
            dp[visited + 1] = min(
                dp[visited + 1],
                (dp[visited] + 1) * (coef + 1) + const
            )

    def accumulate(a):
        s = 0
        yield s  # start=x->0
        for x in a:
            s += x
            yield s

    *acc, = accumulate(coef_0)

    ans = {0}
    cnt = len(acc) - 1
    for visited, consumption_time in enumerate(dp):
        rest = T - consumption_time
        if rest < 0: break  # le->lt,continue->break,restは狭義単調減少
        while cnt > 0 and acc[cnt] > rest:  # bisect_right->しゃくとり
            cnt -= 1
        ans.add(visited + cnt)
    print(max(ans))


if __name__ == '__main__':
    main()
### BUGGY CODE ###

from sys import stdin

N, M = map(int, stdin.readline().split())
A = list(map(int, stdin.readline().split()))
low = min(A)
for _ in range(M):
    B, C = map(int, stdin.readline().split())
    if low < C:
        A.extend([C]*B)
        A.sort(reverse=True)
        A = A[:N]
        low = A[-1]

print(sum(A))


### FIXED CODE ###

from sys import stdin, exit

N, M = map(int, stdin.readline().split())
A = list(map(int, stdin.readline().split()))
p = [(A[i], 1) for i in range(N)]
for _ in range(M):
    B, C = map(int, stdin.readline().split())
    p.append((C, B))

p.sort(reverse=True)

ans, cnt = 0, N
for (v, c) in p:
    use = min(c, cnt)
    ans += use * v
    cnt -= use

print(ans)
### BUGGY CODE ###

import math

ans = []
while True:
	try:
		n = int(raw_input())
		isPrime = [-1] * (n + 1)
		isPrime[0], isPrime[1] = False, False
		#isPrime[2] = True
		i = 2
		while i * i < n:
			for j in range(i, n+1, i):
				isPrime[j] = False
			isPrime[i] = True
			i = isPrime.index(-1)
			print isPrime
		ans.append(isPrime.count(True) + isPrime.count(-1))
	except EOFError:
		break
for num in ans:
	print num

### FIXED CODE ###

MAX = 1000000
prime = [1] * MAX
prime[0], prime[1] = 0, 0
i = 2
while i * i < MAX:
    j = 2
    while i * j < MAX:
        prime[i * j] = 0
        j += 1
    i += 1
for k in range(1, len(prime)):
    prime[k] += prime[k-1]

while True:
    try:
        n = int(raw_input())
        print prime[n]
    except EOFError:
        break
### BUGGY CODE ###

import sys
input=sys.stdin.readline

ans=0
N,M=map(int,input().split())
Ar=[[] for _ in range(M)]
for _ in range(N):
      A,B=map(int,input().split())
      if A <= M:
          Ar[A-1].append(B)
An=[]
for i in range(M):
      An += Ar[i]
      if len(An)>0:
          An.sort()
          ans+=An.pop(len(An)-1) 
print(ans)


### FIXED CODE ###

import heapq
N , M = map(int , input().split())
jobs = [list(map(int , input().split())) for _ in range(N)]
jobs.sort()

q = []
index = 0
ans = 0
for limit in range(1 , M + 1):
    while index < N:
        time =jobs[index][0]
        reward = jobs[index][1]
        if limit >= time:
            heapq.heappush(q , -reward)
            index += 1
        else:
            break
    #print(q)
    if len(q) != 0:
        tmp = heapq.heappop(q)
        ans -= tmp

print(ans)
### BUGGY CODE ###

from fractions import gcd #直して
n = int(input())
a = list(map(int, input().split()))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


mod = 10**9+7
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

fact = [0] * (1000001)
pri = []
for i in range(n):
    f = factorization(a[i])
    for fac, c in f:
        fact[fac] = max(fact[fac], c)

fact_list = []
for i in range(1000001):
    if fact[i] > 0:
        fact_list.append((i, fact[i]))




ans = 0
for i in range(n):
    m = modinv(a[i])
    for fac, c in fact_list:
        m *= pow(fac, c, mod)
        m %= mod

    ans += m
    ans %= mod

print(ans)


### FIXED CODE ###

from fractions import gcd #直して
n = int(input())
a = list(map(int, input().split()))

mod = 10**9+7
l = 1
for i in range(n):
    l = a[i] // gcd(l, a[i]) * l
    

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

d = 0
for i in range(n):
    d += modinv(a[i])

print((l*d) % mod)
### BUGGY CODE ###

from itertools import product
N, K = map(int, input().split())
A = list(map(int, input().split()))
K_bin = bin(K)[2:]
digit = max(len(K_bin), len(bin(max(A))[2:]))
B = [bin(a)[2:].zfill(digit) for a in A]
# d桁目の1の個数の，全てのA_iについての総和
C = [0] * digit
for b in B:
    for i, s in enumerate(b):
        if s == '1':
            C[i] += 1
GAIN = [2**i for i in range(digit)][::-1]
maxval = 0
for comb in product(('01'), repeat=digit):
    comb = ''.join(comb)
    if int(comb, 2) > K:
        break
    tmpval = 0
    for i in range(digit):
        res = C[i] if comb[i] == '0' else (N - C[i])
        tmpval += GAIN[i] * res
    maxval = max(maxval, tmpval)
print(maxval)


### FIXED CODE ###

from itertools import product
N, K = map(int, input().split())
A = list(map(int, input().split()))
K_bin = bin(K)[2:]
digit = max(len(K_bin), len(bin(max(A))[2:]))
K_bin = K_bin.zfill(digit)
B = [bin(a)[2:].zfill(digit) for a in A]
# d桁目の0の個数の，全てのA_iについての総和
C = [0] * digit
for b in B:
    for i, s in enumerate(b):
        if s == '0':
            C[i] += 1
ideal = ''
for c in C:
    binary = '1' if c > N//2 else '0'
    ideal += binary
dp = [[0 for _ in range(2)] for _ in range(digit)]
cands = [0]
gain = [2**i for i in range(digit)][::-1]

def calc(s):
    ret = 0
    for i in range(digit):
        tmp = C[i] if s[i] == '1' else N-C[i]
        ret += tmp * gain[i]
    return ret

for i in range(digit):
    if K_bin[i] == '1':
        cands.append(calc(K_bin[:i] + '0' + ideal[i+1:]))
print(max(max(cands), calc(K_bin)))
### BUGGY CODE ###

N = int(input())
s = list(map(int, input().split()))
result = 1
for value in s:
    result *= value
if result > pow (10,18):
    print(-1)
else:
    print(result)   


### FIXED CODE ###

import sys
N = int(input())
s = list(map(int, input().split()))
if 0 in s:
    print(0)
    sys.exit()
result = 1
for value in s:
    result *= value
    if result > pow (10,18):
        print(-1)
        sys.exit()
print(result)
### BUGGY CODE ###

N, K = list(map(int, input().split()))
M = abs(N - K)
mini = M

while (not M > mini):
    mini = min(mini, M)
    M = abs(M - K)
print(mini)


### FIXED CODE ###

N, K = list(map(int, input().split()))
M = abs(N - K)
mini = M + 1

if (not N < K):
    if (N%K == 0):
        print(0)
    else:
        M = (N % K)
        while (M < mini):
            mini = min(mini, M)
            M = abs(M - K)
        print(mini)

else:
    while (M < mini):
        mini = min(mini, M)
        M = abs(M - K)
    print(mini)
### BUGGY CODE ###

import numpy as np
N,K=map(int,input().split())
A=np.array(list(map(int,input().split())))
B=np.zeros(N+1)
if K>41:
  A=np.ones(N)*N
else:
  for k in range(K):
    for i in range(N):
      B[max(0,i-int(A[i]))] +=1
      B[min(N,i+int(A[i])+1)] -=1
    A=np.cumsum(B)[:N]
    B=np.zeros(N+1)

for i in list(map(int,A)):
  print(i,end=" ")

### FIXED CODE ###

import numpy as np
from numba import jit
N,K=map(int,input().split())
A=np.array(list(map(int,input().split())),dtype=np.int64)
@jit
def loop(a,k):
  if k>41:
    ans=np.ones(N,dtype=np.int64)*N
  else:
    ans=a
    for j in range(k):
      B=np.zeros(N+1,dtype=np.int64)
      for i in range(N):
        B[max(0,i-int(ans[i]))] +=1
        B[min(N,i+int(ans[i])+1)] -=1
      ans=np.cumsum(B)[:N]
  return ans

for i in loop(A,K):
  print(i)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
memo=[]

h=0; w=0
for element in a:
    if element in memo: pass
    else:
        memo.append(element)
        num=a.count(element)
        if num>=4 and h==0: h=w=element
        elif num>=2 and h==0: h=element
        elif num>=2 and w==0: w=element

ans=h*w
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)

ans=[]
tmp=0
count=0
for el in a:
    if len(ans)==2: break
    if el != tmp: tmp=el; count=0
    else:
        if count%2==0: ans.append(el); tmp=el;
        count+=1

try: ans=ans[0]*ans[1]
except: ans=0
print(ans)
### BUGGY CODE ###

A,B,C,K=map(int, input().split(' '))
total = 0
for _ in range(K):
    if A > 0:
        total += 1
        A = A - 1
    elif B > 0:
        B = B - 1
    elif C > 0:
        total -= 1
        C = C -1
print(total)


### FIXED CODE ###

A,B,C,K=map(int, input().split(' '))
ans = 0
if A >= K:
    print(K)
elif A + B >= K:
    print(A)
else:
    print(A - (K-A-B))
### BUGGY CODE ###

import numpy as np
N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [0 for _ in range(N)]
dp[1] = abs(H[1] - H[0])

for i in range(2, N):
    if i < K:
        A = [dp[i-k] + abs(H[i-k] - H[i]) for k in range(1, i+1)]
        dp[i] = np.min(A)
    else:
        A = [dp[i - k] + abs(H[i - k] - H[i]) for k in range(1, K+1)]
        dp[i] = np.min(A)


print(dp[-1])

### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
H = np.array(list(map(int, input().split())))

dp = np.zeros(N, dtype=int)

for i in range(1, N):
    s = max(i-K, 0)
    dp[i] = np.min(dp[s:i]+np.abs(H[s:i]-H[i]))


print(dp[-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
dp = [[float("inf") for j in range(H+1)] for i in range(N+1)]
for i in range(N):
    for j in range(H+1):
        if j <= A[i]:
            dp[i+1][j] = min(dp[i][j], B[i])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + B[i])
print(dp[N][H])

### FIXED CODE ###

import sys
input = sys.stdin.readline
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
dp = [[float("inf") for j in range(H+1)] for i in range(N+1)]
for i in range(N):
    for j in range(H+1):
        if j <= A[i]:
            dp[i+1][j] = min(dp[i][j], B[i])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + B[i])
print(dp[N][H])