Harryxun/stf_run huggingface dataset:
from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))

ruiseki = [0]
for ai in a:
    ruiseki.append(ruiseki[-1] + ai)

d = defaultdict(lambda:0)
for ri in ruiseki:
    d[ri] += 1

def comb_fermat(n:int, r:int)->int:
    # Fermat's little theorem: O(r)
    # return nCr
    if r > n: return 0
    if r > n-r: return comb_fermat(n, n-r)
    mul,div = 1,1
    for i in range(r):
        mul *= n-i
        div *= i+1

    ret = mul * pow(div, MOD-2)
    return ret

ans = 0
for k in d.keys():
    ans += comb_fermat(d[k], 2)
print(ans)


### FIXED CODE ###

# a 200
from collections import Counter
from math import factorial

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

#累計和
wa = [0]
for ai in a:
    wa.append(wa[-1]+ai)
wa = wa[1:]

def combination(n, r):
    return factorial(n)//(factorial(r)*factorial(n-r))

c = Counter(wa)
ans = 0

for k,v in c.items():
    if v<2: continue
    ans += combination(v, 2)
    
ans += c[0]
print(ans)
INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がj以下の時の最小コスト
dp = [[INF for j in range(H + 2)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 2):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

if dp[N][H] == INF:
    print(dp[N][H + 1])
else:
    print(dp[N][H])


### FIXED CODE ###

INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がjの時の最小コスト
dp = [[INF for j in range(H + 1)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 1):
        if j < A[i]:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + B[i])
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

print(dp[N][H])
def cin():
	return map(int,input().split())

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))


a,b,c  = cin()
p = -1
q = 1e9
r = -1
s = 1e9
for i in range(c):
  x,y,z = cin()
  if z==1:
    p = max(x,p)
  elif z==2:
    q = min(x,q)
  elif z==3:
    r = max(r,y)
  else:
    s = min(s,y)

if p==-1:
    p = 0
if q==1e9:
    q = a
if r==-1:
    r=0
if s==1e9:
    s=b

# v = a-(a-p-1+a-q)
# w = b-(b-r+b-s)
# print(v,w)
ans = (q-p)*(s-r)
if ans>0:
    print(ans)
else:
    print(0)
# print(ans if ans>0 else 0)

# l1 = list(range(0,p+1))
# l2 = list(range(q,a))
# l1 = set(l1)
# l2 = set(l2)
# l3 = l1.union(l2)

# l4 = list(range(0,r))
# l5 = list(range(s,b+1))
# l4 = set(l4)
# l5 = set(l5)
# l6 = l4.union(l5)
# # print(l3,l6)
# # print(l1,l2)
# # print(p,q,r,s)
# if(len(l3)==a or len(l6)==b):
#     print(0)
# else:
#     print((a-len(l3)+1)*(b-len(l6)+1))
    
    
  


### FIXED CODE ###

def cin():
	return map(int,input().split())

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))



a = cina()
a.sort()
if a[0]+a[1]==a[2]:
  print("Yes")
else:
  print("No")
def main():
    n = int(input())
    result = True
    used = {str(input()): 0}
    for order in range(1,n):
        word = str(input())
        if word in used or list(used.keys())[order - 1][-1] != word[0]:
            result = False
            break
        else:
            used.setdefault(word,0)
    print("Yes" if result else "No")
        
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
  A, B = map(int, input().split())
  print('Yes'if (A * B)**2 % 2 == 1 else 'No')
 
 
if __name__ == "__main__":
  main()
# coding: utf-8

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

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_min <= i <= R_min]
print(len(ids))


### FIXED CODE ###

# coding: utf-8

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

ids = list(range(1, N+1))

L_max = 0
R_min = 10000000000000000000
for _ in range(M):
    (L, R) = map(int, input().split(" "))
    if L > L_max:
        L_max = L
    if R < R_min:
        R_min = R

ids = [i for i in ids if L_max <= i <= R_min]
print(len(ids))
import random

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

X = A[0]
Y = A[1]
Z = 0
for a in A[2:]:
  Z ^= a

if ((X^Y)&1)!=(Z&1):
  print(-1)
  exit(1)

