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

from numpy import inf
N, M = list(map(int, input().split(" ")))
keys = []
for _ in range(M):
	c = list(map(int, input().split(" ")))
	j = list(map(int, input().split(" ")))
	keys.append([c[0], sum([1 << k-1 for k in j])])
dp = [inf for _ in range(1 << N)]
dp[0] = 0
for i in range(len(dp)):
    for key in keys:
        t = i | key[1]
        dp[t] = min(dp[t], key[0] + dp[i])
if dp[-1]==inf:
    print(-1)
else:
    print(dp[-1])

### FIXED CODE ###

def main():
  Inf = 10**8
  N, M = list(map(int, input().split(" ")))
  keys = []
  for _ in range(M):
      c = list(map(int, input().split(" ")))
      j = list(map(int, input().split(" ")))
      keys.append([c[0], sum([1 << k-1 for k in j])])
  dp = [Inf for _ in range(1 << N)]
  dp[0] = 0
  for i in range(len(dp)):
      for key in keys:
          t = i | key[1]
          dp[t] = min(dp[t], key[0] + dp[i])
  if dp[-1]==Inf:
      print(-1)
  else:
      print(dp[-1])
main()
### BUGGY CODE ###

S=str(input())
s=[]
for i in range(len(S)):
  s.append(S[i])
c=0
f=True
while f:
  if s==['1']*len(s) or s==['0']*len(s):
    f=False
  else:
    for i in range(len(s)-1):
      if s[i:i+2]==['0','1'] or s[i:i+2]==['1','0']:
        s.remove(s[i])
        s.remove(s[i])
        c+=1
        break
print(2*c)

### FIXED CODE ###

S=str(input())
s=[]
c1=0
c0=0
for i in range(len(S)):
  s.append(S[i])
  if S[i]=='0':
    c0+=1
  else:
    c1+=1
print(2*min(c0,c1))
### BUGGY CODE ###

import math

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

c = 0
ans = 0
for i in range(1,10**18) :
    x = b*i-1
    if x > n :
        x = n
        c = 1
    ans = max(ans,math.floor((a*x)/b)-a*math.floor(x/b))
    if c == 1 :
        break

print(ans)

### FIXED CODE ###

import math

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

c = 0
ans = -1
for i in range(1,10**7) :
    x = b*i-1
    if x > n :
        x = n
        c = 1
    if ans > math.floor((a*x)/b)-a*math.floor(x/b) :
        break
    ans = math.floor((a*x)/b)-a*math.floor(x/b)
    if c == 1 :
        break

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

import decimal


def main():
    N, K = map(int, input().split())
    s = N
    c = 0
    while K > s:
        s *= 2
        c += 1
    cp = (1 / 2) ** c
    ans = decimal.Decimal((1 / N) * cp)
    cc = c
    for n in range(N - 1, 0, -1):
        s = n
        c = 0
        while K > s:
            s *= 2
            c += 1
        cp *= 1 / 2 ** (c - cc)
        ans += decimal.Decimal((1 / N) * cp)
        cc = c
    print(ans)


main()


### FIXED CODE ###

import decimal
 
 
def main():
    N, K = map(int, input().split())
    ans = 0
    for n in range(1, N + 1):
        s = 0
        s += n
        c = 0
        while K > s:
            s *= 2
            c += 1
        ans += decimal.Decimal((1 / N) * (1 / 2) ** c)
    print(ans)
 
 
main()
### BUGGY CODE ###

import sys

def intinput():
    return map(int,sys.stdin.readline().split())

n,m=intinput()
a = list(intinput())
a.sort()
l = []
for i in range(m):
    b,c=intinput()
    for j in range(b):
        l.append(c)
l.sort(reverse=1)
sum=0
for i in range(len(a)):
    try:
        sum += max(a[i],l[i])
    except:
        sum += a[i]
print(sum)

### FIXED CODE ###

import sys

def intinput(): return map(int,sys.stdin.readline().split())

n,m=intinput()
a = list(intinput())
a = [(a[x],1) for x in range(n)]
for i in range(m):
    b,c=intinput()
    a.append((c,b))
a.sort(reverse=1)
res,cnt=0,n
for (x,y) in a:
    k = min(cnt,y)
    res += k*x
    cnt -= k
print(res)
### BUGGY CODE ###

