Harryxun/stf_run huggingface dataset:
from collections import deque
n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
norm=defaultdict(list)
for i in range(11):
  if i==0:
    norm[1]=['a']
  else:
    for char in norm[i-1]:
      last=char[-1]
      range_digit=al.index(last)+2
      for s in al[0:range_digit]:
        norm[i].append(char+s)

for char in norm[n]:
  print(char)

### FIXED CODE ###

from collections import defaultdict
n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
norm=defaultdict(list)
def max_al(s):
  tmp=0
  for i in range(len(s)):
    tmp2=al.index(s[i])
    tmp=max(tmp,tmp2)
  return tmp

for i in range(11):
  if i==0:
    norm[1]=['a']
  else:
    for char in norm[i-1]:
      range_digit=max_al(char)+2
      for s in al[0:range_digit]:
        norm[i].append(char+s)

for char in norm[n]:
  print(char)
n = int(input())
arr = [int(i) for i in input().split()]

for d in arr :
  
  if d % 2 == 0 :
    
    if d % 3 == 0 :

      pass
    
    elif d % 5 = 0 : 
      pass
    
    else :

      print("DENIED")
      exit()
      
print("APPROVED")

### FIXED CODE ###

n = int(input())
arr = [int(i) for i in input().split()]

for d in arr :
  
  if d % 2 == 0 :
    
    if d % 3 == 0 or d % 5 == 0:

      pass
    
    else :

      print("DENIED")
      exit()
      
print("APPROVED")
list = []
i = int(input())
if i%3 != 0 or i%5 != 0:
  list.add(i)
print(sum(list))

### FIXED CODE ###

list = []
i = int(input())
for j in range(1,i+1):
    if j%3 == 0 or j%5 == 0:
        list.append(0)
    else:
        list.append(j)
print(sum(list))
def counting (l,s):
  for i in range(len(l)):
    A.append(l.count(l[i])-s.count(l[i]))
N=int(input())
L=[input() for i in range(N)]
M=int(input())
S=[input() for i in range(M)]
A=[0]
counting(L,S)
print(max(A))

### FIXED CODE ###

a,b,c=(int(i) for i in input().split())
if a+b>=c:
  print('Yes')
else:
  print('No')
n,w=list(map(int, input().split()))
wv=[list(map(int, input().split())) for _ in range(n)]

dp = [[0 for _ in range(w+1)] for _ in range(n+1)]
dp[0][0] = 0

for i in range(n):
    for j in range(w+1):
        if j >= wv[i][0]:
            dp[i + 1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1])
        else:
            dp[i+1][j] = dp[i][j]

print(max(dp[-1][-1]))


### FIXED CODE ###

n,w = list(map(int, input().split()))
wv = [list(map(int, input().split())) for _ in range(n)]

v = sum(list(map(lambda x: x[1], wv)))
dp = [[float("inf")]*(v+1) for _ in range(n+1)]
dp[0][0] = 0

for i in range(n):
    a = wv[i]
    for j in range(v+1):
        if a[1] <= j:
            dp[i+1][j] = min(dp[i][j], dp[i][j- a[1]] + a[0])
        else:
            dp[i+1][j] = dp[i][j]

dpl = dp[-1]
for i in range(v, -1, -1):
    if dpl[i] <= w:
        print(i)
        break
import numpy

n = input()
x = input()
t = input()

