Harryxun/stf_run huggingface dataset:
from sys import stdin
import math
import fractions
from collections import deque
import itertools

INF = 10 ** 10

N, K = [int(x) for x in stdin.readline().rstrip().split()]
V = list(map(int,stdin.readline().rstrip().split()))

getV_num = min(N, K)

ans = 0

for i in range(getV_num//2+1, getV_num+1):
    toru = i
    sute = K-i

    #print(toru)
    #print(sute)
    
    for j in range(toru+1):
        leftn = j
        rightn = (toru - j)

        data = []


        for k in range(leftn):
            data.append(V[k])

        for k in range(rightn):
            data.append(V[N-1-k])

        data.sort()
        for _ in range(sute):
            if data[0] < 0:
                del data[0]
            else:
                break

        ans = max(ans, sum(data))

print(ans)


### FIXED CODE ###

from sys import stdin
import math
import fractions
from collections import deque
import itertools

INF = 10 ** 10

N, K = [int(x) for x in stdin.readline().rstrip().split()]
V = list(map(int,stdin.readline().rstrip().split()))

getV_num = min(N, K)

ans = 0

for i in range(getV_num+1):
    toru = i
    sute = K-i

    #print(toru)
    #print(sute)
    
    for j in range(toru+1):
        leftn = j
        rightn = (toru - j)

        data = []


        for k in range(leftn):
            data.append(V[k])

        for k in range(rightn):
            data.append(V[N-1-k])

        data.sort()
        for _ in range(sute):
            if data:
                if data[0] < 0:
                    del data[0]
                else:
                    break
            else:
                break

        ans = max(ans, sum(data))

print(ans)
x = int(input())

for i in range(1000):
    #for j in range(10)
    #print(i ** 5)
    for j in range(1000):
        #print(i ** 5 - j ** 5)
        if i ** 5 - j ** 5 == x:
            print(i, j)
            quit()
        elif i ** 5 - (-j) ** 5 == x:
            print(i, -j)
            quit()
        elif (-i) ** 5 - j ** 5 == x:
            print(-i, j)
            quit()
        elif (-i) ** 5 - (-j) ** 5 == x:
            print(-i, -j)
            quit()


### FIXED CODE ###

s = input()
if s == 'ABC':
    print('ARC')
else:
    print('ABC')
n = int(input())
r = 10**7+1
l = 1

def f(n):
  return n**2+n

while r-l>1:
  if f((l+r)//2)>n:
    r = (l+r)//2
  else:
    l = (l+r)//2
l = l+1
rm = (l+1)*l//2-n
ans = list(range(1, l+1))
ans.remove(rm)
for a in ans:
  print(a)

### FIXED CODE ###

n = int(input())
r = 10**7+1
l = 1

def f(n):
  return (n**2+n)//2

while r-l> 1:
  if f((l+r)//2)>n:
    r = (l+r)//2
  else:
    l = (l+r)//2

l = l+1
rm = (l+1)*l//2-n
ans = list(range(1, l+1))
ans.remove(rm)
for a in ans:
  print(a)
N,K = input().split()
N = int(N)
K = int(K)

trees = []
for i in range(N) :
	trees.append(int(input()))

trees.sort()
min_diff = 999999
for i in range(N-K+1) :
	arr = trees[i:i+K]
	max_v = max(arr)
	min_v = min(arr)
	diff = max_v - min_v
	if (min_diff > diff) :
		min_diff = diff
	if (min_diff = 0) :
		break


print(min_diff)

### FIXED CODE ###

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

trees = []
for i in range(N) :
	trees.append(int(input()))

trees.sort()
min_diff = 99999999999
for i in range(N-K+1) :
	max_v = trees[i+K-1]
	min_v = trees[i]
	diff = max_v - min_v
	if (min_diff > diff) :
		min_diff = diff
	if (min_diff == 0) :
		break



print(min_diff)
from collections import defaultdict
def f(s):
  return int(s) - 1

N, K = map(int, input().split())
P = list(map(f, input().split()))
C = list(map(int, input().split()))

loop = []

first = -1
x = -1
loop_mem = []
cnt = 0
score = 0

rem = set(range(N))

while len(rem) > 0:
  if first < 0:
    first = rem.pop()
    x = first
  loop_mem.append(x)
  if x != first:
    rem.remove(x)
  if first != P[x]:
    cnt += 1
    score += C[x]
    x = P[x]
  else:
    cnt += 1
    score += C[x]
    loop.append((loop_mem, cnt, score))
    first = -1
    loop_mem = []
    cnt = 0
    score = 0

ans = -1e10
for loop_mem, cnt, score in loop:
  imax = [-1e10 for _ in range(cnt-1)]
  for x in loop_mem:
    tmp = 0
    for j in range(cnt - 1):
      tmp += C[x]
      imax[j] = max(imax[j], tmp)
      x = P[x]
  for j in range(1, cnt-1):
    imax[j] = max(imax[j-1], imax[j])
  if score <= 0:
    ans = max(ans, imax[-1])
  else:
    M = K // cnt
    m = K % cnt
    if M >= 1:
      tmp = max(score * M + max(imax[m-1], 0), score * (M-1) + imax[-1])
    else:
      tmp = imax[m-1]
  	ans = max(ans, tmp)

print(ans)


### FIXED CODE ###

from collections import defaultdict
def f(s):
  return int(s) - 1

N, K = map(int, input().split())
P = list(map(f, input().split()))
C = list(map(int, input().split()))

loop = []

first = -1
x = -1
loop_mem = []
cnt = 0
score = 0

rem = set(range(N))

while len(rem) > 0:
  if first < 0:
    first = rem.pop()
    x = first
  loop_mem.append(x)
  if x != first:
    rem.remove(x)
  cnt += 1
  score += C[x]
  if first != P[x]:
    x = P[x]
  else:
    loop.append((loop_mem, cnt, score))
    first = -1
    loop_mem = []
    cnt = 0
    score = 0

ans = -1e10
for loop_mem, cnt, score in loop:
  imax = [-1e10 for _ in range(cnt)]
  imax[0] = 0
  for x in loop_mem:
    tmp = 0
    for j in range(1, cnt):
      tmp += C[x]
      imax[j] = max(imax[j], tmp)
      x = P[x]
  for j in range(2, cnt):
    imax[j] = max(imax[j-1], imax[j])
  if score <= 0:
    ans = max(ans, imax[-1])
  else:
    M = K // cnt
    m = K % cnt
    if M >= 1:
      tmp = max(score * M + max(imax[m], 0), score * (M-1) + imax[-1])
    else:
      tmp = imax[m]
    ans = max(ans, tmp)

print(ans)
X,Y=map(int,input().split())

mod=10**9+7
def nCr(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

if (X+Y)%3 != 0:
      print(0)
      exit()
 
x,y=X,Y
for i in range(0,x+1):
    if x==y*2 or (x==0 and y==0):
        n=i
        break
    else:
      x-=1
      y-=2

m=((X+Y)//3)-n

if n<0 or m<0:
    print(0)
    exit()

ans = nCr(n+m,n,mod)
print(ans)


### FIXED CODE ###

X,Y=map(int,input().split())

mod=10**9+7
def nCr(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n+1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod

if (X+Y)%3 != 0:
      print(0)
      exit()
 
n=((2*X)-Y)//3

m=((X+Y)//3)-n

if n<0 or m<0:
    print(0)
    exit()

ans = nCr(n+m,n,mod)
print(ans)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

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

count = 0
for i in range(N):
    if P[i] == i+1:
        x = P[i]
        P[i] = P[i+1]
        P[i+1] = x
        count += 1

print(count)

### FIXED CODE ###


import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

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

P.append(0) # 番兵

count = 0
for i in range(N):
    if P[i] == i+1:
        x = P[i]
        P[i] = P[i+1]
        P[i+1] = x
        count += 1

print(count)
S = input()
listw = [ "Sunny", "Cloudy", "Rainy" ]
ind = listw.index( S )
print( listw.append( "Sunny" )[ind+1] ) 

### FIXED CODE ###

S = input()
listw = [ "Sunny", "Cloudy", "Rainy" ]
ind = listw.index( S )
if ind == 2 : 
   ind = -1
print( listw[ind+1] )
N,M = map(int,input().split())
AB = [[] for _ in range(M)]
ans = [0]*N
for _ in range(M):
  a,b = map(int,input().split())
  AB[a-1].append(b-1)
  AB[b-1].append(a-1)

from collections import deque

node = 0
q = deque([0])

check = [0]*N
check[0] = 1
while len(q) > 0:
  node = q.popleft()
  for i in AB[node]:
    if check[i] == 0:
      q.append(i)
      check[i] = 1
      ans[i] = node
print("Yes")
for i in range(1,N):
  print(ans[i]+1)


### FIXED CODE ###

N,M = map(int,input().split())
AB = [[] for _ in range(N)]
ans = [0]*N
for _ in range(M):
  a,b = map(int,input().split())
  AB[a-1].append(b-1)
  AB[b-1].append(a-1)

from collections import deque

node = 0
q = deque([0])

check = [0]*N
check[0] = 1
while len(q) > 0:
  node = q.popleft()
  for i in AB[node]:
    if check[i] == 0:
      q.append(i)
      check[i] = 1
      ans[i] = node
print("Yes")
for i in range(1,N):
  print(ans[i]+1)
N = int(input())
list = input().split(' ')
sq_list = []
for i in list:
  sq_list.append(i ** 2)
print((sum(list) ** 2 - sum(sq_list))//2)

### FIXED CODE ###

N = int(input())
no_list = list(map(int, input().split()))
sq_list = []
for i in no_list:
  sq_list.append(i ** 2)
print((sum(no_list) ** 2 - sum(sq_list))//2)
n = int(input())
l = [input() for i in range(num)]
print("AC x", l.count("AC"))
print("WA x", l.count("WA"))
print("TLE x", l.count("TLE"))
print("RE x", l.count("RE"))

### FIXED CODE ###

num = int(input())
lst = [input() for _ in range(num)]
print("AC x", lst.count("AC"))
print("WA x", lst.count("WA"))
print("TLE x", lst.count("TLE"))
print("RE x", lst.count("RE"))
from functools import lru_cache

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

one = a.count(1)
two = a.count(2)
three = a.count(3)

@lru_cache(n**3)
def dfs(one,two,three):
    if one<0 or two<0 or three<0:
        return 0
    s = one+two+three
    if s == 0:
        return 0
    zero = n-s
    tmp = (one*dfs(one-1,two,three) + two*dfs(one+1, two-1, three) + three*dfs(one,two+1,three-1) + n)/(n - zero)
    return tmp

ans = dfs(one,two,three)
print(ans)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
a,b,c = c[1],c[2],c[3]
DP = [[[0]*(n+2) for i in range(n+2)] for j in range(n+2)]

for i in range(c+1):
    for j in range(n-a-i+1):
        for k in range(n-i-j+1):
            if i+j+k:
                DP[i][j][k] = (i*DP[i-1][j+1][k] + j*DP[i][j-1][k+1] + k*DP[i][j][k-1] + n)/(i+j+k)
print(DP[c][b][a])
[N, D] = input().split()
s = 0
D = int(D)
for i in range(N):
    [X, Y] = input().split()
    X = int(X)
    Y = int(Y)
    Z = X**2 + Y**2
    if Z <= D:
        s +=1
print(s)        

### FIXED CODE ###

[N, D] = input().split()
s = 0
N = int(N)
D = int(D)
D = D**2
for i in range(N):
    [X, Y] = input().split()
    X = int(X)
    Y = int(Y)
    Z = X**2 + Y**2
    if Z <= D:
        s += 1
print(s)
n,x = map(int,input())
m = list(int(input()) for i in range(n))

print(x - sum(m) // min(m) + n)

### FIXED CODE ###

n,x = map(int,input().split())
m = list(int(input()) for i in range(n))

print((x - sum(m)) // min(m) + n)
l = int(input())
print((l / 3) ** 3)

### FIXED CODE ###

a=input().split()
(n,m)=map(int,a)
d=0
d1=0
for i in range(n):
    n-=1
    d=d+n
for j in range(m):
    m-=1
    d1=d1+m
print(d1+d)
#!/usr/bin/python3
N = int(input())
L = list(map(int, input().split()))

L.sort()

print(sum(L[0::2]))


### FIXED CODE ###

#!/usr/bin/python3
N = int(input())
L = list(map(int, input().split()))

L.sort()

print(sum(L[0::2]))
print(sum([int(i) for i in range(N)]))

### FIXED CODE ###

N = int(input())

ans = ((2 + N - 1) * N // 2) - N
print(ans)
# E
 
N = int(input())
a_list = [0]*(N+1)
for i in range(N+1):
    a_list[N-i] = int(input())

#import random
#N = 10**4
#a_list = [0]*(N+1)
#for i in range(N+1):
#    a_list[N-i] = random.choice(range(10**9))
#a_list[0] = 2*3*5*7*11*13*17*19*23

 
# a0を割り切る素数を全部求める
p_list = []
## 10^5までの素数を計算
primes = list(range(10**5))
primes[0] = 0
primes[1] = 0
for p in range(2, 10**5):
    if primes[p]:
        for i in range(2*p, 10**5, p):
            primes[i] = 0
primes = [p for p in primes if p>0]
 
## 素因数分解
A = a_list[0]
for p in primes:
    if A % p == 0:
        p_list.append(p)
    while A % p == 0:
        A = A // p
if A > 1:
    p_list.append(A)
# print(p_list)
# 個別に条件確認
res_list = []

check_list = [0]*(N+1)

for p in p_list:
    r = 0
    #check_list = [0]*(N+1)
    for i in range(min(p, N+1)):
        check_list[i] = a_list[i]
    for i in range(p, N+1):
        check_list[(i-1) % (p-1) + 1] += a_list[i]
    for i in range(p):
        r += check_list[i] % p
    if r == 0:
        res_list.append(p)
        
for p in res_list:
    print(p)

### FIXED CODE ###

# E

# 入力
# input
N = int(input())
a_list = [0]*(N+1)
for i in range(N+1):
    a_list[N-i] = int(input())


# 10^5までの素数を計算
# list primes <= 10^5 
primes = list(range(10**5))
primes[0] = 0
primes[1] = 0
for p in range(2, 10**5):
    if primes[p]:
        for i in range(2*p, 10**5, p):
            primes[i] = 0
primes = [p for p in primes if p>0]
# primes <= N
p_list_small = [p for p in primes if p <= N]


# A_Nを素因数分解、Nより大きい素因数をp_list_largeに追加
# A_N, ..., A_0の最大公約数の素因数でやっても同じ
# list prime factors of A_N, if greater then N, add to p_list_large
# you can use prime factors of gcd(A_N, ..., A_0) instead 

p_list_large = []
A = abs(a_list[-1])
for p in primes:
    if A % p == 0:
        if p > N:
            p_list_large.append(p)
        while A % p == 0:
            A = A // p
if A != 1:
    p_list_large.append(A)

# 個別に条件確認
# check all p in p_list_small
# x^p ~ x (mod p)
res_list = []
for p in p_list_small:
    r = 0
    check_list = [0]*(N+1)
    for i in range(p):
        check_list[i] = a_list[i]
    for i in range(p, N+1):
        check_list[(i-1) % (p-1) + 1] += a_list[i]
    for i in range(p):
        if check_list[i] % p != 0:
            r = 1
    if r == 0:
        res_list.append(p)
        
# 個別に条件確認
# check all p in p_list_large
# a_i % p == 0
for p in p_list_large:
    r = 0
    for i in range(N+1):
        if a_list[i] % p != 0:
            r = 1
    if r == 0:
        res_list.append(p)
        
for p in res_list:
    print(p)
import fractions

A, B = map(int, input().split())
g = fractions.gcd(A, B)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            # print(i)
            flag = 1
            for j in range(2, int(math.sqrt(i))+1):
                if i%j == 0:
                    flag = 0
                    break
            if flag == 1:
                divisors.append(i)
            if i != n // i:
                flag = 1
                for j in range(2, int(math.sqrt(n // i))+1):
                    if (n // i) %j == 0:
                        flag = 0
                        break
                if flag == 1:
                    divisors.append(n//i)
    return divisors

print(len(make_divisors(g)))

### FIXED CODE ###

import fractions

A, B = map(int, input().split())
g = fractions.gcd(A, B)

def make_divisors(n):
    count = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            # print(i)
            flag = 1
            for j in range(2, int(i**0.5)+1):
                if i%j == 0:
                    flag = 0
                    break
            if flag == 1:
                count += 1
            if i != n // i:
                flag = 1
                for j in range(2, int((n // i)**0.5)+1):
                    if (n // i) %j == 0:
                        flag = 0
                        break
                if flag == 1:
                    count += 1
    return count

print(make_divisors(g))
x = ['+++', '++-', '+-+', '+--', '-++', '-+-', '--+', '---']
a = input()
for i in range(8):
    ans = a[0] + x[i][0] + a[1] + x[i][1] + a[2] + x[i][2] + a[3]
    if eval(ans) == 7:
        print(ans + '=7')
        break


### FIXED CODE ###

n = int(input())

i0 = 2
i1 = 1
if n>1:
    for i in range(n-1):
        ans = i0+i1
        i0 = i1
        i1  = ans
if n==0:
    print(2)
elif n==1:
    print(1)
else:
    print(ans)
import math

words = lambda t : list(map(t, input().split()))

n = int(input())
a = words(int)

if n == 2:
    print(max(a[0],a[1]))

else:
    cgcdm1 = max(math.gcd(a[0],a[1]),math.gcd(a[1],a[2]),math.gcd(a[2],a[0]))
    allgcd = math.gcd(a[0],math.gcd(a[1],a[2]))

    for i in range(3,n):
        cgcdm1 = max(math.gcd(cgcdm1,a[i]),allgcd)
        allgcd = math.gcd(allgcd, a[i])

    print(cgcdm1)


### FIXED CODE ###

import math

words = lambda t : list(map(t, input().split()))


def gcd (a,b):
    if a > b:
        t = b
        b = a
        b = t
    v = b
    while (a % b != 0):
        t = a % b
        a = b
        b = t
        v = b
    return v


n = int(input())
a = words(int)

if n == 2:
    print(max(a[0],a[1]))

else:
    cgcdm1 = max(gcd(a[0],a[1]),gcd(a[1],a[2]),gcd(a[2],a[0]))
    allgcd = gcd(a[0],gcd(a[1],a[2]))

    for i in range(3,len(a)):
        cgcdm1 = max(gcd(cgcdm1,a[i]),allgcd)
        allgcd = gcd(allgcd, a[i])

    print(cgcdm1)


def gcd (a,b):
    if a > b:
        t = b
        b = a
        b = t
    v = b
    while (a % b != 0):
        t = a % b
        a = b
        b = t
        v = b
    return v
N, L = input().split()
apples = [x + int(L) for x in list(range(int(N))
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))
print(sum(apples) - apples[abs_min_index])

### FIXED CODE ###

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

apples = list(range(N)) 
apples = [x + L for x in apples]
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))

print(sum(apples) - apples[abs_min_index])
import math
import copy
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(str, input().split())
data = list(n)

cntOne = 0
cntZero = 0

for i in range(data):
    if data[i] == "0": 
        cntZero += 1
    else: 
        cntOne += 1

ans(int(2*min(cntOne, cntZero)))

### FIXED CODE ###

import math
import copy
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(str, input().split())
data = list(n)

cntOne = 0
cntZero = 0

for i in range(len(data)):
    if data[i] == "0":
        cntZero += 1
    else:
        cntOne += 1

ans = int(2*min(cntOne, cntZero))
print(ans)
import math

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

ans_list = []

def C(x, y):
    return math.factorial(x) // math.factorial(x - y) // math.factorial(y)

def calc(n, k, t):
    return C(n - k + 1, t) * C(k - 1, t - 1) % (10 ** 9 + 7)

for i in range(1, k + 1):
    if (n - k + 2) >= i and (n - k) > 0:
        ans_list.append(calc(n, k, i))
    else:
        if len(ans_list) > 0:
            ans_list.append(ans_list[-1])
        else:
            ans_list.append(1)

for i in ans_list:
    print(i)
        


### FIXED CODE ###

import math

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

ans_list = []

def C(x, y):
    return math.factorial(x) // math.factorial(x - y) // math.factorial(y)

def calc(n, k, t):
    return C(n - k + 1, t) * C(k - 1, t - 1) % (10 ** 9 + 7)

for i in range(1, k + 1):
    
    if n - k <= 0:
        if len(ans_list) == 0:
            ans_list.append(1)
        else:
            ans_list.append(0)
    else:
        if i > (n - k + 1):
            if len(ans_list) == 0:
                ans_list.append(1)
            else:
                ans_list.append(0)
        else:
            ans_list.append(calc(n, k, i))

for i in ans_list:
    print(i)
a,b,c=input()
if a==c, print('Yes')
else print('No')

### FIXED CODE ###

a,b,c=input()
print('Yes'  if a==c else  'No')
n=int(input())
f=[]
for i in range(2,n+1):
    c=0
    r=int(i**0.5)
    for j in range(2,r+2):
        while i%j==0:
            c+=1
            i=i//j
        if c!=0:
            f.append([j,c])
            c=0
    if i!=1:
        f.append([i,1])
f.sort()
d=[]
ans=0
cou=f[0][1]
for i in range(1,len(f)):
    if f[i][0]==f[i-1][0]:
        cou+=f[i][1]
    else:
        d.append(cou)
        cou=1
d.append(cou)

a74=0
for i in d:
    if i>=74:
        a74+=1
ans+=a74


a2=0
a24=0
for i in d:
    if i>=24:
        a24+=1
    if i>=2 and i<24:
        a2+=1
ans+=a2*a24
if a24>=2:
    ans+=a24*(a24-1)//2

    
a2,a4=0,0
for i in d:
    if i>=4:
        a4+=1
    elif i>=2:
        a2+=1
if a4>=2 and a2>=1:
    ans+=a4*(a4-1)//2*a2
if a4>=3:
    ans+=a4*(a4-1)*(a4-2)//2

    
a4,a14=0,0
for i in d:
    if i>=14:
        a14+=1
    if i>=4 and i<14:
        a4+=1
ans+=a4*a14
if a14>=2:
    ans+=a14*(a14-1)//2

print(ans)

### FIXED CODE ###

n=int(input())
f=[]
w=[0,0,0,0,0]
for i in range(2,n+1):
    c=0
    r=int(i**0.5)
    for j in range(2,r+2):
        while i%j==0:
            c+=1
            i=i//j
        if c!=0:
            f.append([j,c])
            c=0
    if i!=1:
        f.append([i,1])
f.sort()
d=[]
ans=0
if n!=1:
    cou=f[0][1]
    for i in range(1,len(f)):
        if f[i][0]==f[i-1][0]:
            cou+=f[i][1]
        else:
            d.append(cou)
            cou=1
    d.append(cou)

    for i in d:
        for j,num in enumerate([2,4,14,24,74]):
            if i>=num:
                w[j]+=1
    ans=w[4]+w[3]*(w[0]-1)+w[2]*(w[1]-1)+w[1]*(w[1]-1)*(w[0]-2)//2
print(ans)
N, D = map(int, input().split())
ans = 0
for i in range(N):
    x, y = map(int, input().split())
    if x**2+y**2 <= D**2:
        ans += 1
print(ans)

### FIXED CODE ###

import math
K = int(input())
if math.gcd(10, K) != 1:
    print(-1)
else:
    for i in range(1, 10**6+1):
        if 7*(pow(10, i, 9*K)-1) % (9*K) == 0:
            print(i)
            break
import numpy as np
from math import factorial

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

dic = {}
after = {}

newdata = np.unique(A)
for i in range(len(newdata)):
	x = np.sum(A == newdata[i])
	if x <= 1:
		dic[newdata[i]] = 0
	else:
		dic[newdata[i]] = factorial(x) / factorial(2) / factorial(x - 2)

	if x - 1 <= 1:
		after[newdata[i]] = 0
	else:
		after[newdata[i]] = factorial(x - 1) / factorial(2) / factorial(x - 1 - 2)

	print(dic, after)

numsum = 0
for dicv in dic.values():
	numsum += dicv 


for i in range(N):
	print(int(numsum - dic[A[i]] + after[A[i]]))


### FIXED CODE ###

import numpy as np
import collections

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

dic = {}
after = {}

l = collections.Counter(A)

for key, val in l.items():
	dic[key] = val * (val - 1) // 2
	after[key] = (val - 1) * (val - 2) // 2

numsum = sum(dic.values())

ans = {}
for key in dic.keys():
	ans[key] = numsum - dic[key] + after[key]

for i in range(N):
	print(ans[A[i]])
n = int(input())
length = 0
word_list = []
for i in range(n):
  word = input()
  if len(word) > length:
    word_list = [word]
  if len(word) = length:
    word.append(word_list)
word_list.sort()
for k in range(len(word_list)):
  print(word_list[k])

### FIXED CODE ###

n = int(input())
s = []
for i in range(n):
  s.append(input())
s = sorted(s)
max_count = 1
count = 1
ans = []
for i in range(n-1):
  if s[i] == s[i+1]:
    count += 1
    if count == max_count:
      ans.append(s[i])
    if count > max_count:
      max_count = count
      ans = [s[i]]
  else:
    count = 1
    if max_count == 1:
      ans.append(s[i])
if max_count == 1:
  ans.append(s[n-1])
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i])