def solve(X2, Y2):
  if ((X2^Y2)&1)!=(Z&1):
    return -1
  d = 0
  for i in range(1, 100):
    if (((X2-d)^(Y2+d))>>i&1)!=(Z>>i&1):
      d += 1<<(i-1)
  if d<X2:
    return d
  else:
    return -1

ans = solve(X, Y)
for i in range(10000):
  if ans<=2:
    break
  r = random.randint(1, ans-1)
  a = solve(X-r, Y+r)
  if a!=-1 and r+a<ans:
    ans = r+a
print(ans)


### FIXED CODE ###

import random

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

S = A[0]+A[1]
X = 0
for a in A[2:]:
  X ^= a

D = (S-X)>>1
if S!=X+(D<<1) or D>A[0] or (X&D)!=0:
  print(-1)
  exit(0)

a = 0
b = 2**64
while b>0:
  if (D&b)!=0:
    a |= b
  elif (X&b)!=0:
    if (a|b|D&(b-1))<=A[0]:
      a |= b
  b >>= 1
if a==0:
  print(-1)
  exit(0)
print(A[0]-a)
# -*- coding: utf-8 -*-
import sys


def answer(N, A, B):
    rail = N * A
    taxi = B

    return min(rail, taxi)


if __name__ == '__main__':
    args = sys.stdin
    answer(args[0], args[1], args[2])


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys


def answer(N, A, B):
    rail = N * A
    taxi = B

    print(min(rail, taxi))


if __name__ == '__main__':
    args = sys.stdin.read().split(' ')
    answer(int(args[0]), int(args[1]), int(args[2]))
def solve(string):
    n, k, s = string.split()
    n, k = map(int, [n, k])
    s = "1" + s + "0"
    starts = [1]
    ends = []
    for i, (s0, s1) in enumerate(zip(s, s[1:])):
        if s0 == "0" and s1 == "1":
            starts.append(i + 1)
        elif s0 == "1" and s1 == "0":
            ends.append(i + 1)
    return str(max([e - s for s, e in zip(starts, ends[k:])])) if len(starts) > k else str(n)


if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

def solve(string):
    n, k, s = string.split()
    n, k = map(int, [n, k])
    flip = [0]
    for i, (s0, s1) in enumerate(zip(s, s[1:]), start=1):
        if s0 != s1:
            flip.append(i)
    flip += [n]
    return str(
        max([
            flip[min(len(flip) - 1, i + 2 * k + (i % 2 ^ int(s[0])))] - flip[i]
            for i in range(len(flip))
        ]))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