print((n//x+1)*t)

### FIXED CODE ###

import math

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

print(math.ceil(N / x) * T)
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p)
q=sorted(q)
r=sorted(r)
p=p[(a-x):]
q=q[(b-y):]
res=sum(p)+sum(q)
tp=0
tq=0
tr=c-1
while(p[tp]<r[tr] or q[tq]<r[tr]):
  if(p[tp]<q[tq]):
    res+=r[tr]-p[tp]
    tp-=1
  else:
    res+=r[tr]-q[tq]
    tq-=1
  tr-=1
print(res)
    



### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p)
q=sorted(q)
r=sorted(r)
p=p[(a-x):]
q=q[(b-y):]
res=sum(p)+sum(q)
tp=0
tq=0
tr=c-1
while 1:
  if(tr<0 ):
    break
  if(tp>=x):
    pp=100000000000
  else:
    pp=p[tp]
  if(tq>=y):
    qq=100000000000
  else:
    qq=q[tq]

  if(pp>r[tr] and qq>r[tr]):
    break
  if(pp<qq ):
    res+=r[tr]-pp
    tp+=1
  else:
    res+=r[tr]-qq
    tq+=1
  tr-=1
print(res)
import copy

def main():
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)

    def lcm(a, b):
        return int(a / gcd(a, b)) * b
    
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    A_ = copy.deepcopy(A)
    a_ = A.pop()
    if len(A) >= 1:
        for a in A:
            a_lcm = lcm(a_, a)
            a_ = a_lcm
    else:
        a_lcm = a_ 
    for i in A_:
        if a_lcm / 2 % i != 0:
            continue
        else:
            print(0)
            exit()
    if a_lcm / 2 > m:
        print(0)     
    else:
        ans = int((m - (a_lcm / 2))) // a_lcm + 1
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
N = int(input())
all1 = True
goukei = 0
existodd = False
for i in range(N):
    tmp = int(input())
    if tmp != 1:
        all1 = False
    if tmo % 2 == 1:
        existodd = True
    goukei += tmp
    
    
if(goukei%2==1 or all1 or existodd):
    print("first")
else:
    print("second")

### FIXED CODE ###

N = int(input())
all1 = True
goukei = 0
existodd = False
for i in range(N):
    tmp = int(input())
    if tmp != 1:
        all1 = False
    if tmp % 2 == 1:
        existodd = True
    goukei += tmp
    
    
if(goukei%2==1 or all1 or existodd):
    print("first")
else:
    print("second")
X,Y,A,B,C=map(int,input().split())
P=sorted([int(x) for x in input().split()])
Q=sorted([int(x) for x in input().split()])
R=sorted([int(x) for x in input().split()],reverse=True)

p=A-X
q=B-Y

ans=0

for item in R:

	if item > P[p] and p<A:
		ans+=item
		p+=1
	elif item > Q[q] and q<B:
		ans+=item
		q+=1

print(ans+sum(P[p:])+sum(Q[q:]))


### FIXED CODE ###

X,Y,A,B,C=map(int,input().split())
P=sorted([int(x) for x in input().split()])
Q=sorted([int(x) for x in input().split()])
R=sorted([int(x) for x in input().split()],reverse=True)

p=A-X
q=B-Y

final=sorted(P[p:]+Q[q:])

ans=sum(final)

i=0

for item in R:
	if item > final[i]:
		ans-=final[i]
		ans+=item
		i+=1

print(ans)
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
for i in range(m):
    a[0] = a[0]//2
    if a[0]<a[1]:
        a.sort(reverse=True)
print(sum(a))

### FIXED CODE ###

import heapq

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

a = [-i for i in list(map(int, input().split()))]
heapq.heapify(a)

for i in range(m):
    p = heapq.heappop(a)
    p = (-p)//2
    heapq.heappush(a, -p)
    
print(-sum(a))
def main(A, B, C, X):
    # type: (int, int, int, int) -> None
    coins = [
        (a,b,c)
        for a in range(A)
        for b in range(B)
        for c in range(C)
        if 500*a + 100*b + 50*c == X
    ] # type: List[Tuple[int, int, int]]
    print(len(coins))

if __name__ == '__main__':
    A,B,C,X,*_ = list(map(int, input().split()))
    main(A,B,C,X)


### FIXED CODE ###

def main(A, B, C, X):
    # type: (int, int, int, int) -> None
    coins = [
        (a,b,c)
        for a in range(0,A+1)
        for b in range(0,B+1)
        for c in range(0,C+1)
        if 500*a + 100*b + 50*c == X
    ] # type: List[Tuple[int, int, int]]
    print(len(coins))

if __name__ == '__main__':
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    main(A,B,C,X)
N = int(input())
A = list(map(int,input().split()))
a = 0
b = 0
A.sort(reverse=True)
for i in range(0,N,2):
    a = a + A[i]
    if i+1<=N:
        b = b + A[i+1]
print(a-b)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
a = 0
b = 0
A.sort(reverse=True)
for i in range(N):
    if i%2 == 0:
        a = a + A[i]
    if i%2 == 1:
        b = b + A[i]
print(a-b)
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


s = list(input())
if list(s.sort()) == ['a','b','c']:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper


s = list(input())
s.sort()
if s == list('abc'):
    print('Yes')
else:
    print('No')
