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

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

    from fractions import gcd

    def lcd(x, y):
        g = gcd(x, y)
        return x * y // g

    n = int(input())
    a = tuple(map(int, input().split()))
    mod = 10 ** 9 + 7

    l = 1
    for e in a:
        l = lcd(l, e)

    ans = 0
    for e in a:
        ans += (l // e) % mod
        ans %= mod

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

l = 1
for e in a:
    l = lcm(l, e)

l %= mod

ans = 0
for e in a:
    ans += l * pow(e, mod - 2, mod)
    ans %= mod

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

x,y,z,k=map(int,input().split())
a,b,c=[list(map(int,input().split())) for i in range(3)]
l=[i+j for i in a for j in b]
l=sorted(l,reverse=True)[:k]
maxl=sorted([i+j for i in l for j in c])[::-1]
for i in range(k):
    print(maxl[i])


### FIXED CODE ###

x,y,z,k=map(int,input().split())
a,b,c=[sorted(list(map(int,input().split())),reverse=True) for i in range(3)]
L=[]
for i in range(x):
    for j in range(y):
        if (i+1)*(j+1)>k:
            break
        for m in range(z):
            if (i+1)*(j+1)*(m+1)>k:
                break
            else:
                L.append(a[i]+b[j]+c[m])
for i in sorted(L,reverse=True)[:k]:
    print(i)
### BUGGY CODE ###

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

i = 0
cnt = 0
while len(A) > i:
    if A[i] != i + 1:
        A.pop(i)
        cnt += 1
    else:
        i += 1
if cnt == n:
    print(-1)
else:
    print(cnt)



### FIXED CODE ###

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

i = 1
cnt = 0
for a in A:
    if a != i:
        cnt += 1
    else:
        i += 1
if cnt == n:
    print(-1)
else:
    print(cnt)
### BUGGY CODE ###

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

for i in range(N):
    print(A.count(i+1))

### FIXED CODE ###

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

c = collections.Counter(A)

for i in range(N):
    print(c[i+1])
### BUGGY CODE ###

def main():
    import numpy as np
    n, k = map(int, input().split())
    H = list(map(int, input().split()))
    s = np.array(sorted(set(H+[0])), dtype=np.int64)
    d = {i: j for j, i in enumerate(s)}
    l = len(s)
    a = max(s)-s
    dp = np.full((k+1, l), 10**13, dtype=np.int64)
    dp[0, 0] = 0

    if k > 0:
        for h in H:
            dh = d[h]
            dp2 = np.zeros((k+1, l), dtype=np.int64)
            s_plus_a = a+dp[:-1]
            min_s = dp[:-1]
            for j in range(l-2, -1, -1):
                min_s[:, j] = np.minimum(min_s[:, j+1], min_s[:, j])
            for j in range(1, l):
                s_plus_a[:, j] = np.minimum(s_plus_a[:, j-1], s_plus_a[:, j])
            dp2[1:, :] = np.minimum(min_s, s_plus_a - a)
            dp2[0, :] = 10**13
            for j in range(l):
                dp2[:, dh] = np.minimum(dp2[:, dh], dp[:, j]+max(h-s[j], 0))
            dp = dp2
    else:
        for h in H:
            dh = d[h]
            dp2 = np.full((1, l), 10**13, dtype=np.int64)
            for j in range(l):
                dp2[:, dh] = np.minimum(dp2[:, dh], dp[:, j]+max(h-s[j], 0))
            dp = dp2
    print(np.min(dp))


main()


### FIXED CODE ###

def main():
    n, K = map(int, input().split())
    H = list(map(int, input().split()))
    s = sorted(set(H+[0]))
    d = {i: j for j, i in enumerate(s)}
    l = len(s)
    m = max(s)
    a = [m-i for i in s]
    dp = [[10**13]*l for _ in range(K+1)]
    dp[0][0] = 0
    for h in H:
        dh = d[h]
        dp2 = [[0]*l for _ in range(K+1)]
        dp2[0] = [10**13]*l
        t = [[0]*l for _ in range(K)]
        for i in range(K):
            for j in range(l):
                t[i][j] = dp[i][j]+a[j]
        min_s = [[10**13]*l for i in range(K+1)]

        for i in range(K):
            for j in range(l-2, -1, -1):
                min_s[i][j] = min(dp[i][j+1], min_s[i][j])
            for j in range(1, l):
                t[i][j] = min(t[i][j-1], t[i][j])
            for j in range(l):
                t[i][j] = t[i][j]-a[j]

        for i in range(K):
            for j in range(l):
                dp2[i+1][j] = min(min_s[i][j], t[i][j])

        for i in range(K+1):
            temp = 10**13
            for j in range(l):
                temp = min(temp, dp[i][j]+max(h-s[j], 0))
            dp2[i][dh] = min(dp2[i][dh], temp)
        dp = dp2
    print(min([min(i) for i in dp]))


main()
### BUGGY CODE ###

N, M = [int(i) for i in input().split()]
ab = []

possible = False
for _ in range(M):
    ab.append([int(i) for i in input().split()])
    

c = []
e = []
for d in ab:
    if d[1] == N:
        c.append(d[0])
    elif d[0] == 1:
        e.append(d[1])

for f in e:
    if f in c:
        possible = True
        break

if possible:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

N, M = [int(i) for i in input().split()]
ab = []

possible = False
for _ in range(M):
    ab.append([int(i) for i in input().split()])
    

c = []
e = []
for d in ab:
    if d[1] == N:
        c.append(d[0])
    elif d[0] == 1:
        e.append(d[1])

if len(set(c) & set(e)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

import sys
import itertools

N = int(input())
L = [int(v) for v in sys.stdin.readline().split()]

print(len([(a, b, c) for a, b, c in itertools.combinations(L, 3) if a + b > c and b + c > a and a + c > b]))



### FIXED CODE ###

import sys
from bisect import bisect_left

N = int(input())
A = [int(v) for v in sys.stdin.readline().split()]

A = sorted(A)

cnt = 0
for i in range(N - 2):
    for j in range(i+1, N - 1):
        ij = A[i] + A[j]
        cnt += bisect_left(A, ij) - (j + 1)
print(cnt)
### BUGGY CODE ###

import math

N,M = map(int,input().split(' '))
An = [ int(input()) for _ in range(M)]

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def one_two_comb(N):
    two_n = N//2
    comb_list = []
    for i in range(1,two_n+1):
        comb_list.append([N-i,i])
    return comb_list

def sum_comb(comb_list):
    comb_sum = 0
    for val in comb_list:
        comb_sum += combinations_count(val[0],val[1])
    return comb_sum
    

diff_list = []
current_num = 0
for a in An:
    diff = a - current_num
    if diff == 0:
        print(0)
        exit(0)
    diff_list.append(diff)
    current_num = a +1
diff = N+1 - current_num
diff_list.append(diff)
#print(diff_list)

all_sum = 1
for idx,diff in enumerate(diff_list):
    if idx == 0 or len(diff_list):
        diff -= 1
    '''
    else:
        diff -= 2
    '''

    if diff == 0:
        all_sum *= 1
    else:
        internal_comb_list = one_two_comb(diff)
        comb_count = sum_comb(internal_comb_list) + 1
        if all_sum > 10**9+7:
            all_sum = all_sum%(10**9+7)
        all_sum *= comb_count
print(all_sum%(10**9+7))


### FIXED CODE ###

import math

N,M = map(int,input().split(' '))
An = [ int(input()) for _ in range(M)]

'''
factorial_list = [1] * (N+1)
for i in range(1,N+1):
    factorial_list[i] = factorial_list[i-1] * i

def combinations_count(n, r):
    return factorial_list[n] // (factorial_list[n - r] * factorial_list[r])
'''

feruma_list = [1] * (N+1)
for i in range(2,N+1):
    feruma_list[i] = feruma_list[i-2] + feruma_list[i-1]


def nCk(n, k):
    ret = 1
    mo = 10**9 + 7
    for i in range(k):
        ret = ret * (n - i) * pow(i + 1, mo - 2, mo) % mo
    return ret

def one_two_comb(N):
    two_n = N//2
    comb_list = []
    for i in range(1,two_n+1):
        comb_list.append([N-i,i])
    return comb_list

def sum_comb(comb_list):
    comb_sum = 0
    for val in comb_list:
        comb_sum += nCk(val[0],val[1])
    return comb_sum
    

diff_list = []
current_num = 0
max_diff = -1
for a in An:
    diff = a - current_num
    if diff == 0:
        print(0)
        exit(0)
    diff_list.append(diff)
    current_num = a +1
diff = N+1 - current_num
diff_list.append(diff)
#print(diff_list)


all_sum = 1
for idx,diff in enumerate(diff_list):
    
    if idx == 0 or len(diff_list):
        diff -= 1
    '''
    if diff == 0:
        all_sum *= 1
    else:
        internal_comb_list = one_two_comb(diff)
        comb_count = sum_comb(internal_comb_list) + 1
        if all_sum > 10**9+7:
            all_sum = all_sum%(10**9+7)
        all_sum *= comb_count
    '''

    comb_count = feruma_list[diff]
    if all_sum > 10**9+7:
        all_sum = all_sum%(10**9+7)
    all_sum *= comb_count

print(all_sum%(10**9+7))
### BUGGY CODE ###

k,s = map(int,input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                cnt += 1
print(cnt)

### FIXED CODE ###

k,s = map(int,input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-x-y <= k:
            cnt += 1
print(cnt)
### BUGGY CODE ###

import heapq

X,Y,Z,K = map(int,input().split())
A, B, C = [], [], []
[heapq.heappush(A, -a) for a in map(int,input().split())]
[heapq.heappush(B, -b) for b in map(int,input().split())]
[heapq.heappush(C, -c) for c in map(int,input().split())]

max_A = [-heapq.heappop(A) for _ in range(X)]
max_B = [-heapq.heappop(B) for _ in range(Y)]
max_C = [-heapq.heappop(C) for _ in range(Z)]

ans_list = []
for max_a in max_A:
  for max_b in max_B:
    for max_c in max_C:
      heapq.heappush(ans_list, -sum([max_a,max_b,max_c]))
[print(-heapq.heappop(ans_list)) for _ in range(K)]

### FIXED CODE ###

import heapq

X,Y,Z,K = map(int,input().split())
A, B, C = [sorted(list(map(int,input().split())),reverse=True) for _ in range(3)]

Q = []
heapq.heappush(Q, [-(A[0]+B[0]+C[0]),0,0,0])
for _ in range(K):
  p, i, j, k = heapq.heappop(Q)
  print(-p)
  if i+1<X and [-(A[i+1]+B[j]+C[k]),i+1,j,k] not in Q: heapq.heappush(Q, [-(A[i+1]+B[j]+C[k]),i+1,j,k])
  if j+1<Y and [-(A[i]+B[j+1]+C[k]),i,j+1,k] not in Q: heapq.heappush(Q, [-(A[i]+B[j+1]+C[k]),i,j+1,k])
  if k+1<Z and [-(A[i]+B[j]+C[k+1]),i,j,k+1] not in Q: heapq.heappush(Q, [-(A[i]+B[j]+C[k+1]),i,j,k+1])
### BUGGY CODE ###

def maxProductSubarrayOfSizeK(A, n, k): 

	A.sort() 

	product = 1

	if (A[n - 1] == 0 and (k & 1)): 
		return 0

	if (A[n - 1] < 0 and (k & 1)): 
	    A.reverse()
	    for i in range(k):
	        product *= A[i]
	    return product

	i = 0

	j = n - 1

	if (k & 1): 
		product *= A[j] 
		j-= 1
		k-=1

	k >>= 1

	for itr in range( k) : 

		left_product = A[i] * A[i + 1] 

		right_product = A[j] * A[j - 1] 

		if (left_product > right_product) : 
			product *= left_product 
			i += 2
		
		else : 
			product *= right_product 
			j -= 2

	return product 

n, k = map(int, input().split(' '))
numbers = [int(x) for x in input().split(' ')]
MOD = 1000000007
ans = maxProductSubarrayOfSizeK(numbers, n, k)
#print(ans)
print((ans + MOD)%MOD)

### FIXED CODE ###

MOD = 1000000007
def maxProductSubarrayOfSizeK(A, n, k): 

	A.sort() 

	product = 1

	if (A[n - 1] == 0 and (k & 1)): 
		return 0

	if (A[n - 1] < 0 and (k & 1)): 
	    A.reverse()
	    for i in range(k):
	        product *= A[i]
	        if abs(product) >= MOD:
	            product = product%MOD
	    return product

	i = 0

	j = n - 1

	if (k & 1): 
		product *= A[j]
		product %= MOD
		j-= 1
		k-=1

	k >>= 1

	for itr in range( k) : 

		left_product = A[i] * A[i + 1] 

		right_product = A[j] * A[j - 1] 

		if (left_product > right_product) : 
			product *= left_product 
			product %= MOD
			i += 2
		
		else : 
			product *= right_product
			product %= MOD
			j -= 2

	return product 

n, k = map(int, input().split(' '))
numbers = [int(x) for x in input().split(' ')]
ans = maxProductSubarrayOfSizeK(numbers, n, k)
#print(ans)
print((ans + MOD)%MOD)
### BUGGY CODE ###

n=input()
s=[]
for i in range(n):
	s+=[raw_input()]
result=0
for shift in range(n):
	ok=True
	for i in range(n):
		for j in range(n):
			if s[i][j]!=s[j][i]:
				ok=False
				break
	if ok:
		result+=n
	s=s[1:]+s[:1]
print result

### FIXED CODE ###

n=input()
s=[raw_input() for i in range(n)]
t=[]
for i in range(n):
	t+=[s[j][i] for j in xrange(n)]*2
s+=s
s=''.join(s)
#print s
t=''.join(t)
#print t
result=0
for shift in xrange(n):
	ok=True
	for i in xrange(n):
		if s[(i+shift)*n: (i+shift)*n+n]!=t[i*n*2+shift: i*n*2+shift+n]:
			ok=False
			break
	if ok:
		result+=n
print result
### BUGGY CODE ###

n = int(input())
d = list(map(int, input().split()))
if d[0] != 0:
    print(0)
else:
    x = 1
    for i in range(min(d), max(d)):
        x = x * (d.count(i) ** d.count(i+1))
    print(x%998244353)

### FIXED CODE ###

n = int(input())
d = list(map(int, input().split()))
if d[0] != 0:
    print(0)
else:
    import collections
    c = collections.Counter(d)
    c_sorted = sorted(c.items())
    u = [x[1] for x in c_sorted]
    u.remove(u[0])
    if len(u)!= max(d):
        print(0)
    else:
        if d.count(0) > 1:
            print(0)
        else:
            x = 1
            for i in range(len(u)-1):
                x = x * (u[i] ** u[i+1])
                 
            print(x%998244353)
### BUGGY CODE ###

import collections
input()
math_dic = collections.Counter((map(int,input().split())))
num = int(input())
for i in range(num):
    a,b = map(int,input().split())
    if a not in math_dic:
        print(sum([index*value for index,value in math_dic.items()]))
        continue
    if b not in math_dic:
        math_dic[b] = 0
    math_dic[b] += math_dic.pop(a)
    print(sum([index*value for index,value in math_dic.items()]))

### FIXED CODE ###

import collections
input()
math_dic = collections.Counter((map(int,input().split())))
num = int(input())
total_num = sum([index*value for index,value in math_dic.items()])
for i in range(num):
    a,b = map(int,input().split())
    if a not in math_dic:
        print(total_num)
        continue
    if b not in math_dic:
        math_dic[b] = 0
    total_num -= a*math_dic[a]
    total_num += b*math_dic[a]
    math_dic[b] += math_dic.pop(a)
    print(total_num)
### BUGGY CODE ###

import copy
siken_kazu=int(input())
junbido=[int(i) for i in input().split(" ")]
goukakudo=[int(i) for i in input().split(" ")]
yoyudo=[junbido[i]-goukakudo[i] for i in range(siken_kazu)]
shoki_yoyudo=copy.deepcopy(yoyudo)
k=0
hantei=2
if sum(junbido)<sum(goukakudo):
    k=-1
elif min(yoyudo)>=0:
    pass
else:
    while hantei>1:
        hantei=0
        a=max(yoyudo)
        for i in range(siken_kazu):
            if yoyudo[i]==a:
                kiroku=i
                break
        for i in range(siken_kazu):
            if yoyudo[kiroku]==0:
                break
            elif yoyudo[i]<0:
                hantei=2
                if yoyudo[kiroku]>=-yoyudo[i]:
                    yoyudo[kiroku]-=-yoyudo[i]
                    yoyudo[i]=0
                elif yoyudo[kiroku]<-yoyudo[i]:
                    yoyudo[kiroku]=0
                    yoyudo[i]+=-yoyudo[kiroku]
for i in range(siken_kazu):
    if shoki_yoyudo[i]!=yoyudo[i]:
        k+=1
print(k)

### FIXED CODE ###

import copy
siken_kazu=int(input())
junbido=[int(i) for i in input().split(" ")]
goukakudo=[int(i) for i in input().split(" ")]
yoyudo=[junbido[i]-goukakudo[i] for i in range(siken_kazu)]
counter=0
shakkin=0
tyokin=0
if sum(junbido)<sum(goukakudo):
    counter=-1
else:
    for i in yoyudo:
        if i<0:
            counter+=1
            shakkin-=i
    yoyudo=sorted(yoyudo,reverse=True)
    for i in yoyudo:
        if tyokin>=shakkin:
            break
        else:
            tyokin+=i
            counter+=1
print(counter)
### BUGGY CODE ###

from heapq import heappop, heappush

n = int(input())
q = [tuple(int(x) for x in input().split()) for _ in range(n)]

L = []
R = []
a = 1
b = q[0][2]

heappush(L, -q[0][1])

for i in range(1, n):
    temp = q[i]
    if temp[0] == 1:
        a += 1
        if a % 2 == 0:
            tl = - heappop(L)
            if temp[1] >= tl:
                heappush(R, temp[1])
                heappush(L, - tl)
            else:
                heappush(L, - temp[1])
                heappush(R, tl)
        else:
            tr = heappop(R)
            if temp[1] <= tr:
                heappush(L, - temp[1])
                heappush(R, tr)
            else:
                heappush(L, - tr)
                heappush(R, temp[1])
        b += temp[2]
    else:
        m = heappop(L)
        heappush(L, m)
        m *= -1
        ans = b
        for x in L:
            ans += abs(m + x)
        for x in R:
            ans += abs(m - x)
        print(m, ans)

### FIXED CODE ###

from heapq import heappop, heappush, heappushpop

n = int(input())
q = [tuple(int(x) for x in input().split()) for _ in range(n)]

L = []
R = []
a = 1
b = q[0][2]

ans = 0

heappush(L, -q[0][1])

for i in range(1, n):
    temp = q[i]
    if temp[0] == 1:
        a += 1
        if a % 2 == 0:
            ans += abs(temp[1] + L[0])
            p = heappushpop(L, - temp[1])
            heappush(R, - p)
        else:
            ans += abs(temp[1] + L[0])
            tl = L[0]
            p = heappushpop(R, temp[1])
            heappush(L, - p)
            if tl != L[0]:
                ans -= abs(tl - L[0])
        b += temp[2]
    else:
        m = - L[0]
        print(m, ans + b)
### BUGGY CODE ###

from itertools import combinations
s = input()
n = len(s)
k = int(input())
ij = list(combinations(range(n+1), 2))
#print(ij)
substr = []
for i, j in ij:
    sub = s[i:j]
    if sub not in substr:
        substr.append(s[i:j])
substr.sort()
print(substr[k-1])


### FIXED CODE ###


s = input()
n = len(s)
k = int(input())
substr = []
for j in range(k):
    for i in range(n-j):
        sub = s[i:i+j+1]
        if sub not in substr:
            substr.append(sub)
substr.sort()
print(substr[k-1])
### BUGGY CODE ###

n,k=map(int,input().split())
H=list(map(int,input().split()))+[0]*k

def flog(n):
    inf=float('inf')
    dp=[inf]*(10**5+200)
    
    dp[0]=0
    
    for i in range(n):
        for j in range(1,k+1):
            dp[i+j]=min(dp[i+j],dp[i]+abs(H[i]-H[i+j]))
            
    return dp[n-1]

print(flog(n))


### FIXED CODE ###

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

def flog(n):
	inf=float('inf')
	dp=[inf]*n
	
	dp[0]=0
	
	for i in range(n):
		for j in range(1,min(k+1,n-i)):
			dp[i+j]=min(dp[i+j],dp[i]+abs(H[i+j]-H[i]))
	
	return dp[n-1]
print(flog(n))
### BUGGY CODE ###

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()

from math import factorial
def comb(n):
    if n<=1:
        return 0
    if n==2:
        return 1
    return factorial(n)//(factorial(2)*factorial(n-2))

c=[a.count(i) for i in range(1,n+1)]
d=[comb(m) for m in c]

for i in range(n):
    num=a[i]-1
    if d[num]>1:
        e=d.copy()
        e[num]=d[num]*(c[num]-2)//c[num]
        print(sum(e))
    elif d[num]==1:
        print(sum(d)-1)
    else:
        print(sum(d))

### FIXED CODE ###

def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()

def comb(n):
    if n<=1:
        return 0
    if n==2:
        return 1
    return (n*(n-1))//2

from collections import Counter
c=Counter(a)
# print(c)
d={i:comb(j) for i,j in c.items()}
# print(d)
s=sum(d.values())
# print(s)

for i in a:
    print(s-d[i]+comb(c[i]-1))
### BUGGY CODE ###

import math

N = int(input())

for i in range(1, N + 1):
    cnt = 0
    for x in range(1, N + 1):
        for y in range(1, N + 1):
            if x * x + y * y + x * y >= i:
                continue
            a = i - (x * x + y * y + x * y)
            # z^2+z(x+y) - a = 0
            z = (-(x + y) + math.sqrt((x + y) ** 2 + 4 * a)) / 2
            if 1 <= z and z <= N and z.is_integer():
                cnt += 1
    print(cnt)



### FIXED CODE ###

N = int(input())

N_MAX = 10 ** 4
cnt = [0] * (N_MAX + 1)

for x in range(1, N + 1):
    if x ** 2 > N:
        break
    for y in range(1, N + 1):
        if x ** 2 + y ** 2 + x * y > N:
            break
        for z in range(1, N + 1):
            a = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + x * z
            if a > N:
                break
            cnt[a] += 1

for i in range(1, N + 1):
    print(cnt[i])
### BUGGY CODE ###

# -*- coding:utf-8 -*-
n = input()
n = n.split()
K,S = map(int, n)

count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                count += 1
print(count)

### FIXED CODE ###

arr = input().split()
k = int(arr[0])
s = int(arr[1])

count = 0
for x in range(k+1):
    for y in range(k+1):
        if s - x - y >= 0:
           z = s - x - y
           if z <= k:
               count += 1
print(count)
### BUGGY CODE ###

import collections
N = int(input())
S = [input() for _ in range(N)]

counter = collections.Counter(S)

answers = [k for k, v in counter.items() if v == max(counter.values())]
answers.sort()
for x in answers:
  print(x)

### FIXED CODE ###

import collections
N = int(input())
counter = collections.Counter([input() for _ in range(N)])
maximum = max(counter.values())
answers = [k for k, v in counter.items() if v == maximum]
answers.sort()
for x in answers:
  print(x)
### BUGGY CODE ###

import bisect
N, M = map(int, input().split())
A = sorted(map(int, input().split()))
for _ in range(M):
    x = A.pop()
    y = x // 2
    i = bisect.bisect_left(A, y)
    A.insert(i, y)
ans = sum(A)
print(ans)

### FIXED CODE ###

import bisect
N, M = map(int, input().split())
A = sorted(map(int, input().split()))
for _ in range(M):
    x = A.pop()
    y = x // 2
    i = bisect.bisect_left(A, y)
    A.insert(i, y)
ans = sum(A)
print(ans)
### BUGGY CODE ###

s = input()
k = int(input())

sub = []

for i in range(len(s)):
    for j in range(i,len(s)):
        if s[i:j+1] not in sub:
            sub.append(s[i:j+1])

sub.sort()

print(sub[k-1])

### FIXED CODE ###

s = input()
k = int(input())

sub = []

for i in range(len(s)):
    for j in range(1,6):
        if s[i:i+j] not in sub:
            sub.append(s[i:i+j])
            sub.sort()
        if len(sub) > 5:
            sub = sub[:5]

print(sub[k-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]

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

l, r = 1, 1

for x, y in L:
    c = 1
    while True:
        xx = x * c
        yy = y * c
            
        if l <= xx and r <= yy:
            l, r = xx, yy
            break
        else:
            c += 1

print(l + r)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]

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

l, r = 1, 1

for x, y in L:
    c = max(l // x, r // y)
    while True:
        xx = x * c
        yy = y * c
            
        if l <= xx and r <= yy:
            l, r = xx, yy
            break
        else:
            c += 1

print(l + r)
### BUGGY CODE ###

n, k = map(int, input().split())
p = list(map(lambda x: int(x) + 1, input().split()))
max_ans = 0
for i in range(n-k+1):
    max_ans = max(max_ans, sum(p[i:k+i]))
print(max_ans/2)

### FIXED CODE ###

import numpy as np
n, k = map(int, input().split())
p = np.array(list(map(int, input().split())))
p += 1
sum_E = np.cumsum(p)
sum_e = np.append([0], sum_E)
ans = -1
for i in range(n-k+1):
    ans = max(ans, sum_e[i+k] - sum_e[i])
print(ans/2)