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

while True:
  a=0

### FIXED CODE ###

a,b=map(int,input().split())
flg=True
if a<=0 or a>=10:
    flg=False
if b<=0 or b>=10:
    flg=False

if flg:
    print(a*b)
else:
    print(-1)
### BUGGY CODE ###

I=int(input())

for h in range(1,3501):
    for n in range(1,3501):
        t = 4*h*n - I*h - I*n
        if t <= 0:
            continue;
        s = I*h*n
        if s % t == 0:
            print(h, n, int(s/t))
            quit()

### FIXED CODE ###

N=int(input())

for h in range(1,3501):
    if (4*h <= N):
        continue
    nn = int (N*h / (4*h-N))
    for n in range(max(1,nn),3501):
        t = 4*h*n - N*h - N*n
        if t <= 0:
            continue
        s = N*h*n
        if s % t == 0:
            print(h, n, int(s/t))
            quit()
### BUGGY CODE ###

N=int(input())
flag=True

for h in range(1,3501):
  for n in range(1,3501):
    if 4*h*n-N*n-N*h !=0:
      if (N*h*n)%(4*h*n-N*n-N*h)==0:
        w=(N*h*n)//(4*h*n-N*n-N*h)
        if w>0:
          print(h,n,w)
          flag=False
          break
  if flag==False:
    break

### FIXED CODE ###

N=int(input())
flag=True

for h in range(1,3501):
  for n in range(1,3501):
    if 4*h*n-N*n-N*h !=0:
      if (N*h*n)%(4*h*n-N*n-N*h)==0:
        w=(N*h*n)//(4*h*n-N*n-N*h)
        if w>0:
          print(h,n,w)
          flag=False
          break
  if flag==False:
    break
### BUGGY CODE ###


x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(key=lambda x:-x)
b.sort(key=lambda x:-x)
c.sort(key=lambda x:-x)
# queue=[beauty, indexa, indexb, indexc]
queue=[(a[0]+b[0]+c[0],0,0,0)]
canAdd=[[[1 for _ in range(z)]for _ in range(y)]for _ in range(x)]
beauty=[0 for _ in range(k)]
for index in range(k):
    queue.sort(key=lambda x:-x[0])
    # print(queue)
    beauty[index],indexa,indexb,indexc=queue[0]
    queue.pop(0)
    for da,db,dc in [(1,0,0),(0,1,0),(0,0,1)]:
        nexta,nextb,nextc=indexa+da,indexb+db,indexc+dc
        if nexta<x and nextb<y and nextc<z and (nexta+1)*(nextb+1)*(nextc+1)<=k:
            if canAdd[nexta][nextb][nextc]:
                queue.append((a[nexta]+b[nextb]+c[nextc],nexta,nextb,nextc))
                canAdd[nexta][nextb][nextc]=0
for i in range(k):
    print(beauty[i])


### FIXED CODE ###


x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(key=lambda x:-x)
b.sort(key=lambda x:-x)
c.sort(key=lambda x:-x)
beauty=[]
index=0
for i in range(x):
    for j in range(y):
        for l in range(z):
            if (i+1)*(j+1)*(l+1)<=k:
                beauty.append(a[i]+b[j]+c[l])
            else:
                break
beauty.sort(key=lambda x:-x)
for i in range(k):
    print(beauty[i])
### BUGGY CODE ###

