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

def main():
    import numpy as np
    inf = 100100100
    ans = inf
    H, W, K = map(int, input().split())
    S = []
    for _ in range(H):
        S.append([int(x) for x in input()])
    S = np.array(S)
    for i in range(2**(H-1)):
        group = [0]
        g = 0
        for j in range(H-1):
            if (i >> j) & 1:
                g += 1
            group.append(g)
        group = np.array(group)
        g += 1
        c = np.array([[0]*W]*g)
        for j in range(H):
            for k in range(W):
                c[group[j],k] += S[j,k]
        num = g-1
        now = np.zeros(g)
        def large(now):
            for n in now:
                if n > K:
                    return True
            else:
                return False
        for k in range(W):
            now += c[:,k]
            if large(now):
                now = c[:,k]
                num += 1
                if large(now):
                    num = inf
                    break
        ans = min(ans, num)
    print(ans)
main()


### FIXED CODE ###

def main():
    import sys
    inf = 100100100
    ans = inf
    H, W, K = map(int, input().split())
    S = [0]*H
    for i in range(H):
        S[i] = [int(x) for x in sys.stdin.readline().strip()]
    for i in range(2**(H-1)):
        group = [0]
        g = 0
        for j in range(H-1):
            if (i >> j) & 1:
                g += 1
            group.append(g)
        g += 1
        c = [[0 for _ in range(W)] for __ in range(g)]
        for j in range(H):
            for k in range(W):
                c[group[j]][k] += S[j][k]
        num = g-1
        now = [0]*g
        def large(now):
            for n in now:
                if n > K:
                    return True
            else:
                return False
        def v_vec(twodlis, k):
            ans = []
            for lis in twodlis:
                ans.append(lis[k])
            return ans
        for k in range(W):
            for n in range(len(now)):
                now[n] = now[n] + v_vec(c,k)[n]
            if large(now):
                now = v_vec(c,k)
                num += 1
                if large(now):
                    num = inf
                    break

        ans = min(ans, num)
    print(ans)

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

import math
a,b,n=map(int,input().split())
max=-2
if b<n:
    n=b