s = input()
for i in range(10**10000):
    sp = s.split('ST', 1)
    if len(sp) > 1:
        s = sp[0] + sp[1]
    else:
        break
print(len(s))

### FIXED CODE ###

s = input()
cnt = 0
while cnt < 100000:
    n = len(s)
    s = ''.join(s.split('ST'))
    if len(s) != n:
        cnt += (len(s) - n) // 2
    else:
        break
    i = s.find('ST')
    
    stlen = 0
    if i > 0:
        for j in range(min(i, len(s)-2-i)):
            if s[i-j-1] == 'S' and s[i+j+2] == 'T':
                stlen += 1
            else:
                break
        s = s[:i-stlen] + s[i+stlen+2:]
        cnt += 1 + stlen
print(len(s))
### BUGGY CODE ###

R,G,B,N = map(int,input().split())

ans = 0
for r in range(N+1):
    for g in range(N+1):
        tmp = N - r*R - g*G
        if tmp >= 0 and tmp%B == 0:
            ans += 1
print(ans)

### FIXED CODE ###

R,G,B,N = map(int,input().split())

ans = 0
for r in range(N+1):
    for g in range(N+1):
        tmp = N - r*R - g*G
        if tmp >= 0 and tmp%B == 0:
            ans += 1
print(ans)
### BUGGY CODE ###

N = int(input())
# サイズが下の方が大きくないとダメtop<mid<bottom
tops = sorted(list(map(int, input().split(" "))))
mids = sorted(list(map(int, input().split(" "))))
bottoms = sorted(list(map(int, input().split(" "))))


def binary_search(check_list, num, left, right):
    if left > right:
        return left
    mid = (left + right) // 2
    if check_list[mid] >= num:
        return binary_search(check_list, num, left, mid - 1)
    else:
        return binary_search(check_list, num, mid + 1, right)


total_count = 0
mid_min_count = min(mids)
bottom_start_index = binary_search(bottoms, mid_min_count, 0, N - 1)
top_min_count = min(mids)
mid_start_index = binary_search(mids, top_min_count, 0, N - 1)
for bottom in bottoms[bottom_start_index:]:
    mid_insert_index = binary_search(mids, bottom, 0, N - 1)
    for mid in mids[mid_start_index:mid_insert_index]:
        total_count += binary_search(tops, mid, 0, N - 1)
print(total_count)


### FIXED CODE ###

import bisect
N = int(input())
# サイズが下の方が大きくないとダメtop<mid<bottom
tops = sorted(list(map(int, input().split(" "))))
mids = list(map(int, input().split(" ")))
bottoms = sorted(list(map(int, input().split(" "))))
# print(tops)
# print(mids)
# print(bottoms)


# def left_binary_search(check_list, num, left, right):
#     if left > right:
#         return left
#     mid = (left + right) // 2
#     if check_list[mid] >= num:
#         return left_binary_search(check_list, num, left, mid - 1)
#     else:
#         return left_binary_search(check_list, num, mid + 1, right)


# def right_binary_search(check_list, num, left, right):
#     if left > right:
#         return left
#     mid = (left + right) // 2
#     if check_list[mid] > num:
#         return right_binary_search(check_list, num, left, mid - 1)
#     else:
#         return right_binary_search(check_list, num, mid + 1, right)


total_count = 0
for mid in mids:
    # bottom_start_index = right_binary_search(bottoms, mid, 0, N - 1)
    bottom_start_index = bisect.bisect_right(bottoms, mid)
    # top_end_index = left_binary_search(tops, mid, 0, N - 1)
    top_end_index = bisect.bisect_left(tops, mid)
    total_count += ((N - bottom_start_index) * top_end_index)
print(total_count)
### BUGGY CODE ###

k = int(input())
a = list(map(str, list(range(1, 10))))
ans = a + []
while len(ans) < k:
    b = []
    for i in a:
        if i == "323456667":
            break
        il = i[-1]
        intil = int(il)
        if il == "0":
            ad = ["0","1"]
        elif il == "9":
            ad = ["8","9"]
        else:
            ad = [intil-1, intil, intil+1]
        c = [i + str(j) for j in ad]
        b = b + c
    a = b
    ans = ans + b

print(ans[k-1])

### FIXED CODE ###