N=list(map(int,input().split()))
A=list(map(int,input().split()))
A=list(set(A))
A.sort()
 
ans=[]
for a in A:
    for ans_idx in range(len(ans)+1):
        if ans_idx == len(ans):
            ans.append(a)
            ans_.append(a)
            break
            
        ans_temp=ans[ans_idx]
        if a % ans_temp == 0:
            break
        
print(len(ans))

### FIXED CODE ###

# %%time
# from collections import Counter

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

# A=list(range(2,10**6))

# counter = Counter(A)

A.sort()
max=A[-1]
dp=[0]*(max+1)

for i in A:
    if dp[i]!=0:
        dp[i]+=1
        continue
    for j in range(1*i,max+1,i):
        dp[j]+=1
        
ans=[]
for a_idx,a in enumerate(A):
    if dp[a] == 1:
        ans.append(a)
        
print(len(ans))
n, k = map( int, input().split() )
mod = 10 ** 9 + 7
 
numer = [ 1 ] * ( n + 1 )
demon = [ 1 ] * ( n + 1 )
 
for i in range( 1, n + 1 ):
  numer[ i ] = numer[ i - 1 ] * i % mod

demon[ n ] = pow( numer[ n ], mod - 2, mod )
for i in range( n, 0, -1 ):
  demon[ i + 1 ] = ( demon[ i - 1 ] * i ) % mod

def nCr( n, r ):
  if r < 1:
    return 1
  return ( numer[ n ] * demon[ r ] % mod ) * demon[ n - r ] % mod
 
ans = 0
for i in range( max( k, n - 1) + 1 ):
  ans = ans + nCr( n, i ) * nCr( n - 1, i - 1 )
print( ans )

### FIXED CODE ###

n, k = map( int, input().split() )
mod = 10 ** 9 + 7
 
numer = [ 1 ] * ( n + 1 )
demon = [ 1 ] * ( n + 1 )
 
for i in range( 1, n + 1 ):
  numer[ i ] = numer[ i - 1 ] * i % mod

demon[ n ] = pow( numer[ n ], mod - 2, mod )
for i in range( n, 0, -1 ):
  demon[ i - 1 ] = ( demon[ i ] * i ) % mod

def nCr( n, r ):
  if r < 1:
    return 1
  return ( numer[ n ] * demon[ r ] % mod ) * demon[ n - r ] % mod
 
ans = 0
for i in range( min( k, n - 1) + 1 ):
  ans = ( ans + nCr( n, i ) * nCr( n - 1, i )) % mod
print( ans )
a=input().split()
N=int(a[0])
K=int(a[1])
if K > (N-1)*(N-2)/2　:
  print(-1)
else:
  p = (N-1)*(N-2)/2 - K
  for i in range(2,N+1):
    print(1,i)
  for i in range(2,N):
    i = N + 1 - i
    if p >= (i+1)(N-2-i/2):
      q = p - (i+1)(N-2-i/2)
      for j in range(2,i+3):
        for k in range(j+1,N+1):
          print(j,k)
      l = i
      break
  if q > 0:
    for i in range(1,q):
      print(l+3,l+3+i)
        

### FIXED CODE ###

n,k = map(int,input().split())
if k > (n-1)*(n-2)/2:
  print(-1)
else:
  p = (n-1)*(n-2)/2 - k
  print(n-1+int(p))
  for i in range(2,n+1):
    print(1,i)
  x = 2
  y = 3
  for _ in range(int(p)):
    print(x,y)
    y = y + 1
    if y == n + 1:
      x = x + 1
      y = x + 1
import math
 
N, M = map(int, input().split())
a = []
for i in range(M):
  a.append(int(input()))
  
answer = 0
for i in range(len(a) - 1):
  dif = a[i + 1] - a[i]
  if dif >= 4:
    b = dif // 2
    tmp_sum = 0
    for j in range(b):
      tmp_sum += math.factorial(j + dif - j * 2) / (math.factorial(j) * math.factorial(dif - j * 2))
    if tmp_sum != 0 and answer = 1:
      answer += 1
    answer *= tmp_sum
    
print(answer)

### FIXED CODE ###

import math
 
N, M = list(map(int, input().split()))
stairs = [0] * (N + 1)

for i in range(M):
	stairs[int(input())] = -1