for i in range(1,n+1):
    if i<b:
        s=math.floor(a*i/b)
    else:
        p=i//b
        q=i/b-p
        z=q*a
        s=math.floor(a*((1/b)-i//b))
    if s>max:
        max=s
print(max)

### FIXED CODE ###

import math
a,b,n=map(int,input().split())
max=-2
if n<b:
    max=math.floor(a*n/b)
else:
    #b<=n
    max=math.floor(a*(b-1)/b)
    

print(max)
### BUGGY CODE ###

import itertools
n = int(input())
S = input()

R = []
G = []
B = []
for i, s in enumerate(S):
    if s == 'R':
        R.append(i)
    elif s == 'G':
        G.append(i)
    else:
        B.append(i)

count = 0
# for r in R:
#     for g in G:
#         for b in B:
#             l = sorted([r, b, g])
#             if (l[0] + l[2])/2 != l[1]:
#                 count += 1

for r, g, b in list(itertools.product(R, G, B)):
    l = sorted([r, b, g])
    if (l[0] + l[2])/2 != l[1]:
        count += 1

print(count)

### FIXED CODE ###

n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')

cnt = 0
for i in range(n):
    j = 1
    while i + 2*j <= n-1:
        if s[i] != s[i+j] and s[i+j] != s[i+2*j] and s[i+2*j] != s[i]:
            cnt += 1
        j += 1

print(r*g*b-cnt)
### BUGGY CODE ###

n= int(input())
s = input()
ans = 0
li_r = []
li_g = []
li_b = []
for i in range(n):
  if s[i] == "R":
    li_r.append(i+1)
  elif s[i] == "G":
    li_g.append(i+1)
  elif s[i] == "B":
    li_b.append(i+1)
for i in li_r:
  for j in li_g:
    if (j+i)%2 == 0:
      if 2*j -i in li_b and 2*i - j in li_b and (j+i)//2 in li_b:
        ans += len(li_b)-3
      elif 2*j -i not in li_b and 2*i - j in li_b and (j+i)//2 in li_b:
        ans += len(li_b) -2
      elif 2*j -i in li_b and 2*i - j not in li_b and (j+i)//2 in li_b:
        ans += len(li_b) -2
      elif 2*j -i in li_b and 2*i - j in li_b and (j+i)//2 not in li_b:
        ans += len(li_b) -2
      elif 2*j -i not in li_b and 2*i - j not in li_b and (j+i)//2 in li_b:
        ans += len(li_b) -1
      elif 2*j -i in li_b and 2*i - j not in li_b and (j+i)//2 not in li_b:
        ans += len(li_b) -1
      elif 2*j -i not in li_b and 2*i - j in li_b and (j+i)//2 not in li_b:
        ans += len(li_b) -1
      elif 2*j -i not in li_b and 2*i - j not in li_b and (j+i)//2 not in li_b:
        ans += len(li_b)
    else:
      if 2*j -i in li_b and 2*i - j in li_b:
        ans += len(li_b)-2
      elif 2*j -i not in li_b and 2*i - j in li_b:
        ans += len(li_b) -1
      elif 2*j -i in li_b and 2*i - j not in li_b:
        ans += len(li_b) -1
      elif 2*j -i not in li_b and 2*i - j not in li_b:
        ans += len(li_b)
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
n = I()
s = input()
c = Counter(s)
ans = 0
for i in range(n):
    for k in range(i+1,n):
        if (i+k)%2 == 0:
            j = (i+k)//2
            if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
                ans+=1
ans_2 = c["R"]*c["G"]*c["B"]
print(ans_2-ans)
### BUGGY CODE ###

n=int(input())
S=input()
R=[]
G=[]
B=[]
for i in range(n):
	if S[i]=='R':
		R.append(i+1)
	elif S[i]=='G':
		G.append(i+1)
	else:
		B.append(i+1)
r=len(R)
g=len(G)
b=len(B)

c=0
for i in R:
	for j in G:
		d=abs(i-j)
		min_n=min(i,j)
		max_n=max(i,j)
		if max_n+d in B:
			c+=1
		if (i+j)%2==0 and (i+j)//2 in B:
			c+=1
		if min_n-d in B:
			c+=1

print(r*g*b-c)

### FIXED CODE ###

n=int(input())
S=input()
R=[]
G=[]
B=[]
for i in range(n):
	if S[i]=='R':
		R.append(i)
	elif S[i]=='G':
		G.append(i)
	else:
		B.append(i)
r=len(R)
g=len(G)
b=len(B)

c=0
for i in range(n):
	for j in range(i+1,n):
		k=2*j-i
		if k<n:
			if len(set([S[i],S[j],S[k]]))==3:
				c+=1

print(r*g*b-c)
### BUGGY CODE ###

N=int(input())
print(sum([i for i in range(1,N)]))

### FIXED CODE ###

N=int(input())
print((N-1)*N//2)
### BUGGY CODE ###

n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
d = []
s = ["" for _ in xy]
while True:
    p = [max(abs(x), abs(y)) for x, y in xy]
    q = [abs(x) + abs(y) for x, y in xy]
    if max(q) == 0:
        break
    elif max(q) == 1 and min(q) == 0:
        d = None
        break
    d.append((max(p) + min(p)) // 2)
    for i in range(len(xy)):
        x, y = xy[i]
        if p[i] == abs(x):
            if x > 0:
                s[i] += "R"
                xy[i] = (x - d[-1], y)
            else:
                s[i] += "L"
                xy[i] = (x + d[-1], y)
        else:
            if y > 0:
                s[i] += "U"
                xy[i] = (x, y - d[-1])
            else:
                s[i] += "D"
                xy[i] = (x, y + d[-1])

if d is None or len(d) > 40:
    print(-1)
else:
    print(len(d))
    print(*d)
    for t in s:
        print(t)


### FIXED CODE ###

n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
s = set([(x + y) % 2 for x, y in xy])
if len(s) > 1:
    print(-1)
    exit(0)

d = []
w = ["" for _ in xy]
if s.pop() == 0:
    d = [1]
    w = ["L" for _ in xy]
    xy = [(x + 1, y) for x, y in xy]

b = 1
while True:
    if all(abs(x) + abs(y) == 1 for x, y in xy):
        d.append(b)
        for i in range(len(xy)):
            x, y = xy[i]
            if x > 0:
                w[i] += 'R'
            elif x < 0:
                w[i] += 'L'
            elif y > 0:
                w[i] += 'U'
            else:
                w[i] += 'D'
        break
    d.append(b)
    for i in range(len(xy)):
        x, y = xy[i]
        if x % 2 == 1:
            if y % 4 == 2 and (x - 1) % 4 == 0 or y % 4 == 0 and (x - 1) % 4 == 2:
                w[i] += 'R'
                xy[i] = ((x - 1) // 2, y // 2)
            else:
                w[i] += 'L'
                xy[i] = ((x + 1) // 2, y // 2)
        else:
            if x % 4 == 2 and (y - 1) % 4 == 0 or x % 4 == 0 and (y - 1) % 4 == 2:
                w[i] += 'U'
                xy[i] = (x // 2, (y - 1) // 2)
            else:
                w[i] += 'D'
                xy[i] = (x // 2, (y + 1) // 2)
    b *= 2

print(len(d))
print(*d)
for t in w:
    print(t)
### BUGGY CODE ###

class DLList:
    class Cell:
        def __init__(self, data, pre, nex):
            self.data = data
            self.pre = pre
            self.nex = nex
    
    def __init__(self):
        self.top = DLList.Cell(None,None,None)
        self.top.nex = self.top

    def insert(self, x):
        w = DLList.Cell(x, self.top, self.top.nex)
        self.top.nex.pre = w
        self.top.nex = w
            
    def delete(self, x):
        w = self.top.nex
        while w != self.top:
            if w.data == x:
                w.pre.nex = w.nex
                w.nex.pre = w.pre
                break
            w = w.nex
            
    def deleteFirst(self):
        w = self.top.nex
        w.pre.nex = w.nex
        w.nex.pre = w.pre
     
    def deleteLast(self):
        w = self.top.pre
        w.pre.nex = w.nex
        w.nex.pre = w.pre 
           
    def pri(self):
        w = self.top.nex
        while w != self.top:
            if w.nex == self.top:
                print(w.data)
                break
            else:
                print(w.data,end=" ")
            w = w.nex

a = DLList()
n = int(input())
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.insert(int(s[1]))
    elif s[0] == "delete":
        a.delete(int(s[1]))
    elif s[0] == "deleteLast":
        a.deleteLast()
    elif s[0] == "deleteFirst":
        a.deleteFirst()
a.pri()

### FIXED CODE ###

from collections import deque
n = int(input())
a = deque()
for i in range(n):
    s = input().split(" ")
    if s[0] == "insert":
        a.appendleft(int(s[1]))
    elif s[0] == "delete":
        if int(s[1]) in a:
            a.remove(int(s[1]))
    elif s[0] == "deleteLast":
        a.pop()
    elif s[0] == "deleteFirst":
        a.popleft()
b = list(a)
for i in range(len(b)):
    if i == len(b)-1:
        print(b[i])
    else:
        print(b[i],end=" ")
### BUGGY CODE ###

n = int(input())

f = 1
for i in range(1, n+1):
    f *= i

print(f % (10**9+7))
    

### FIXED CODE ###

import math

n = int(input())

print(math.factorial(n) % (10**9 + 7))
### BUGGY CODE ###

N,C = map(int,input().split())
tv_times = [[int(j) for j in input().split()] for i in range(N)]

channells = {}
for i in range(C+1):
    channells[i] = []
max_end = -1

for i in range(N):
    s,g,c = tv_times[i]
    max_end = max(max_end,g)
    channells[c] += [s,g]

tv_times = []
f = [0 for i in range(max_end+1)]
for cha in channells.keys():
    remove_list = []
    time = channells[cha]
    time.sort()
    for i in range(1,len(time)-1):
        if time[i] == time[i+1]:
            remove_list.append(time[i])
    for i in range(len(remove_list)):
        for j in range(2):
            time.remove(remove_list[i])

    for i in range(len(time)//2):
        f[max(time[2*i]-1,0)] += 1
        f[time[2*i+1]] -= 1

ans = -1
for i in range(1,max_end+1):
    f[i] += f[i-1]
    if ans < f[i]:
        ans = f[i]

# print(f)
print(ans)


### FIXED CODE ###

N,C = map(int,input().split())
tv_times = [[int(j) for j in input().split()] for i in range(N)]

channells = {}
for i in range(C+1):
    channells[i] = []
max_end = -1

for i in range(N):
    s,g,c = tv_times[i]
    max_end = max(max_end,g)
    channells[c] += [s,g]

tv_times = []
f = [0 for i in range(max_end+1)]
for cha in channells.keys():
    remove_list = []
    time = channells[cha]
    time.sort()
    for i in range(1,len(time)-1):
        if time[i] == time[i+1]:
            remove_list.append(time[i])
    time = list(set(time)-set(remove_list))
    time.sort()
    for i in range(len(time)//2):
        f[max(time[2*i]-1,0)] += 1
        f[time[2*i+1]] -= 1
ans = -1
for i in range(1,max_end+1):
    f[i] += f[i-1]
    if ans < f[i]:
        ans = f[i]

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

n = int(input())

for i in range(1, n + 1):
    cnt = 0
    
    for x in range(1, i + 1):
        if x ** 2 >= i:
            break
        for y in range(1, i + 1):
            if y ** 2 >= i:
                break
        
            for z in range(1, i + 1):
                if z ** 2 == i:
                    break

                ans = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if ans > i:
                    break
                elif  ans == i:
                    cnt += 1

    print(cnt)

### FIXED CODE ###

#!/usr/bin/env python3
import math

n = int(input())
arr = [0] * n

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            ans = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if ans <= n:
                arr[ans - 1] += 1

for i in range(n):
    print(arr[i])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

def rec(i, j, k):
    global dp
    if dp[i][j][k] != -1.0:
        return dp[i][j][k]
    if i+j+k == 0:
        return 0.0

    num = i+j+k
    ans = N_f / num
    if i > 0:
        ans += (rec(i-1, j, k) * i) / num
    if j > 0:
        ans += (rec(i+1, j-1, k) * j) / num
    if k > 0:
        ans += (rec(i, j+1, k-1) * k) / num
    dp[i][j][k] = ans
    return ans

N = ii()
N_f = float(N)
A = li()

cnt = [0, 0, 0]
for a in A:
    cnt[a-1] += 1

dp = dp3(-1.0, cnt[2]+1, cnt[1]+cnt[2]+1, N+1)
dp[0][0][0] = 0

print(rec(cnt[0], cnt[1], cnt[2]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
N_f = float(N)
A = li()

cnt = [0, 0, 0]
for a in A:
    cnt[a-1] += 1

#dp = dp3(-1.0, cnt[2]+1, cnt[1]+cnt[2]+1, N+1)
dp = dp3(0.0, N+1, N+1, N+1)
#dp = dp3(0.0, 301, 301, 301)
dp[0][0][0] = 0

for k in range(cnt[2]+1):
#for i in range(N+1):
    for j in range(cnt[1]+cnt[2]+1-k):
    #for j in range(N+1):
        #for k in range(cnt[2]+1):
        #for k in range(N+1):
        for i in range(N+1-j-k):
            #print(i, j, k)
            if i+j+k == 0:
                continue
            num = i+j+k
            dp[i][j][k] = N_f
            if i > 0:
                dp[i][j][k] += dp[i-1][j][k] * i
            if j > 0:
                dp[i][j][k] += dp[i+1][j-1][k] * j
            if k > 0:
                dp[i][j][k] += dp[i][j+1][k-1] * k
            dp[i][j][k] /= num

print(dp[cnt[0]][cnt[1]][cnt[2]])
### BUGGY CODE ###

n, m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
bc = [[int(i) for i in input().split()] for i in range(m)]
a.sort()
bc.sort(key=lambda x:x[1])

for remain,number in bc:
    for index,value in enumerate(a):
        if remain == 0:
            break
        if value < number:
            a[index] = number
            remain -= 1
        else:
            break
    a.sort()
print(sum(a))

### FIXED CODE ###

from heapq import *
n, m = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
bc = [[int(i) for i in input().split()] for i in range(m)]
heapify(a)
bc.sort(key=lambda x:x[1],reverse=True)
maxlength = bc[0][0]
maxnumber = bc[0][1]
newbc = [[maxlength,maxnumber]]
for k,l in bc:
    if k > maxlength:
        newbc.append([k-maxlength,l])
        maxlength = k

for remain,number in bc:
    while remain > 0:
        temp = heappop(a)
        if number > temp:
            heappush(a,number)
            remain -= 1
        else:
            heappush(a,temp)
            remain = 0
print(sum(a))
### BUGGY CODE ###

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

l.sort()

# print(l)

count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        a = l[i]
        b = l[j]
        wa = a+b
        l_part = [ i for i in l[j+1:] if i<wa ]
        # print(a,b,l_part)
        for c in l_part:
            if b < a+c and a < b+c :
                count += 1

print(count)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int,input().split()))
import bisect
l.sort()
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        count += bisect.bisect_left(l,l[i]+l[j]) - j - 1
print(count)
### BUGGY CODE ###

from math import gcd
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
gc=reduce(gcd,a)
for i in range(n):
  a[i]//=gc
ans=0
for _ in range(n):
  b=a.pop()
  ans=max(reduce(gcd,a),ans)
  a=[b]+a
print(ans*gc)

### FIXED CODE ###

from math import*
n=int(input())
a=list(map(int,input().split()))
b=[a[0]]
c=[a[-1]]
for i in range(1,n):
  b+=[gcd(b[-1],a[i])]
  c+=[gcd(c[-1],a[-i-1])]
ans=0
c=c[::-1]
for i in range(n):
  if i==0:ans=max(ans,c[i+1])
  elif i==n-1:ans=max(ans,b[i-1])
  else:
    ans=max(ans,gcd(c[i+1],b[i-1]))
print(ans)
### BUGGY CODE ###

s=input()
t=input()
n=len(t)
m=len(s)
dp=[['']*(n+1) for i in range(m+1)]
for i in range(m):
  for j in range(n):
    if s[i]==t[j]:
      dp[i+1][j+1]=dp[i][j]+s[i]

    else:
      if len(dp[i][j+1])>=len(dp[i+1][j]):
        dp[i+1][j+1]=dp[i][j+1]

      else:
        dp[i+1][j+1]=dp[i+1][j]

        
print(dp[m][n])
#print(dp)

### FIXED CODE ###

s=input()
t=input()
n=len(t)
m=len(s)
dp=[[0]*(n+1) for i in range(m+1)]
for i in range(m):
  for j in range(n):
    if s[i]==t[j]:
      dp[i+1][j+1]=dp[i][j]+1

    else:
      dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

        
kotae = []
 
while(i >= 0 and j >= 0):
    if(dp[i+1][j+1] == dp[i][j+1]):
        i -= 1
    elif(dp[i+1][j+1] == dp[i+1][j]):
        j -= 1
    else:
        i -= 1
        j -= 1
        kotae.append(s[i+1])


kotae.reverse()
kotae = "".join(kotae)
print(kotae)
### BUGGY CODE ###

s = input()[::-1]

sum_of_digits = 0

cnts = [0] * 2019

cnts[0] = 1

d = 1

for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
#    d %= 2019
    cnts[sum_of_digits] += 1

ans = 0
    
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)

### FIXED CODE ###

s = input()[::-1]

sum_of_digits = 0

cnts = [0] * 2019

cnts[0] = 1

d = 1

for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1

ans = 0
    
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

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

# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    
if res <= 10 ** 18:    
    print(res)
else:
    print(-1)
    

### FIXED CODE ###

# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    if res >= 10 ** 18:
        break

if 0 in s:
    print(0)
elif res <= 10 ** 18:    
    print(res)
else:
    print(-1)
### BUGGY CODE ###

# ARC081c
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    from collections import Counter

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

    mg = 0
    for i in a:
        if a.count(i) > 3 and mg != i:
            if mg == 0:
                print(i**2)
                exit(0)
            print(mg*i)
            exit(0)
        if a.count(i) > 1 and mg != i:
            if mg == 0:
                mg = i
                continue
            print(mg*i)
            exit(0)
    print(0)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# ARC081c
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    from collections import Counter
    import heapq

    n = int(input())

    def fun(i):
        return -int(i)

    a = list(map(fun, input().split()))
    heapq.heapify(a)

    b = []
    heapq.heapify(b)
    ln = 0
    cou = 0
    mn = 0
    while(len(a) > 0):
        i = -heapq.heappop(a)
        # print(i)
        if ln != i:
            ln = i
            cou = 0
        cou += 1
        if cou > 1:
            heapq.heappush(b, -i)
            cou = 0
    try:
        print(heapq.heappop(b)*heapq.heappop(b))
    except:
        print(0)


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

n,k = map(int, input().split())
a = list(map(int, input().split()))
check = []
for i in range(n):
    if a[i]:
        check.append([i,0,a[i]])
#print(check)
for i in range(k):
    if i!=0:
        a_next = a[:]
    else:
        a_next = [1 for _ in range(n)]
    change = set()
    for i,pre,now in check:
        for to in range(i+pre+1,i+now+1):
            if to >= n:break
            change.add(to)
            a_next[to] += 1
        for to in range(i-pre-1,i-now-1,-1):
            if to < 0:break
            change.add(to)
            a_next[to] += 1
        #print(a_next)
    check = []
    for to in change:
        check.append([to,a[to],a_next[to]])
    a = a_next

print(*a)

### FIXED CODE ###

n,k = map(int, input().split())
a = list(map(int, input().split()))
event = []
for i in range(k):
    data = [0 for _ in range(n + 1)]
    for i in range(n):
        data[max(0,i-a[i])] += 1
        data[min(n,i+a[i]+1)] -= 1

    for i in range(n):
        data[i+1] += data[i]
    check = True
    for i in range(n):
        if data[i] != n:
            check = False
            break
    if check:
        print(*data[:n])
        exit()
    a = data
print(*a[:n])
### BUGGY CODE ###

N = int(input())
S = ["" for i in range(N)]
dict1 = {"key":0}
names =[]
for i in range(N):
    S[i] = input()

for i in range(N):
    if not (S[i] in names):
        names.append(S[i])
        dict1.update({S[i]:1})
    else:
        dict1[S[i]] +=1
max = 0
for name in names:
    if max < dict1[name]:
        max = dict1[name]

winners = []

for name in names:
    if dict1[name] == max:
        winners.append(name)

winners.sort()
for i in range(len(winners)):
    print(winners[i])


### FIXED CODE ###

N = int(input())
S = ["" for i in range(N)]
dict1 = {}
names =[]
for i in range(N):
    S[i] = input()

for i in range(N):
    if not (S[i] in dict1.keys()):
        names.append(S[i])
        dict1.update({S[i]:1})
    else:
        dict1[S[i]] +=1
maxv = 0
for i in range(len(names)):
    if maxv < dict1[names[i]]:
        maxv = dict1[names[i]]

winners = []

for i in range(len(names)):
    if dict1[names[i]] == maxv:
        winners.append(names[i])

winners.sort()
for i in range(len(winners)):
    print(winners[i])