k = int(input())
from collections import deque
q = deque()
a = list(map(str, list(range(1, 10))))
ans = a + []
illist = []
for i in range(10):
    if i == 0:
        illist.append(["0","1"])
    elif i == 9:
        illist.append(["8","9"])
    else:
        illist.append([str(i-1),str(i),str(i+1)])
for i in range(1,10):
    q.append(str(i))

node = "0"
while node != "323456667":
    node = q.popleft()
    for j in illist[int(node[-1])]:
        nodej = node+j
        q.append(nodej)
        a.append(nodej)

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

# -*- coding: utf-8 -*-
from bisect import bisect_right

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

P = primes(10**6)

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

check = [0]*(10**6)
flag = 0
for a in A:
    for i in range(bisect_right(P, a)):
        if a%P[i] == 0:
            if check[P[i]] == 1:
                flag = 1
            else:
                check[P[i]] = 1
    if flag:
        break

if gcd_list(A) > 1:
    print("not coprime")
elif flag:
    print("setwise coprime")
else:
    print("pairwise coprime")
    
    
    
    
    


### FIXED CODE ###

# -*- coding: utf-8 -*-
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)


n = 10**6
minfac = list(range(n+1))
for i in range(2, int(n**0.5) + 1):
    if minfac[i] < i:
        continue
    for j in range(i, n + 1, i):
        if minfac[j] > i:
            minfac[j] = i

"""nの素因数の種類を求める"""
def osa_k(n):
    temp = set()
    while n > 1:
        temp.add(minfac[n])
        n = n//minfac[n]
    return temp


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

check = [0]*(10**6)
flag = 0
for a in A:
    for i in osa_k(a):
        if check[i]:
            flag = 1
        else:
            check[i] = 1
    if flag:
        break
        
if gcd_list(A) > 1:
    print("not coprime")
elif flag:
    print("setwise coprime")
else:
    print("pairwise coprime")
### BUGGY CODE ###

a, b, x = map(int, input().split())
print(len([v for v in range(a, b+1) if v % x == 0]))

### FIXED CODE ###

import sys
input = sys.stdin.readline
a, b, x = map(int, input().split())
print(b//x - (a-1)//x)
### BUGGY CODE ###

h,k=list(map(int,input().split()))
def bupdp(l,h,k):
    dp=[0]*(h+1)
    dp[0] = 0
    for i in range(0,h):
        if i>k:
            mini = 999999999
            for j in range(1,k+1):
                mini = min(mini,dp[i-j]+abs(l[i]-l[i-j]))                
            dp[i] = mini

        if i<=k:
            minim = 999999999
            for j in range(1,i+1):
                minim = min(minim,dp[i-j]+abs(l[i]-l[i-j])) 
            dp[i] = minim
        if i<1:
            dp[i] = 0
    return dp[-2]

l = list(map(int,input().split()))
print(bupdp(l,h,k))

### FIXED CODE ###

h,k=list(map(int,input().split()))
def bupdp(l,h,k):
    dp=[0]*(h+1)
    dp[0] = 0
    for i in range(0,h):
        if i>k:
            mini = min([dp[i-j]+abs(l[i]-l[i-j]) for j in range(1,k+1)])             
            dp[i] = mini
        if i<=k and i!=0:
            minim = min([dp[i-j]+abs(l[i]-l[i-j]) for j in range(1,i+1)])
            dp[i] = minim
        if i<1:
            dp[i] = 0
    return dp[-2]

l = list(map(int,input().split()))
print(bupdp(l,h,k))
### BUGGY CODE ###

from sys import stdin

A, B, M = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
b = [int(x) for x in stdin.readline().rstrip().split()]
X = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]

L = []
for a_i in a:
    for b_i in b:
        L.append(a_i + b_i)

for x in X:
    L.append(a[x[0]-1] + b[x[1]-1] - x[2])
    
print(min(L))


### FIXED CODE ###

from sys import stdin

A, B, M = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
b = [int(x) for x in stdin.readline().rstrip().split()]
X = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]

L = []
L.append(min(a) + min(b))

for x in X:
    L.append(a[x[0]-1] + b[x[1]-1] - x[2])
    
    
print(min(L))
### BUGGY CODE ###


import collections
n,ais = int(raw_input()), map(int, raw_input().split())
cc = collections.Counter()
for ai in ais:
	if ai % 4 == 0: cc[0] += 1
	elif ai % 2 == 0: cc[1] += 1
	else: cc[2] += 1