n = int(input())
a = [i for i in range(1,n+1)]
b = []
for j in range(9):
    if n%int(a[j]) == 0:
        b.append(int(a[j]) + n//int(a[j]) -2)
print(min(b))

### FIXED CODE ###

n = int(input())
a = [i for i in range(1,int((n)**0.5 +1))]
a.reverse()
#print(a)
for j in range(len(a)):
    if n%int(a[j]) == 0:
        print(int(int(a[j]) + n//int(a[j]) -2))
        break
n,k = map(int,input().split())
ls = list(map(int,input().split()))
i = 1
di = [-1]*10
di[0] = 0
while True:
    if i == 1:
        a = ls[0]
        di[a-1] = i
        i += 1
        continue
    if i == k+1:
        print(a)
        break
    a = ls[a-1]
    if di[a-1] != -1:
        p = (k+1-di[a-1])%(i-di[a-1])
        s = i-di[a-1]
        if p ==0:
            q = di.index(i-1)+1
            print(q)
        else:
            q = di.index(i-s-1+p)+1
            print(q)
        break
    di[a-1] = i
    i += 1
print(di)

### FIXED CODE ###

n,k = map(int,input().split())
ls = list(map(int,input().split()))
fi = [-1]*(n+1)
fi[1] = 0
a = 0
aa = 0
for i in range(k):
    if fi[ls[a]] == -1:
        fi[ls[a]] = i + 1
        aa = a
        a = ls[a] - 1
    else:
        ind = fi[ls[a]]
        t = (k - ind) % (max(fi) + 1 - ind)
        t += ind
        print(fi.index(t))
        break
else:
    print(ls[aa])
l=list(map(int,input().split()))
if count(l,5)==2 and count(l,7)==1:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

l=map(int,input().split())
if sorted(l)==[5,5,7]:
  print('YES')
else:
  print('NO')
a,*b,c = input()
print(a+string(b)+c)

### FIXED CODE ###

a,*b,c = input()
print(a+str(len(b))+c)
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

# k分で読める本の累積
a_ruiseki = [0]*(k+10)
b_ruiseki = [0]*(k+10)
a_cnt = 1
b_cnt = 1
a_sum = a[0]
b_sum = b[0]
for i in range(k+1):
    if a_sum == i and a_cnt < len(a)+1:
        a_cnt += 1
        tmp = min(a_cnt-1, len(a)-1)
        a_sum+=a[tmp]
    if b_sum == i and b_cnt < len(b)+1:
        b_cnt += 1
        tmp = min(a_cnt-1, len(a)-1)
        b_sum+=b[tmp]
    a_ruiseki[i] = a_cnt-1
    b_ruiseki[i] = b_cnt-1

#    print(f'{i} {a_cnt-1}')
#
#print(a_ruiseki)
#print(b_ruiseki)

ans = 0
for i in range(k+1):
    ans = max(ans, a_ruiseki[i]+b_ruiseki[k-i])
print(ans)

### FIXED CODE ###

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

a = [0]
b = [0]
for i in range(0, n):
    a.append(A[i] + a[i])
for i in range(0, m):
    b.append(B[i] + b[i])

ans = 0
j = m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k-a[i]:
        j -= 1
    ans = max(ans, i+j)

print(ans)
H,W,K = map(int,input().split(sep=" "))
S = [list(map(int,list(input()))) for i in range(0,H,1)]
minimum = H+W
for sepH in range(0,2**(H-1),1):
    bitcounter = 0
    tmp_sepH = sepH
    while tmp_sepH > 0:
        if tmp_sepH & 1 == 1:
            bitcounter+=1
        tmp_sepH = tmp_sepH//2
    A = [[0 for i in range(0,W,1)] for j in range(0,bitcounter+1,1)]
    index=[[]for i in range(0,bitcounter+1,1)]
    countInd = 0
    for i in range(0,H,1):
        index[countInd].append(i)
        if (sepH >> i) & 1:
            countInd +=1
   
    for j in range(0,bitcounter+1,1):
        for i in range(0,W,1):
            for k in range(0,len(index[j]),1):
                if S[index[j][k]][i] == 1:
                    A[j][i]+=1
    countA=[0 for i in range(0,bitcounter+1,1)]
    sepCounter = 0
    dame = False
    for i in range(0,W,1):
        if i == 0:
        for j in range(0,bitcounter+1,1):
            if A[j][i] > K:
                dame = True
            if countA[j] + A[j][i] > K:
                sepCounter +=1
                j=0
                for i in range(0,bitcounter+1,1):
                    countA[i]=0
                
            countA[j] += A[j][i]

    if bitcounter+sepCounter < minimum and (not dame):
        minimum = bitcounter +sepCounter

print(minimum)


### FIXED CODE ###

H,W,K = map(int,input().split(sep=" "))
S = [list(map(int,list(input()))) for i in range(0,H,1)]
minimum = H+W
for sepH in range(0,2**(H-1),1):
    bitcounter = 0
    tmp_sepH = sepH
    while tmp_sepH > 0:
        if tmp_sepH & 1 == 1:
            bitcounter+=1
        tmp_sepH = tmp_sepH//2
    A = [[0 for i in range(0,W,1)] for j in range(0,bitcounter+1,1)]
    index=[[]for i in range(0,bitcounter+1,1)]
    countInd = 0
    for i in range(0,H,1):
        index[countInd].append(i)
        if (sepH >> i) & 1:
            countInd +=1
   
    for j in range(0,bitcounter+1,1):
        for i in range(0,W,1):
            for k in range(0,len(index[j]),1):
                if S[index[j][k]][i] == 1:
                    A[j][i]+=1
    countA=[0 for i in range(0,bitcounter+1,1)]
    sepCounter = 0
    dame = False
    for i in range(0,W,1):
        for j in range(0,bitcounter+1,1):
            if A[j][i] > K:
                dame = True
        for j in range(0,bitcounter+1,1):
            countA[j]+=A[j][i]
            if countA[j] > K:
                sepCounter+=1
                for j in range(0,bitcounter+1,1):
                    countA[j] = A[j][i]
                break

    if bitcounter+sepCounter < minimum and (not dame):
        minimum = bitcounter +sepCounter

print(minimum)
sss = input()
print(sss.count(1))


### FIXED CODE ###

sss = input()
print(sss.count("1"))
a,b,c = map(int,input().split())

if b-a+1 > 2*c:
    for i in range(a,a+c):
    print(i)
    for i in range(b-c+1,b):
    print(i)
else:
    for i in range(a,b+1):
    print(i)

### FIXED CODE ###

a,b,c = map(int,input().split())

if b-a+1 > 2*c:
    for i in range(a,a+c):
        print(i)
    for i in range(b-c+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)
l=sorted(list(map(int,input().split())))
k=int(input())
#print(l,k)
l[2]=(2**k)*l[2]
print(sum(l))

### FIXED CODE ###

a,b=map(int,input().split())
print(a if (a<=b) else a-1)
import bisect
 
 
N = int(input())
 
lis = []
 
A1 = int(input())
 
 
lis.append(A1)
 
 
for i in range(N-1):
 
    A = int(input())
 
    flag = True
    ins = bisect.bisect_left(lis,A)
 
    if ins == 0:
        B = [A] + lis
        lis = B.copy()
 
    if lis[ins-1] < A:
        lis[ins-1] = A
 
"""
    for l in lis:
 
 
 
        if l < A:
            l = A
            flag = False
            lis.sort()
            maxi = max(maxi , i)
            break
 
    if flag:
        lis.append(A)
"""
 
#print (lis)
print (len(lis))


### FIXED CODE ###

import bisect

N = int(input())

A = []

for i in range(N):

    a = int(input())
    A.append(a)

A.reverse()

seq = [float("-inf")]

for i in A:

    ind = bisect.bisect_right(seq,i)

    if ind == len(seq):
        seq.append(i)
    else:
        seq[ind] = i

print (len(seq)-1)
n=int(input())
a=list(map(int,input().split()))
ans=0
b=[0]*n
for i in range(n):
    b[a[i]]+=1
for k in b:
    ans+=k*(k-1)//2
for i in range(n):
    print(ans-b[a[i]]+1)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
b=[0]*(n+1)
for i in range(n):
    b[a[i]]+=1
for k in b:
    ans+=k*(k-1)//2
for i in range(n):
    print(ans-b[a[i]]+1)
A, B, C, K = map(int, input().split())
num = 0
 
for i in range(K):
    if(A >  i):
        num+=1
    elif(A+B >  i):
        continue
    else:
        num-=1
 
print(num)

### FIXED CODE ###

S = input()
T = input()

if(S==T[:-1]):
    print('Yes')
else:
    print('No')
A,B,C,D,E,F = (int(i) for i in input().split())

water_list = []
suger_list = []

for i in range(F):
  if 100*A*i <= F:
    for j in range(F):
      if 100*B*j <= F:
        if 100*A*i + 100*B*j <= F:
          water_list.append(100*A*i + 100*B*j)
        else:
          break
      else:
        break
  else:
    break

for i in range(F):
  if C*i <= F:
    for j in range(F):
      if D*j <= F:
        if C*i + D*i <= F:
          suger_list.append(C*i+D*j)
        else:
          break
      else:
        break
  else:
    break

ans = 0
ans_list = []

for water in water_list:
  for suger in suger_list:
    if water != 0 and suger != 0:
      if suger/(water + suger) > ans and water+suger <= F and suger <= (water/100)*E:
        ans = suger/(water + suger)
        ans_list = [water,suger]

print(str(ans_list[0]+ans_list[1]) + " " + str(ans_list[1]))


### FIXED CODE ###

A,B,C,D,E,F = (int(i) for i in input().split())

water_list = []
suger_list = []

for i in range(F):
  if 100*A*i <= F:
    for j in range(F):
      if 100*B*j <= F:
        if 100*A*i + 100*B*j <= F:
          water_list.append(100*A*i + 100*B*j)
        else:
          break
      else:
        break
  else:
    break

for i in range(F):
  if C*i <= F:
    for j in range(F):
      if D*j <= F:
        if C*i + D*i <= F:
          suger_list.append(C*i+D*j)
        else:
          break
      else:
        break
  else:
    break

ans = 0
ans_list = []

for water in water_list:
  for suger in suger_list:
    if water != 0 and suger != 0:
      if suger/(water + suger) >= ans and water+suger <= F and suger <= (water/100)*E:
        ans = suger/(water + suger)
        ans_list = [water,suger]

if ans != 0:
  print(str(ans_list[0]+ans_list[1]) + " " + str(ans_list[1]))
else:
  print(str(A*100) + " 0")
l = [1,2,3]
for i range (2):
  l.remove(int(input()))
print(l[0])
  

### FIXED CODE ###

l = [1,2,3]
for i in range (2):
  l.remove(int(input()))
print(l[0])
#ABC141_C
N,K,Q=map(int,input().split())
ans=[K-Q]*N
for _ in range(Q):
    ans[int(input())-1]+=1
for i in range(Q):
    if ans[i]>0:
        print('Yes')
    else:
        print('No')    

### FIXED CODE ###

#ABC141_C
import numpy as np
N,K,Q=map(int,input().split())
ans=(K-Q)*np.ones((1,N),dtype='int32')

for _ in range(Q):
    idx=int(input())
    ans[0,idx-1]+=1
ans=ans.tolist()[0]
for i in range(len(ans)):
    if ans[i]>0:
        print('Yes')
    else:
        print('No')
def task(n, m, x, c, a):
    mx = [0] * n
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    best = 1000000
    for i in range(1, (2**n) + 1):
        price = 0
        for k in range(0, m):
            states[k] = 0
        for j in range(0, n):
            if ((i >> j) & 1):
                price += c[j]
                for k in range(0, m):
                    states[k] += a[j][k]

        if price < best:
            found = True
            for k in range(0, m):
                if states[k] < x:
                    found = False
                    break

            if found:
                best = price

    print(best)


n, m, x = map(int, input().split())
c = []
a = []
for i in range(0, n):
    values = list(map(int, input().split()))
    c.append(values[0])
    a.append(values[1:])

task(n, m, x, c, a)


### FIXED CODE ###

def task(n, m, x, c, a):
    mx = [0] * m
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    best = 100000000
    for i in range(1, 2**n):
        price = 0

        for k in range(0, m):
            states[k] = 0

        for j in range(0, n):
            if ((i >> j) & 1):
                price += c[j]
                for k in range(0, m):
                    states[k] += a[j][k]

        if price < best:
            found = True
            for k in range(0, m):
                if states[k] < x:
                    found = False
                    break

            if found:
                best = price

    print(best)


n, m, x = map(int, input().split())
c = []
a = []
for i in range(0, n):
    values = list(map(int, input().split()))
    c.append(values[0])
    a.append(values[1:])

task(n, m, x, c, a)
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
using namespace std;

int N,M;
int A[10],num[10] = {0,2,5,5,4,5,6,3,7,6};
vector<int> B;
vector<string> v;

void dfs(int n,string S){
	if(n==0) v.push_back(S);
	else{
		for(int i=0;i<(int) B.size();i++){
			char c = '0'+B[i];
			if(n-num[B[i]]>=0) dfs(n-num[B[i]],S+c);
		}
	}
}

int main(){
	cin >> N >> M;
	int cnt = 100;
	int a;
	for(int i=1;i<=M;i++){
		cin >> A[i];
		if(cnt>=num[A[i]]){
			cnt = num[A[i]];
			a = A[i];
		}
	}
	set<int> s;
	sort(A+1,A+M+1,greater<int>());
	for(int i=1;i<=M;i++){
		if(s.count(num[A[i]])==0){
			B.push_back(A[i]);
			s.insert(num[A[i]]);
		}
	}
	string ans;
	while(N-cnt>=0){
		char c = '0'+a;
		ans = ans+c;
		N -= cnt;
	}
	for(int i=0;i<(int) B.size();i++){
		if(N-num[B[i]]==0){
			char c = '0'+B[i];
			if(B[i]>a) ans = c+ans;
			else ans = ans + c;
			cout << ans << endl;
			return 0;
		}
	}
	string now = ans;
	int l = ans.size();
	ans = "";
	int c = 0;
	while(c<=min(l-1,7)){
		now.erase(now.begin()+(int) now.size()-1);
		c++;
		N += cnt;
		dfs(N,"");
		for(int i=0;i<(int) v.size();i++){
			string s1 = now+v[i],s2 = v[i]+now;
			if(ans.size()>s1.size()) continue;
			if(s1>s2 && s1>ans) ans = s1;
			else if(s2>s1 && s2>ans) ans = s2;
		}
		v.clear();
	}
	cout << ans << endl;
}

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
num = [0,2,5,5,4,5,6,3,7,6]

dp = [0]*(N+1)

for i in range(N+1):
	for j in range(len(A)):
		if i-num[A[j]]<0:
			continue
		if i-num[A[j]]>0 and dp[i-num[A[j]]]==0:
			continue
		dp[i] = max(dp[i],dp[i-num[A[j]]]+1)

A.sort()
A.reverse()
ans = ""
now = N
while now!=0:
	for i in range(len(A)):
		if now-num[A[i]]<0:
			continue
		if dp[now-num[A[i]]]==dp[now]-1:
			if dp[now-num[A[i]]]==0 and now-num[A[i]]!=0:
				continue
			ans = ans+str(A[i])
			now -= num[A[i]]
			break
print(ans)
n = int(input())
s = list(open(0))
    
dic = {}
for i in range(len(s)):
    if s[i] not in dic:
        dic[s[i]]=s.count(s[i])
    
ans = sorted([k for k, v in dic.items() if v == max(dic.values())])

for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

import collections
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = collections.Counter(s)
dic = dic.most_common()

ans = [dic[0][0]]

for i in range(len(dic)-1):
    if dic[i][1] == dic[i+1][1]:
        ans.append(dic[i+1][0])
    else:
        break
        
ans = sorted(ans)

for i in range(len(ans)):
    print(ans[i])
import numpy as np

N, M = map(int, input().split())
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
    
AB = np.array(AB)
AB_sorted = AB[AB[:,0].argsort(),:]

cs = np.cumsum(AB_sorted[:,1])
n_full_store = (cs <= M).sum()
money_a = np.sum(AB_sorted[:n_full_store,0] * AB_sorted[:n_full_store,1])
money_b = (M - cs[n_full_store-1]) * AB_sorted[n_full_store,0]
print(money_a + money_b)

### FIXED CODE ###

import numpy as np

N, M = map(int, input().split())
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
    
AB = np.array(AB)
AB_sorted = AB[AB[:,0].argsort(),:]

cs = np.cumsum(AB_sorted[:,1])
n_full_store = (cs <= M).sum()
money_a = np.sum(AB_sorted[:n_full_store,0] * AB_sorted[:n_full_store,1])
if M - cs[n_full_store-1] > 0:
    money_b = (M - cs[n_full_store-1]) * AB_sorted[n_full_store,0]
elif M - cs[n_full_store-1] < 0:
               money_b = AB_sorted[0,0] * M
else:
    money_b = 0
print(money_a + money_b)
n = int(input())
a = []
for i in range(n):
  a.append(int(input())-1)
  
print(sum(a))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
print(sum(a)-n)
data =[[[0 for r in range(10)] for f in range(3)] for b in range(4)]
ans = ""
n = input()
for i in range(0, n):
    b, f, r, v = map(int, raw_input().split(" "))
    data[b-1][f-1][r-1] += v
    
for b in range(4):
    for f in range(3):
         for r in range(10):
                ans += " " + str(a[b][f][r])
         if(b != 3 or f != 2 or r !=9):
            ans += "\n"
    if(b !=3):
        ans += "#"*20 + "\n"
        
print(ans)

### FIXED CODE ###

data =[[[0 for r in range(10)] for f in range(3)] for b in range(4)]
result = ""
n = input()
for i in range(0, n):
    b, f, r, v = map(int, raw_input().split(" "))
    data[b-1][f-1][r-1] += v
    
for b in range(4):
    for f in range(3):
         for r in range(10):
                result += " " + str(data[b][f][r])
         if(b != 3 or f != 2 or r !=9):
            result += "\n"
    if(b != 3):
        result += "#"*20 + "\n"
        
print result