# all element of stairs
for i in range(N, -1, -1):
	# last is always 1
	if i == N:
		stairs[i] = 1
	# if stair[N - 1] is not broken 
	elif i == N - 1 and stairs[i] != -1:
		stairs[i] = stairs[i + 1]
	# if stairs[i] is not broken
	elif stairs[i] != -1:
		if stairs[i + 1] != -1:
			stairs[i] += stairs[i + 1]
		if stairs[i + 2] != -1:
			stairs[i] += stairs[i + 2]
print(int(stairs[0]) % 1000000007)
while(1):
  a,b = map(int, raw_input().split())
  op = raw_input().split()

  if op == "+":
    print (a+b)
  elif op == "-":
    print (a-b)
  elif op == "*":
    print (a*b)
  elif op == "/":
    print (a/b)
  elif op == "?":
    break

### FIXED CODE ###

while(1):
  a,op,b = raw_input().split()
  a = int(a)
  b = int(b)
  if op == "+":
    print (a+b)
  elif op == "-":
    print (a-b)
  elif op == "*":
    print (a*b)
  elif op == "/":
    print (a/b)
  elif op == "?":
    break
n,k = map(int,input().split())

print(k*((k-1)**(n-1))


### FIXED CODE ###

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

print(k*((k-1)**(n-1)))
n = input()
ans = “”
for a in n:
  if a == “1”:
    ans  = ans + “9”
  else:
    ans = ans + “1”
print(ans)


### FIXED CODE ###

n = input()
ans = ''
for a in n:
  if a == '1':
    ans  = ans + '9'
  else:
    ans = ans + '1'
print(ans)
import sys, math, collections, heapq, itertools
from bisect import bisect_left
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N = int(file())
    A = [int(a) for a in file().split()]
    A.sort()
    ans = 0
    out = []
    if N == 2:
        ans = A[1] - A[0]
        out = [A[1], A[0]]
    elif A[N-1] <= 0:
        ans = A[N-1] - A[N-2]
        out.append([A[N-1], A[N-2]])
        for i in range(N-2):
            out.append([ans, A[i]])
            ans -= A[i]
    elif A[0] >= 0:
        ans = A[0] - A[1]
        out.append([A[0], A[1]])
        for i in range(2, N-1):
            out.append([ans, A[i]])
        out.append([A[N-1], ans])
        ans = A[N-1] - ans
    else:
        start = bisect_left(A, 0)
        start -= 1
        ans = A[start] - A[start + 1]
        out.append([A[start], A[start + 1]])
        if start + 2 < N - 1:
            for i in range(start + 2, N - 1):
                out.append([ans, A[i]])
                ans -= A[i]
        out.append([A[N-1], ans])
        ans = A[N-1] - ans
        if start > 0:
            for i in range(start):
                out.append([ans, A[i]])
                ans -= A[i]

    print(ans)
    for k in out:
        print(" ".join(map(str, k)))

    return 0
  
if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys, math, collections, heapq, itertools
from bisect import bisect_left
  
def solve():
    file = sys.stdin.readline #single: int(file()), line: map(int, file().split())
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N = int(file())
    A = [int(a) for a in file().split()]
    A.sort()
    ans = 0
    out = []
    if N == 2:
        ans = A[1] - A[0]
        out = [[A[1], A[0]]]
    else:
        plus = bisect_left(A, 0)
        if plus == 0:
            ans = A[0]
            for i in range(1, N-1):
                out.append([ans, A[i]])
                ans -= A[i]
            out.append([A[N-1], ans])
            ans = A[N-1] - ans
        elif plus < N:
            ans = A[0]
            for i in range(plus, N - 1):
                out.append([ans, A[i]])
                ans -= A[i]
            out.append([A[N-1], ans])
            ans = A[N-1] - ans
            for i in range(1, plus):
                out.append([ans, A[i]])
                ans -= A[i]
        else:
            ans = A[N-1]
            for i in range(N-1):
                out.append([ans, A[i]])
                ans -= A[i]

    print(ans)
    for k in out:
        print(" ".join(map(str, k)))


    return 0
  
if __name__ == "__main__":
    solve()
X = input()
num500=X//500
num5=(X%500)//5
print (1000*num500+5*num5)

### FIXED CODE ###

X = int(input())
num500=X//500
num5=(X%500)//5
print (1000*num500+5*num5)
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def gcd_l(l):
    if len(l) == 1:
        return l[0]
    elif len(l) == 2:
        return gcd(l[0], l[1])
    else:
        return gcd(gcd_l(l[:-1]), l[-1])

gcd_max = 1
for i in range(n):
    i_gcd = gcd_l(a[:i]+a[i+1:])
    if i_gcd > gcd_max:
        gcd_max = i_gcd

print(gcd_max)


### FIXED CODE ###

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

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

l = [0]
r = [0]
for i in range(n):
    l.append(gcd(l[i], a[i]))
    r.append(gcd(r[i], a[n-i-1]))

r = r[::-1]

ans = 0
for i in range(n):
    g = gcd(l[i], r[i+1])
    ans = max(ans, g)

print(ans)
# -*- coding: utf-8 -*-
N,M = map(int,input().split())
a,b = map(list,input() for i in range(M))
for i in range(N):
  print(a.count(i) + b.count(i))

### FIXED CODE ###

N,M = map(int,input().split())
A = [(list(map(int,input().split()))) for i in range(M)]
L = []
for i in range(M):
    L.append(A[i][0])
    L.append(A[i][1])
for i in range(1,N+1):
    print(L.count(i))
N,K = map(int,input().split())

if N>=K:
    x = N%K
    print(min(x,abs(K-x))
else:
    print(min(N,abs(K-N))

### FIXED CODE ###

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

if N>=K:
    x = N%K
    print(min(x,abs(K-x)))
else:
    print(min(N,abs(K-N)))
for i in range(1,10):
for j in range(1,10):
print(i * j)
     



### FIXED CODE ###

print ("1x1=1")
print ("1x2=2")
print ("1x3=3")
print ("1x4=4")
print ("1x5=5")
print ("1x6=6")
print ("1x7=7")
print ("1x8=8")
print ("1x9=9")
print ("2x1=2")
print ("2x2=4")
print ("2x3=6")
print ("2x4=8")
print ("2x5=10")
print ("2x6=12")
print ("2x7=14")
print ("2x8=16")
print ("2x9=18")
print ("3x1=3")
print ("3x2=6")
print ("3x3=9")
print ("3x4=12")
print ("3x5=15")
print ("3x6=18")
print ("3x7=21")
print ("3x8=24")
print ("3x9=27")
print ("4x1=4")
print ("4x2=8")
print ("4x3=12")
print ("4x4=16")
print ("4x5=20")
print ("4x6=24")
print ("4x7=28")
print ("4x8=32")
print ("4x9=36")
print ("5x1=5")
print ("5x2=10")
print ("5x3=15")
print ("5x4=20")
print ("5x5=25")
print ("5x6=30")
print ("5x7=35")
print ("5x8=40")
print ("5x9=45")
print ("6x1=6")
print ("6x2=12")
print ("6x3=18")
print ("6x4=24")
print ("6x5=30")
print ("6x6=36")
print ("6x7=42")
print ("6x8=48")
print ("6x9=54")
print ("7x1=7")
print ("7x2=14")
print ("7x3=21")
print ("7x4=28")
print ("7x5=35")
print ("7x6=42")
print ("7x7=49")
print ("7x8=56")
print ("7x9=63")
print ("8x1=8")
print ("8x2=16")
print ("8x3=24")
print ("8x4=32")
print ("8x5=40")
print ("8x6=48")
print ("8x7=56")
print ("8x8=64")
print ("8x9=72")
print ("9x1=9")
print ("9x2=18")
print ("9x3=27")
print ("9x4=36")
print ("9x5=45")
print ("9x6=54")
print ("9x7=63")
print ("9x8=72")
print ("9x9=81")
N = int(input())

area = (N * N * ??)
len = (N * 2 * ??)

print('{0:f} {1:f}'.format(area, len))

### FIXED CODE ###

ci = 3.14159265359
n = float(input())
print('{0:f} {1:f}'.format(n*n*ci, (n+n)*ci))
N, M = map(int, input().split())
edge = [[] for i in range(N)]
for i in range(M):
  x, y = map(int, input().split())
  edge[x-1].append(y-1)

dp = [-1] * N
def dist(v):
  if dp[v] != -1: return dp[v]
  
  res = 0
  for to in edge[v]:
    res = max(res, dist(to) + 1)
  
  dp[v] = res
  return res

ans = 0
for i in range(N):
  ans = max(ans, dist(i))

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5) 

N, M = map(int, input().split())
edge = [[] for i in range(N)]
for i in range(M):
  x, y = map(int, input().split())
  edge[x-1].append(y-1)

dp = [-1] * N
def dist(v):
  if dp[v] != -1: return dp[v]
  
  res = 0
  for to in edge[v]:
    res = max(res, dist(to) + 1)
  
  dp[v] = res
  return res

ans = 0
for i in range(N):
  ans = max(ans, dist(i))

print(ans)
n=int(input())
s=input()
if(n%2!=0):
  print("No")
else:
  v=[s[i: i+n/2] for i in range(0, len(s), n/2)]
  if(len(set(v))==1):
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n=int(input())
s=input()
if(n%2!=0):
  print("No")
else:
  v=[s[i: i+n//2] for i in range(0, len(s), n//2)]
  if(len(set(v))==1):
    print("Yes")
  else:
    print("No")
# coding: utf-8
N = int(f.readline())
A = [int(i) for i in input().split()]
q = int(f.readline())
m = [int(i) for i in input().split()]
MAX_LENGTH = len(A)
#i番目以降の値を使ってmを作ればTrueを返す
def fullSearch(i, m):
    #終了条件
    if m == 0:
        return True
    elif i >= MAX_LENGTH:
        return False
    else:
        #全探索かっこわるい
        return fullSearch(i + 1, m) or fullSearch(i + 1, m - A[i])

for i in m:
    print("yes" if fullSearch(0, i) else "no")

### FIXED CODE ###

# coding: utf-8
N = int(input())
A = [int(i) for i in input().split()]
q = int(input())
m = [int(i) for i in input().split()]
MAX_LENGTH = len(A)
dp = [[-1 for i in range(max(m) + 1)] for j in range(MAX_LENGTH + 1)]
# i番目以降の値を使ってmを作ればTrueを返す
def fullSearch(i, m):
    # 終了条件
    if m < 0:
        return False
    elif dp[i][m] != -1:
        return dp[i][m]
    elif m == 0:
        return True
    elif i >= MAX_LENGTH:
        return False
    else:
        # 全探索かっこわるい
        res = fullSearch(i + 1, m) or fullSearch(i + 1, m - A[i])
    # のでメモ化
    dp[i][m] = res
    return res
for mi in m:
    print("yes" if fullSearch(0, mi) else "no")
h = int(input().split())
print(2 ** (len(bin(h)) - 2) - 1)

### FIXED CODE ###

h = int(input())
print(2 ** (len(bin(h)) - 2) - 1)
import fractions
a,b=map(int, input().split())
print(’{:.0f}’.format(a*b/fractions.gcd(a, b)))

### FIXED CODE ###

import fractions
a,b=map(int, input().split())
print(round(a*b/fractions.gcd(a, b)))
N=int(input()[:-1])
ans=0
for i in range(1,N+1):
    if i%3==0 or i%5==0:
        pass
    else:
        ans+=1
print(ans)


### FIXED CODE ###

N=int(input())
S=0

for i in range(1,N+1):
    if i%3!=0 and i%5!=0:
        S += i
print(S)
N,K = map(int,input().split())
import sys
sys.setrecursionlimit(10000000)
def dfs(cur):
    if cur == 0:
        return 'p'
    l_1 = dfs(cur-1)
    if len(l_1) >= K:
        l_1 = l_1[:K]
    barger = 'b' + l_1 + 'p' + l_1 + 'b'
    return barger
ans = dfs(N)[:K].count('p')
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
import sys
sys.setrecursionlimit(10000000)

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
def dfs(N,X):
    #print(N,X)
    if N == 0:
        return 0 if X != 1 else 1
    elif X <= 1 + a[N-1]:
        return dfs(N-1, X-1)
    elif X == 2 + a[N-1]:
        return p[N-1] + 1
    elif X <= 2 + 2*a[N-1]:
        return p[N-1] + 1 + dfs(N-1, X-2-a[N-1])
    else:
        return 2*p[N-1]+1
    
print(dfs(N,K))
from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split())))

x = [0]
for a in A:
  if A[a]>1:x.append(a)
  if A[a]>3:x.append(a)
x.sort()
print(x[-1]*x[-2])



### FIXED CODE ###

from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split())))

x = [0,0]
for a in A:
  if A[a]>1:x.append(a)
  if A[a]>3:x.append(a)
x.sort()
print(x[-1]*x[-2])