q = collections.deque([0])
h = {0:[2,1,0], 1:[1], 2:[0]} 
while(n):
	booll = False
	for u in h[q[-1]] + [-1]:
		if u == -1: boool = True
			
		if cc[u] > 0:
			q.append(u)
			cc[u] -=1
			n -=1
			break
	if booll: break

print 'Yes' if n == 0 else 'No'

### FIXED CODE ###


n,ais = int(raw_input()), map(int, raw_input().split())
import collections
cc = collections.Counter()
for ai in ais:
	if ai % 4 == 0: cc[0] += 1
	elif ai % 2 == 0: cc[1] += 1
	else: cc[2] += 1

q = collections.deque()
while(n):
	if len(q) == 0:
		for u in range(3)[::-1]:
			if cc[u] > 0:
				q.append(u)
				cc[u]-=1
				n -=1
				break
		if len(q) == 0: break
	else:
		if q[-1] == 0:
			if cc[2]:
				q.append(2)
				cc[2]-=1
				n-=1
			elif cc[1]:
				q.append(1)
				cc[1]-=1
				n-=1
			elif cc[0]:
				q.append(0)
				cc[0]-=1
				n-=1
			else:
				break
		elif q[-1] == 2:
			if cc[0] == 0:
				break
			else:
				q.append(0)
				cc[0]-=1
				n-=1
		elif q[-1] == 1:
			if cc[1] > 0:
				q.append(1)
				cc[1]-=1
				n-=1
			else:
				break

print 'Yes' if n == 0 else 'No'
### BUGGY CODE ###

N=int(input())
f=[0]*N
for i in range(N):
    for j in range(i+1):
        for k in range(i+1):
            for l in range(i+1):
                if (j+1)*(j+1)+(k+1)*(k+1)+(l+1)*(l+1)+(j+1)*(k+1)+(k+1)*(l+1)+(l+1)*(j+1)==(i+1):
                    f[i]=f[i]+1

for i in range(N):
    print(f[i])                


### FIXED CODE ###

import math
N=int(input())
f=[0]*(10050)
for j in range(int(math.sqrt(N))):
    for k in range(int(math.sqrt(N))):
        for l in range(int(math.sqrt(N))):
            i=(j+1)*(j+1)+(k+1)*(k+1)+(l+1)*(l+1)+(j+1)*(k+1)+(k+1)*(l+1)+(l+1)*(j+1)
            if i<10050:
                f[i]=f[i]+1

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

import itertools

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

num = 10*100
nums = [num + i for i in range(0, n+1)]

sums = []
for i in range(k, n+2):
    for v in itertools.combinations(nums, i):
        sums.append(v)

totals = []
for s in sums:
    totals.append(sum(s))

totals = set(totals)
print(len(totals))

### FIXED CODE ###

def main():
    n, k = map(int, input().split())

    num = 10*100
    nums = [num + i for i in range(0, n+1)]

    # sums = []
    total = 0
    for i in range(k, n+2):
        _min = int((nums[0]+nums[i-1])*(nums[i-1]-nums[0]+1)/2)
        _max = int((nums[-i]+nums[-1])*(nums[-1]-nums[-i]+1)/2)

        total += _max - _min + 1

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

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

N = int(input())
list = list(map(int,input().split()))
kosuu = []
total = 0
for i in range(N):
    a = list.count(i+1)
    kosuu.append(a)
    total += ( a * (a-1) ) //2