N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = [i + 1 for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    if H[a] > H[b] and b in kouho:
        kouho.remove(b)
    elif H[a] < H[b] and a in kouho:
        kouho.remove(a)
    elif H[a] == H[b]:
        if a in kouho:
            kouho.remove(a)
        if b in kouho:
            kouho.remove(b)
print(len(kouho))


### FIXED CODE ###

N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
kouho = set([i + 1 for i in range(N)])
hazure = set()
for i in range(M):
    a, b = map(int, input().split())
    Ha = H[a]
    Hb = H[b]
    if Ha >= Hb:
        hazure.add(b)
    if Ha <= Hb:
        hazure.add(a)
ans = kouho - hazure
print(len(ans))
### BUGGY CODE ###

import sys
read=sys.stdin.buffer.read
import numpy as np

n,k=map(int,input().split())
A=np.array(input().split(),np.int64)
F=np.array(input().split(),np.int64)
A.sort()
F.sort()
F=F[::-1]
    
def ok(x): #チームの成績をxとするような修行の仕方が存在するか
    B=A-x//F
    return sum(B[B>0])<=k
    
l=-1
r=10**18
while r-l>1:
    mid=(r+l)//2
    if ok(mid):
        r=mid
    else:
        l=mid
print(r)  



### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
A = np.array(input().split(), dtype=np.int64)
F = np.array(input().split(), dtype=np.int64)
A = np.sort(A)
F = np.sort(F)[::-1]


def C(x):
    train = np.maximum(0, A - x // F).sum()
    return train <= K


left = -1
right = 10 ** 12 + 1
while right > left + 1:
    mid = (right + left) // 2
    if C(mid):  # 食べきれる場合
        right = mid
    else:
        left = mid

ans = right
print(ans)
### BUGGY CODE ###

import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
for j in range(N):
    if (A[j] != max(A)):
        print(max(A))
    else:
        J = copy.deepcopy(A)
        del J[j]
        print(max(J))

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
maxA = max(A)
secondA = sorted(A)[-2]
for j in range(N):
    if (A[j] != maxA):
        print(maxA)
    else:
        print(secondA)
### BUGGY CODE ###


def main():
    data = input()
    ans = 0
    while 'ABC' in data:
        ans += data.count('ABC')
        data = data.replace('ABC', 'BCA')

    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###


def main():
    data = input()
    data = data.replace('BC', 'D')
    count_a = 0
    ans = 0
    for i in range(len(data)):
        now_str = data[i]
        if now_str == 'A':
            count_a += 1
        elif now_str == 'D':
            ans += count_a
        else:
            count_a = 0

    print(ans)

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

INF = 1001001001

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

fuel = [[INF] * N for _ in range(N)]
for i in range(M):
    A, B, C = map(int, input().split())
    A -= 1
    B -= 1
    fuel[A][B] = C
    fuel[B][A] = C
for i in range(N):
    fuel[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            fuel[i][j] = min(fuel[i][j], fuel[i][k] + fuel[k][j])

dist = [[INF] * N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i == j:
            dist[i][j] = 0
        elif fuel[i][j] <= L:
            dist[i][j] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

Q = int(input())
for i in range(Q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    if dist[s][t] == INF:
        print(-1)
    else:
        print(dist[s][t] - 1)


### FIXED CODE ###

INF = 1001001001

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

fuel = [[INF] * N for _ in range(N)]
for i in range(M):
    A, B, C = map(int, input().split())
    A -= 1
    B -= 1
    fuel[A][B] = C
    fuel[B][A] = C
for i in range(N):
    fuel[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            fuel[i][j] = min(fuel[i][j], fuel[i][k] + fuel[k][j])

dist = [[INF] * N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i == j:
            dist[i][j] = 0
        elif fuel[i][j] <= L:
            dist[i][j] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

Q = int(input())
for i in range(Q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    if dist[s][t] == INF:
        print(-1)
    else:
        print(dist[s][t] - 1)
### BUGGY CODE ###

from scipy.special import comb
S=input()
N=len(S)
mod=[0 for i in range(2019)]
for i in range(N):
  s=S[i:N+1]
  mod2=int(s)%2019
  mod[mod2]+=1
ans=0
for i in range(2019):
  k=mod[i]
  if i==0:
    if k>=2:
      ans+=comb(k,2)+k
    else:
      ans+=k
  else:
    if k>=2:
      ans+=comb(k,2)
print(int(ans))      

### FIXED CODE ###

import numpy as np
S=input()
N=len(S)
mod=[0 for i in range(2019)]
mod2=0
ten=1
for i in range(N-1,-1,-1): 
  s=int(S[i])*ten
  mod2+=np.mod(s,2019)
  mod2=np.mod(mod2,2019)
  mod[mod2]+=1
  ten=(ten*10)%2019
ans=0
for i in range(2019):
  k=mod[i]
  if i==0:
    if k>=2:
      ans+=k*(k-1)//2+k
    else:
      ans+=k
  else:
    if k>=2:
      ans+=k*(k-1)//2
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
from collections import Counter
N = int(input()) 
A = Counter(map(int, input().split()))
Q = int(input())
for i in range(Q):
    sum = 0
    b, c = map(int, input().split())
    if A[b] != 0:
        A[c] += A[b]
        A[b] = 0
    for n in A:
        sum += A[n] * n
    print(sum)

### FIXED CODE ###

#!/usr/bin/env python3
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
d = Counter(A)
Q = int(input())
ans = sum(A)
for i in range(Q):
    b, c = map(int, input().split())
    ans += (c-b) * d[b]
    d[c] += d[b]
    d[b] = 0
    print(ans)
### BUGGY CODE ###

n = int(input())
a_list = []
for i in range(n):
	a_list.append(int(input()))
r = -1
num = 1
nums = [1]
count = 0
while True:
	num = a_list[num-1]
	count += 1
	if num in nums:
		break
	if num == 2:
		r = count
		break
	nums.append(num)
print(r)

### FIXED CODE ###

n = int(input())
a_list = []
for i in range(n):
	a_list.append(int(input()))
r = -1
num = 1
count = 0
while True:
	num = a_list[num-1]
	count += 1
	if num == 2:
		r = count
		break
	if count == n:
		break
print(r)
### BUGGY CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for _ in range(n)]
for i in range(1, n):
    m = float('inf')
    for j in range(1, k + 1):
        if 0 <= i - j <= n:
            m = min(m, dp[i - j] + abs(h[i - j] - h[i]))
    dp[i] = m
print(dp[n - 1])

### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0 for _ in range(n)]
for i in range(1, n):
    arr = []
    for j in range(1, k + 1):
        if 0 <= i - j <= n:
            arr.append(dp[i - j] + abs(h[i - j] - h[i]))
    dp[i] = min(arr)
print(dp[n - 1])
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]

A_set = set(A)

def cmb2(n):
	result = n * (n - 1) / 2

	return int(result)

ans_d = {}
for a_s in A_set:
	#print(A.count(a))
	ans_d[str(a_s)] = A.count(a_s)

for a in A:
    #A_new = ans_d.copy()
    ans_d[str(a)] -= 1
    ans = 0
    #print(A_new)
    #print("="*10)
    for a_n in ans_d.values():
        if a_n <= 1:
            continue
        else:
            ans += cmb2(a_n)
    print(ans)
    ans_d[str(a)] += 1

### FIXED CODE ###

import sys
from collections import Counter

def cmb2(n):
	if n < 2:
		return 0

	return n * (n-1) // 2

if __name__ == "__main__":

	N = int(input())
	A = [int(i) for i in input().split()]
	# A = list(map(int, input().split()))

	c = Counter(A)
	s = 0
	for v in c.values():
		s += cmb2(v)

	for a in A:
		print(s - cmb2(c[a]) + cmb2(c[a] - 1))
### BUGGY CODE ###

from collections import Counter
S = input()
mod = 2019
p = [0] * len(S)
r = 0
for i,s in enumerate(S[::-1]):
  t = int(s)%mod
  t *= (10**i)%mod
  r += t
  p[i] = r%mod

p.append(0)
ans = 0
c = Counter(p)
for k in c:
  if c[k] > 1:
    ans += 1
print(ans)

### FIXED CODE ###

S = input()
S = S + '0'
mod = 2019
p = [0] * mod
r = 0
d = 1
for s in reversed(S):
  t = int(s)%mod
  r += t*d
  r %= mod
  d = d*10%mod
  p[r] += 1

print(sum([i*(i-1)//2 for i in p]))
### BUGGY CODE ###

import heapq
from collections import defaultdict
import sys

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

n, m, s = map(int, input().split())

connect = defaultdict(list)
for i in range(m):
    u, v, a, b = map(int, input().split())
    connect[u].append((v, a, b))
    connect[v].append((u, a, b))

c, d = [-1], [-1]
for i in range(n):
    c_, d_ = map(int, input().split())
    c.append(c_)
    d.append(d_)

ans = [-1] * (n+1)
dp = [{} for _ in range(n+1)]

h = [(0, s, 1)]
heapq.heapify(h)

while heapq:
    t, coin, city = heapq.heappop(h)

    if ans[city] == -1:
        ans[city] = t
        if all([v >= 0 for v in ans[2:]]):
            break

    if coin not in dp[city]:
        dp[city][coin] = t
    else:
        continue

    for neighbor, a, b in connect[city]:
        if coin - a >= 0 and neighbor != city:
            if coin-a not in dp[neighbor]:
                heapq.heappush(h, (t+b, coin-a, neighbor))

    if coin+c[city] not in dp[city]:
        heapq.heappush(h, (t+d[city], coin+c[city], city))

print('\n'.join(map(str, ans[2:])))

### FIXED CODE ###

import heapq
from collections import defaultdict
import sys

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

n, m, s = map(int, input().split())

connect = defaultdict(list)
for i in range(m):
    u, v, a, b = map(int, input().split())
    connect[u].append((v, a, b))
    connect[v].append((u, a, b))

c, d = [-1], [-1]
for i in range(n):
    c_, d_ = map(int, input().split())
    c.append(c_)
    d.append(d_)

ans = [-1] * (n+1)
dp = [{} for _ in range(n+1)]
coin_max = [-1] * (n+1)

h = [(0, s, 1)]
heapq.heapify(h)

while heapq:
    t, coin, city = heapq.heappop(h)

    if ans[city] == -1:
        ans[city] = t
        if all([v >= 0 for v in ans[2:]]):
            break

    if coin not in dp[city]:
        dp[city][coin] = t
    else:
        continue

    if coin_max[city] >= coin:
        continue
    else:
        coin_max[city] = coin

    for neighbor, a, b in connect[city]:
        if coin - a >= 0 and neighbor != city:
            if coin-a not in dp[neighbor]:
                heapq.heappush(h, (t+b, coin-a, neighbor))

    if coin+c[city] not in dp[city]:
        heapq.heappush(h, (t+d[city], coin+c[city], city))

print('\n'.join(map(str, ans[2:])))
### BUGGY CODE ###

def f(s):
    cnt = 0
    n = len(s)
    for i in range(n-1):
        if s[i] == "B" and s[i+1] == "W":
            s[i] = "W"
            s[i+1] = "B"
            cnt += 1
    return cnt

s = list(input())
ans = 0
while True:
    tmp = f(s)
    ans += tmp
    if tmp == 0:
        break
print(ans)

### FIXED CODE ###

def f(s):
    ret = 0
    n = len(s)
    for i in range(n):
        if s[i] == "W":
            ret += i
    return ret

s = list(input())
nW = s.count("W")
ans = 0
ans += f(s)
for i in range(1, nW):
    ans -= i
print(ans)

"""
BWBWBW
WBWBWB
WWBWBB
WWWBBB

先頭までの距離（i）- 何番目のWか+1
ni - 1~nW +1
"""
### BUGGY CODE ###

import bisect

N = int(input())

A = [int(input()) for _ in range(N)]

colors = []

for i in range(N):
    target = bisect.bisect_left(colors, A[i])

    if target == 0:
        colors.insert(0, A[i])
    else:
        colors[target-1] = A[i]

print(len(colors))


### FIXED CODE ###

import bisect

N = int(input())

A = [int(input()) for _ in range(N)]

colors = []

for i in range(N-1, -1, -1):
    target = bisect.bisect_right(colors, A[i])

    if target == len(colors):
        colors.append(A[i])
    else:
        colors[target] = A[i]

print(len(colors))
### BUGGY CODE ###

a, b, n = map(int, input().split())
Max = 0
for i in range(n):
  i += 1
  Max = max(Max, a*i//b-a*(i//b))
  if Max != a*i//b-a*(i//b):
    print(Max)
    break
else:
  print(Max)

### FIXED CODE ###

a, b, n = map(int, input().split())
x = min(b-1, n)
print(int(a*(x)/b)-a*int(x/b))
### BUGGY CODE ###

def primes(n,default=2):
    if n<3:return []
    sievebd=n//2-1
    sieve=[True]*sievebd
    limit=(int((n-1)**.5)-1)//2
    for i in range(limit):
        if sieve[i]:
            for j in range(2*i**2+6*i+3,sievebd,2*i+3):
                sieve[j]=False
    return [2]*(default==2)+[2*i+3 for i in range(default//2-1,sievebd) if sieve[i]]
def isprime(n):
    if n==1:
        return False
    elif n<4:
        return True
    elif n%2==0:
        return False
    elif n<9:
        return True
    elif n%3==0:
        return False
    else:
        r=int(n**.5)
        f=5
        while f<=r:
            if n%f==0:
                return False
            if n%(f+2)==0:
                return False
            f+=6
    return True
q=int(input())
l=[0]*q
r=[0]*q
for i in range(q):
    l[i],r[i]=map(int,input().split())
list=[]
for x in primes(max(r)+1,min(l)):
    if isprime((x+1)//2):
        list.append(x)
for i in range(q):
    c=0
    for x in list:
        if l[i]<=x<=r[i]:c+=1
    print(c)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n=10**5
sievebd=n//2
sieve=[True]*sievebd
limit=int(n**.5)//2
sieve[0]=0
for i in range(limit):
    if sieve[i]:
        for j in range(2*i*(i+1),sievebd,2*i+1):
            sieve[j]=False
for i in range((sievebd-1)//2,0,-1):
    if not sieve[i]:sieve[2*i]=False
for i in range(3,sievebd,2):sieve[i]=False
for i in range(1,sievebd):sieve[i]+=sieve[i-1]
q=int(input())
l=[list(map(int,input().split())) for _ in [0]*q]
for i in range(q):
    print(sieve[(l[i][1]-1)//2]-sieve[max(0,(l[i][0]-1)//2-1)])
### BUGGY CODE ###

N=int(input())

ball=list(map(int,input().split()))

num=[0]*(N+1) #それぞれの数の個数

cnb=[-1]*(N+1) #それぞれの球を抜いた時のコンビネーション

for i in range(len(ball)):
  num[ball[i]]+=1


for j in ball:
  
  if cnb[j]==-1:
    cnb[j]=0
    num[j]-=1

    for k in range(1,len(num)):
      n=num[k]
      if n>=2:
        cnb[j]+=int(n*(n-1)/2)

    print(cnb[j])
    num[j]+=1
  else:
    print(cnb[j])

### FIXED CODE ###

N=int(input())

ball=list(map(int,input().split()))

num=[0]*(N+1) #それぞれの数の個数

cnb=[-1]*(N+1) #それぞれの球を抜いた時のコンビネーション

for i in range(len(ball)):
  num[ball[i]]+=1


allcnb=0
for i in num:
  if i>=2:
    allcnb+=int(i*(i-1)/2)

for i in ball:
  cnb=0

  if num[i]>=2:
    cnb=num[i]-1

  print(allcnb-cnb)
### BUGGY CODE ###

import numpy as np

def main():
    N, X = map(int, input().split())
    x = np.asarray(list(map(int, input().split())))
    x = np.absolute(x - X)
    m = np.min(x)
    for n in range(m, 0, -1):
        if x[x%n != 0].size == 0:
            print(n)
            return 0

if __name__ == '__main__':
    main()

### FIXED CODE ###


import numpy as np
import fractions

def main():
    N, X = map(int, input().split())
    x = np.asarray(list(map(int, input().split())))
    x = np.absolute(x - X)
    if N > 1:
        l = None
        for i, n in enumerate(x):
            if i == 0:
                l = n
            else:
                l = fractions.gcd(l, n)
        print(l)
    else:
        print(x[0])


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

H,W = map(int,input().split())
S = [0]*H
for i in range(H):
    S[i] = list(input())

def aaa(s):
    i = 0
    l = len(s)
    o = []
    while True:
        if i == l:
            break
        if s[i] == ".":
            n = 0
            while i < l and s[i] == '.':
                i += 1
                n += 1
            o += [n] * n
        else:
            o += [0]
            i += 1
    return o

Hor = [0]*H
y = 0
while y != H:
    Hor[y] = aaa(S[y])
    y += 1

Ver = [0]*W
x = 0
while x != W:
    _ = 0
    s = [0] * H
    while _ != H:
        s[_] = S[_][x]
        _ += 1
    Ver[x] = aaa(s)
    x += 1

ans = 1
x = 0
while x != W:
    y = 0
    while y != H:
        h = Hor[y][x]
        if h:
            v = Ver[x][y]
            ans = max(ans,h+v-1)
        y += 1
    x += 1

print(ans)

### FIXED CODE ###

H,W = map(int,input().split())
S = [0]*H
for i in range(H):
    S[i] = list(input())

def aaa(s):
    i = 0
    l = len(s)
    o = []
    while True:
        if i == l:
            break
        if s[i] == ".":
            n = 0
            while i < l and s[i] == '.':
                i += 1
                n += 1
            o += [n] * n
        else:
            o += [0]
            i += 1
    return o

Hor = [0]*H
y = 0
while y != H:
    Hor[y] = aaa(S[y])
    y += 1

Ver = [0]*W
x = 0
while x != W:
    _ = 0
    s = [0] * H
    while _ != H:
        s[_] = S[_][x]
        _ += 1
    Ver[x] = aaa(s)
    x += 1

ans = 1
x = 0
while x != W:
    y = 0
    while y != H:
        h = Hor[y][x]
        if h:
            v = Ver[x][y]
            ans = max(ans,h+v-1)
        y += 1
    x += 1

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

import sys
sa=input()
sb=input()
sc=input()
ss={'a':sa,'b':sb,'c':sc}
t='a'
while True:
  t=ss[t][0]
  if len(ss[t])==0:
    print(t.upper())
    sys.exit()
  elif len(ss[t])==1:
    ss[t]==''
  else:
    ss[t]=ss[t][1:]


### FIXED CODE ###

s={i:list(input())for i in'abc'}
i='a'
while s[i]:i=s[i].pop(0)
print(i.upper())
### BUGGY CODE ###

#n=int(input())
l,r=map(int,input().split())
#t=int(input())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

if l-r>=2019:
    mn=0
else:
    mn=(l*r)%2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            mn=min(mn,(i*j)%2019)
print(mn)


### FIXED CODE ###

l,r=map(int,input().split())
temp=[]
if r-l>=2019:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            temp.append((i*j)%2019)
    print(min(temp))
### BUGGY CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split()))
    set_A = sorted(set(A), reverse=True)

    max_num = 0

    for a in set_A:
        if A.count(a) >= 2:
            if max_num == 0:
                max_num = a
                if A.count(a) >= 4:
                    print(a * a)
                    exit()
            else:
                print(max_num * a)
                exit()

    print(0)

main()

### FIXED CODE ###

import collections

def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    B = collections.Counter(A)

    c = []

    for k, v in B.items():
        if v >= 2:
            c.append(k)
        if v >= 4:
            c.append(k)
    if len(c) < 2:
        print(0)
    else:
        c.sort()
        print(c[-1] * c[-2])

main()
### BUGGY CODE ###

x=int(input())
li=[2]
p=2
i=0
prime=False
if x==2:
    print(2)
else:
    while p<x or prime==False:
        prime=True
        p+=1
        for i in range(len(li)):
            if p%li[i]==0:
                prime=False
        if prime:
            li.append(p)
   
    print(max(li))
    


### FIXED CODE ###

x=int(input())
p=x-1
prime=False
if x==2:
    print(2)
else:
    while prime==False:
        p+=1
        prime=True
        
        for i in range(2,p-1):
            if p%i==0:
                prime=False
        
        
   
    print(p)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1<<20)
h,w=[int(x) for x in input().split()]
ch,cw=[int(x) for x in input().split()]
dh,dw=[int(x) for x in input().split()]
ch-=1
cw-=1
dh-=1
dw-=1

s=[]
for _ in range(h):
    s.append(list(input()))

nxt=[[ch,cw,0]]
#再起
def rcl(y,x,now):
    
    if y==dh and x==dw:
        print(now)
        exit()
    
    if s[y][x]=='#':
        return
    
    s[y][x]='#'
    # 四方を見る
    for i in range(4):
        yy,xx=-1,0
        if i==1:yy,xx=0,1
        if i==2:yy,xx=1,0
        if i==3:yy,xx=0,-1
        
        if y+yy<0 or h<=y+yy or x+xx<0 or w<=x+xx:
            continue
        if s[y+yy][x+xx]=='#':
            continue
        
        rcl(y+yy,x+xx,now)
    #5*5
    for i in range(-2,3):
        for j in range(-2,3):
            if i==0 and j==0:
                continue
            if y+i<0 or h<=y+i or x+j<0 or w<=x+j:
                continue
            if s[y+i][x+j]=='.':
                nxt.append([y+i,x+j,now+1])
                s[y+i][x+j]=now+1


idx=0
while idx<len(nxt):
    i=nxt[idx]
    idx+=1
    if i[0]==dh and i[1]==dw:
        print(i[2])
        exit()
    rcl(i[0],i[1],i[2])
print(-1)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1<<20)
h,w=[int(x) for x in input().split()]
ch,cw=[int(x) for x in input().split()]
dh,dw=[int(x) for x in input().split()]
ch-=1
cw-=1
dh-=1
dw-=1

s=[]
for _ in range(h):
    s.append(list(input()))

nxt=[[ch,cw,0]]
#再起
def rcl(y,x,now):
    
    if y==dh and x==dw:
        print(now)
        exit()
    
    if s[y][x]=='#':
        return
    
    s[y][x]='#'
    # 四方を見る
    for i in range(4):
        yy,xx=-1,0
        if i==1:yy,xx=0,1
        if i==2:yy,xx=1,0
        if i==3:yy,xx=0,-1
        
        if y+yy<0 or h<=y+yy or x+xx<0 or w<=x+xx:
            continue
        if s[y+yy][x+xx]=='#':
            continue
        
        rcl(y+yy,x+xx,now)
    #5*5
    for i in range(-2,3):
        for j in range(-2,3):
            if i==0 and j==0:
                continue
            if y+i<0 or h<=y+i or x+j<0 or w<=x+j:
                continue
            if s[y+i][x+j]=='.':
                nxt.append([y+i,x+j,now+1])
                s[y+i][x+j]=now+1


while nxt:
    i=nxt.pop(0)
    if i[0]==dh and i[1]==dw:
        print(i[2])
        exit()
    rcl(i[0],i[1],i[2])
print(-1)