for i in range(N):
    a = kosuu[list[i]-1]
    print(total-a*(a-1)//2 + (a-1)*(a-2)//2)

### FIXED CODE ###

N = int(input())
list = list(map(int,input().split()))
kosuu = [0] * N
kosuuu = [0] * N
total = 0
listed = sorted(list)
listed.append(-1)
i = 0
count = 1
while i < N:
    a = listed[i]
    if a == listed[i+1]:
        count += 1
    else:
        kosuu[a-1] = count
        total += ( count * (count-1) ) //2
        count = 1
    i += 1
for i in range(N):
    a = kosuu[list[i]-1]
    print(total-a*(a-1)//2 + (a-1)*(a-2)//2)
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    for i in range(N):
        for j in range(i+1, N):
            if A[i] == A[j]:
                print("NO")
                exit()
    print("YES")


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    for i in range(1, N):
        if A[i-1] == A[i]:
            print("NO")
            exit()
    print("YES")


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

n=int(input())
a=list(map(int,input().split()))
mod=1000000007
ans=0
product=1
for i in range (n-1):
    for j in range(i+1,n):
        product=((a[i]%mod)*(a[j]%mod))%mod
        ans=(ans+product)%mod
print(ans)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
mod=1000000007
ans=0
s=0
for i in range (n-1):
    if i ==0:
        for j in range(i+1,n):
            s=(s+a[j])%mod
    else:
        s-=a[i]
    ans=(ans+(a[i]*(s))%mod)%mod

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

import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
from functools import lru_cache
INF = 1 << 60

#ここから書き始める
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
x = []
for i in range(m):
    b, c = map(int, input().split())
    x.append([c, b])
x.sort(reverse=True)
# print("x =", x)
# print("a =", a)
y = []
for i in range(m):
    z = [x[i][0]] * x[i][1]
    y += z
# print("y =", y)
ans = sum(a)
length = min(n, len(y))
for i in range(length):
    if a[i] >= y[i]:
        break
    ans += y[i] - a[i]
print(ans)


### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = [list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1], reverse=True)
  
for b,c in bc:
  a.extend([c]*b)
  if len(a) > n*2:
    break
a.sort(reverse=True)
print(sum(a[:n]))
### BUGGY CODE ###

from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
import random

# sys.stdin = open('input')

def inp():
    re = map(int, raw_input().split())
    if len(re) == 1:
        return re[0]
    return re

def inst():
    return raw_input().strip()

def gcd(x, y):
   while(y):
       x, y = y, x % y
   return x

def my_main():
        n, k, c = inp()
        st = inst()
        front, end = [], []
        def get(now, ans):
            if len(ans) == k:
                return
            for i in range(now, n):
                if st[i]=='o':
                    ans.append(i+1)
                    return get(i+1+c, ans)
        get(0, front)
        st = st[::-1]
        get(0, end)
        for i in range(len(end)):
            end[i] = n-end[i]+1
        end.sort()
        if len(front)!=k or len(end)!=k:
            return
        ans = []
        # print front, end
        for i in range(k):
            if front[i] == end[i]:
                ans.append(front[i])
        if ans:
            print '\n'.join(map(str, ans))

my_main()


### FIXED CODE ###

from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
import random

# sys.stdin = open('input')

def inp():
    re = map(int, raw_input().split())
    if len(re) == 1:
        return re[0]
    return re

def inst():
    return raw_input().strip()

def gcd(x, y):
   while(y):
       x, y = y, x % y
   return x

def my_main():
        n, k, c = inp()
        st = inst()
        front, end = [], []
        def get(now, ans):
            while now < n:
                if len(ans) == k:
                    return
                for i in range(now, n):
                    if st[i]=='o':
                        ans.append(i+1)
                        now = i+c+1
                        break
                else:
                    break
        get(0, front)
        st = st[::-1]
        get(0, end)
        for i in range(len(end)):
            end[i] = n-end[i]+1
        end.sort()
        if len(front)!=k or len(end)!=k:
            return
        ans = []
        # print front, end
        for i in range(k):
            if front[i] == end[i]:
                ans.append(front[i])
        if ans:
            print '\n'.join(map(str, ans))

my_main()
### BUGGY CODE ###

k = int(input())
a=7
i=1
if k%5==0 or k%2==0:
  print(-1)
  exit()
while True:
  if a%k ==0:
    print(i)
    exit()
  i+=1
  a = a + 7*10**(i-1)

### FIXED CODE ###

k = int(input())
if k % 2 == 0 or k%5==0:
    print(-1)
    exit()
a = 7
ans = 1
while True:
    if a % k == 0:
        print(ans)
        exit()
    a = (a*10+7) % k
    ans += 1
### BUGGY CODE ###

N = int(input())
a = input().split()
a = [int(i) for i in a]
res_list = []
for i in range(10 ** 10):
    res = 0
    if i >= 2 and i% 2 == 0:
        if res_list[:i//2] == res_list[i//2:]:
            break
    for j in a:
        res += i % j
    res_list.append(res)
    
print(max(res_list))

### FIXED CODE ###


N = int(input())
a = input().split()
a = [int(i) for i in a]
res_list = {}
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
def lcm(x,y):
    return (x * y) // gcd(x, y)
for i in range(len(a)):
    if i == 0:
        res = a[i]
        continue
    else:
        res = lcm(res,a[i])
res2 = 0
for i in a:
    res2 += (res-1) % i
print(res2)
### BUGGY CODE ###

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

ans = 0
ind, sumn = 0,0
for i in range(len(p)-k+1):
    if sum(p[i:i+k]) >= sumn:
        ind,sumn = i,sum(p[i:i+k])


#print((sumn+0.5*k)/2)

for i in p[ind:ind+k]:
    ans += (i+1)/2
else:
    print(ans)



### FIXED CODE ###

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

ans = 0
tmp,ind = sum(p[0:k]),0
sumn = tmp

for i in range(len(p)-k):
    #print(p[i+k],p[i])
    tmp += p[i+k]-p[i]
    #print(tmp)
    if tmp >= sumn:
        ind,sumn = i,tmp
        #print(sumn)

print((sumn+k)/2)
"""
for i in p[ind:ind+k]:
    ans += (i+1)/2
else:
    print(ans)
"""
### BUGGY CODE ###

n = int(input())

bariety = []

h = []

for i in range(n):
    t = input()
    if t not in bariety:
        bariety.append(t)
        h.append([1,t])
    else:
        h[bariety.index(t)][0] += 1
    
h.sort(reverse = True)

maxh = h[0][0]

ans = []

for i in h:
    if i[0] == maxh:
        ans.append(i[1])
    else:
        break
        
ans.sort()

for i in ans:
    print(i)

### FIXED CODE ###


import collections as col

n = int(input())

s = []

for i in range(n):
    s.append(input())
    
x = col.Counter(s)

m = 0

x = x.most_common()

ans = []

for i in x:
    if i[1]<m:
        break
    else:
        ans.append(i[0])
        m = i[1]
        
ans.sort()

for i in ans:
    print(i)
### BUGGY CODE ###

import sys,random
input = sys.stdin.readline


def main():
    n = int(input())
    
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))

    for k in range(n):
        hyp = b[0]^a[k]
        judge = True
        for _ in [0]*500:
            w = random.randrange(n)
            if b[w] != a[(w+k)%n]^hyp:
                judge = False
                break
        if judge:
            print(k,hyp)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

#Z[i]:length of the longest list starting from S[i] which is also a prefix of S
def Z_algorithm(s):
    N = len(s)
    Z_alg = [0]*N

    Z_alg[0] = N
    i = 1
    j = 0
    while i < N:
        while i+j < N and s[j] == s[i+j]:
            j += 1
        Z_alg[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < N and k + Z_alg[k]<j:
            Z_alg[i+k] = Z_alg[k]
            k += 1
        i += k
        j -= k
    return Z_alg


n = int(input())
a = tuple(map(int,input().split()))
b = tuple(map(int,input().split()))


BAA = []
for i in range(n-1):
    BAA.append(b[i]^b[i+1])
BAA.append(b[0]^b[-1])

BAA.append(-1)

for i in range(n-1):
    BAA.append(a[i]^a[i+1])
BAA.append(a[0]^a[-1])
for i in range(n-1):
    BAA.append(a[i]^a[i+1])
BAA.append(a[0]^a[-1])

z = Z_algorithm(BAA)

for k in range(n):
    if z[n+k+1] >= n:
        print(k,b[0]^a[k])
### BUGGY CODE ###

R,G,B,n=map(int,input().split())
r=n//R
g=n//G
b=n//B
ans=0
for i in range(r+1):
  for j in range(g+1):
    if (n-R*i-G*j)%B==0 and n-R*i-G*j>=0:
      ans+=1
print(ans)

### FIXED CODE ###

R,G,B,n=map(int,input().split())
r=n//R
g=n//G
b=n//B
ans=0
for i in range(r+1):
  for j in range((n-R*i)//G+1):
    if (n-i*R-j*G)%B==0:
      ans+=1
print(ans)
### BUGGY CODE ###

n=int(input())
a=0
for i in range(1,n):
    a+=i
print(a)

### FIXED CODE ###

n=int(input())
print((n-1)*n//2)