Harryxun/stf_run huggingface dataset:
import math
n = int(input())
lr = [None]*10000
rmax = 0
for i in range(n):
    lr[i]= list(map(int,input().split()))
    if lr[i][1] > rmax:
        rmax = lr[i][1]

p = [1]*(rmax+1)
p[0]=0
p[1]=1
        

for j in range(2,int(math.sqrt(rmax)+1)):
    if p[j] == 0:
        continue
    for i in range(2,rmax+1):
        if i!=j and i%j == 0:
            p[i] = 0
for i in range(rmax, 1,-2):
    if p[(i+1)//2] == 0:
        p[i] = 0
for i in range(1,rmax):
    p[i+1] +=p[i]
  


for i in range(n):
    print(p[lr[i][1]] - p[lr[i][0]-1])
    
for i in range(rmax):
    print(i, p[i])

### FIXED CODE ###

import math
n = int(input())
lr = [None]*100000
rmax = 0
for i in range(n):
    lr[i]= list(map(int,input().split()))
    if lr[i][1] > rmax:
        rmax = lr[i][1]

p = [1]*(rmax+1)
p[0]=0
p[1]=0
        

for j in range(2,int(math.sqrt(rmax)+1)):
    if p[j] == 0:
        continue
    for i in range(2,rmax+1):
        if i!=j and i%j == 0:
            p[i] = 0
for i in range(rmax, 1,-2):
    if p[int((i+1)/2)] == 0:
        p[i] = 0
p[2] = 0
for i in range(2,rmax):
    p[i+1] += p[i]  

for i in range(n):
    print(p[lr[i][1]] - p[lr[i][0]-1])
from collections import Counter, defaultdict
S = input()

class BIT:
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def update(self, i, v):
        while i <= self.n:
            self.bit[i] += v
            i += i & -i
            
    def query(self, i):
        ret = 0
        while i > 0:
            ret += self.bit[i]
            i -= i & -i
            
        return ret

ctr = Counter(S)
if sum(c % 2 != 0 for c in ctr.values()) > 1:
    print(-1)
    
ctr = {k: v / 2 for k, v in ctr.items()}
A = []
C = []
ans = 0
MAX_LEN = len(S)
for i, v in enumerate(S):
    if ctr[v] >= 1:
        A.append(v)
        ctr[v] -= 1
        ans += max(0, i + 1 - MAX_LEN // 2)
    elif ctr[v] > 0:
        ans += abs(i - MAX_LEN // 2)
    else:
        C.append(v)

d = defaultdict(list)
for i, v in enumerate(C[::-1]):
    d[v].append(i + 1)
    
tree = BIT(len(A))
for i, a in enumerate(A):
    ans += i - tree.query(d[a][0])
    tree.update(d[a][0], 1)
    d[a] = d[a][1:]

print(ans)


### FIXED CODE ###

from collections import defaultdict
S = input()

class BIT:
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def update(self, i, v):
        while i <= self.n:
            self.bit[i] += v
            i += i & -i
            
    def query(self, i):
        ret = 0
        while i > 0:
            ret += self.bit[i]
            i -= i & -i
            
        return ret

d = defaultdict(list)
for i, v in enumerate(S):
    d[v].append(i + 1)

if sum(len(l) % 2 != 0 for l in d.values()) > 1:
    print(-1)
    exit()

N = len(S)
ctr = []
key_map = [-1] * (N + 1)

for k, v in d.items():
    t = len(v)
    if t % 2  == 1:
        key_map[v[t // 2]] = N // 2 + 1

    for j in range(t // 2):
        ctr.append((v[j], v[-j - 1]))
        
ctr.sort()

for i, (l, r) in enumerate(ctr):
    key_map[l] = i + 1
    key_map[r] = N - i

tree = BIT(N)
ans = 0
for i, v in enumerate(key_map[1:]):
    ans += i - tree.query(v)
    tree.update(v, 1)
print(ans)
n, q = map(int, input().split())

tree_index = [[] for _ in range(n)]
for i in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  tree_index[a].append(b)
  tree_index[b].append(a)

ans = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x

def dfs(cur, par):
  for child in tree_index[cur]:
    if child == par:
      continue
    ans[child] += ans[cur]
    dfs(child, cur)
dfs(0, -1)
print(*ans)

### FIXED CODE ###

import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
  v,val=map(int,input().split())
  cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
checked=[0]*(n+1) #各頂点を見たかどうかのフラグを持っておく
while q:
  v=q.pop()
  checked[v]=1 #頂点を見たかどうかのフラグを更新す
  for u in g[v]:
    if checked[u]==1: #vの子ノードuについて、まだ見ていない頂点であればcount[u]をcount[u]+=count[v]として更新する
      continue
    cnt[u]+=cnt[v]
    q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる
import sys
input = sys.stdin.readline

s = list(input().rstrip())
k = int(input())
n = len(s)

group = []

cnt = 0

for i in range(n):
    if i == 0:
        cnt += 1
        continue
    elif i == n - 1:
        if s[i] == s[i - 1]:
            cnt += 1
            group.append(cnt)
        else:
            group.append(cnt)
            group.append(1)
        continue
    
    if s[i] == s[i - 1]:
        cnt += 1
    else:
        group.append(cnt)
        cnt = 1
ans = 0
if k == 1:
    for i in group:
        ans += i//2
    print(ans)
    sys.exit()
from copy import deepcopy
first = deepcopy(group)
last = deepcopy(group)
if s[0] == s[-1]:
    first[-1] += last[0]
    last[0] = 0

for i in first:
    ans += i//2
for i in last:
    ans += i//2
if k == 2:
    print(ans)
    sys.exit()
mid = deepcopy(first)
if s[0] == s[-1]:
    mid[0] = 0
temp = 0
for i in mid:
    temp += i//2
ans += temp*(k - 2)
print(ans)




### FIXED CODE ###

def main():
    S = input()
    K = int(input())
    a = list(S)
    cnt = 0
    if len(set(a))==1:
        cnt = (len(a)*K)//2
    elif a[0] != a[-1]:
        for l in range(len(a)-1):
            if a[l+1] == a[l]:
                a[l+1] = str(l)
                cnt += 1
        cnt *= K
    else:
        temp = 1
        temp_2 = 1
        i = 0
        while a[i] == a[i+1]:
            temp += 1
            i += 1
        j = len(a) - 1
        while a[j] == a[j-1]:
            temp_2 += 1
            j -= 1
        for k in range(i+1,j-1):
            if a[k+1] == a[k]:
                a[k+1] = str(k)
                cnt += 1
        cnt *= K
        cnt += temp//2
        cnt += temp_2//2
        temp_3 = (temp + temp_2)//2
        cnt += temp_3 * (K-1)


    print(cnt)

    
if __name__ == '__main__':
    main()
import numpy as np
n = int(input())
vlist = [input().split() for i in range(n)]
for m in range(n) :
    vlist[m] = [int(l) for l in vlist[m]]
for j in range(n-1) :
    if vlist[j][0] <= vlist[j+1][0] and vlist[j][1] <= vlist[j][1] :
        continue
    if vlist[j][0] > vlist[j+1][0] and vlist[j][0] > vlist[j][1] :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][0], vlist[j+1][0]))/vlist[j+1][0]) for k in vlist[j+1]]
        continue
    elif vlist[j][1] > vlist[j+1][1] and vlist[j][1] > vlist[j][0]:
        vlist[j+1] = [int(k*(np.lcm(vlist[j][1], vlist[j+1][1]))/vlist[j+1][1]) for k in vlist[j+1]]
        continue
    elif vlist[j+1][0] > vlist[j+1][1] :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][1], vlist[j+1][1]))/vlist[j+1][1]) for k in vlist[j+1]]
        continue
    else :
        vlist[j+1] = [int(k*(np.lcm(vlist[j][0], vlist[j+1][0]))/vlist[j+1][0]) for k in vlist[j+1]]
print(sum(vlist[n-1]))

### FIXED CODE ###

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

chlist = votelist[0]
for i in range(1, n):
    x = max(-(chlist[0]*-1 // votelist[i][0]), -(chlist[1]*-1 // votelist[i][1]))
    chlist[0] = votelist[i][0] * x
    chlist[1] = votelist[i][1] * x
    
print(sum(chlist))
a=int(input())
b=list(input())
c=0
for i in range(a):
  if b[i]=="A":
    if b[i+1]=="B":
    else:
      pass
      if b[i+2]=="C":
        c+=1
      else:
        pass
  else:
    pass
print(c)


### FIXED CODE ###

n=int(input())
s=list(input())
d=0
for i in range(n):
  if n-(i+1)>=2:
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
      d+=1
  else:
    pass
print(d)
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [float("inf")]*n
dp[0] = 0
def chmin(a,b):
  if a>b:
    a = b
    return true
  else:
    return false
for i in range(1,n):
  for j in range(0,k):
    chmin(dp[i],dp[i-1]+abs(h[i]-h[i-j]))
print(dp[-1])

### FIXED CODE ###

def solve():
  n,k = map(int,input().split())
  h = list(map(int,input().split()))
  dp = [float("inf")]*n
  dp[0] = 0
  for i in range(0,n-1):
    for j in range(1,k+1):
      if (i-j)>=-1:
        dp[i+1]=min(dp[i+1],dp[i+1-j]+abs(h[i+1]-h[i+1-j]))
  print(dp[-1])
solve()
S = list(input())
ans = 'Yes'
count = list(S.count(i) for i in set(S))
if count[0] == count[1] and count[0] == 2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = list(input())
count = list(S.count(i) for i in set(S))
if len(count) == 2 and count[0] == count[1] and count[0] == 2:
    print('Yes')
else:
    print('No')
X = int(input())
S = set()
for i in range(2,X):
  b = 1
  while(i**b<=X):
    S.add(i**b)
    b += 1
ans = max(S)
print(ans)

### FIXED CODE ###

def pff(m):
    pf = {}
    for i in range(2, int(m ** 0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf
def examB():
    X = I()
    ans = 0
    for i in range(X,0,-1):
        cur = pff(i)
        flag = True
        now = 0
        for j in cur.values():
            if j==1:
                flag = False
            if now==0:
                now = j
            else:
                if now!=j:
                    flag = False
        if flag:
            ans = i
            break
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()
b = input()
dic = {"A":"T", "C":"G"}
print(dic[b])

### FIXED CODE ###

b = input()
dic = {"A":"T", "C":"G", "G":"C", "T":"A"}
print(dic[b])
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
while True:
    ia = input()
    if ia == "AC":
        ac += 1
    elif ia == "WA":
        wa += 1
    elif ia == "TLE":
        tle += 1
    elif ia == "RE":
        re += 1
    else:
        break

print("AC x", ac)
print("WA x", wa)
print("TLE x", tle)
print("RE x", re)

### FIXED CODE ###

N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for x in range(N):
    ia = input()
    if ia == "AC":
        ac += 1
    elif ia == "WA":
        wa += 1
    elif ia == "TLE":
        tle += 1
    elif ia == "RE":
        re += 1
    else:
        break

print(f"""\
AC x {ac}
WA x {wa}
TLE x {tle}
RE x {re}""")
a = input()
b = input()

if (a >= 1 and a <= 9 and b >= 1 and b <= 9):
  print(a*b)
else:
  print(-1)

### FIXED CODE ###

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

if (a <= 9 and b <= 9):
  print(a*b)
else:
  print(-1)
N, X = map(int, input().split())
L = list(map(int, input().split()))
bound = 0
D = 0
i = 0
while D =< X and i < N:
    bound += 1
    D = D + L[i]
    i += 1
print(bound)

### FIXED CODE ###

N, X = map(int, input().split())
L = list(map(int, input().split()))
bound = 1
D = 0
i = 0
for i in range(N):
    if X >= D + L[i]:
        bound += 1
        D = D + L[i]
    else:
        break
print(bound)
def resolve():
    import math
    a = [int(input()) for _ in range(5)]
    b = []
    for i in range(5):
        if a[i]%10 != 0:
            b.append(a[i]%10)
    amin = min(b)
    ans = 0
    for i in range(5):
        ans += math.ceil(a[i]/10)*10
    print(ans-10+amin)

resolve()

### FIXED CODE ###

def resolve():
    import math
    a = [int(input()) for _ in range(5)]
    b = []
    for i in range(5):
        if a[i]%10 != 0:
            b.append(a[i]%10)
    if len(b) == 0:
        amin = 10
    else:
        amin = min(b)
    ans = 0
    for i in range(5):
        ans += math.ceil(a[i]/10)*10
    print(ans-10+amin)

resolve()
import math

x1, y1, x2, y2 = float(raw_input().split())

print sqrt((x2-x1)**2 + (y2-y1)**2)

### FIXED CODE ###

import math

x1, y1, x2, y2 = map(float, raw_input().split())
print math.sqrt((x2-x1)**2 + (y2-y1)**2)
a,a1 = input().split()
b = input().split()
sum = 0
for _ in b:
    sum += int(_)
if int(b[int(a1) - 1]) >= sum/(4*a1):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n, m = input().split()
b = input().split()
sum = 0
for x in b:
    sum += int(x)
yy=0
for y in b:
    if int(y) >= sum/(4*int(m)):
        yy+=1
if yy < int(m):
    print("No")
else:
    print("Yes")
N = int(input())
V = {}

# Vertice
for i in range(N-1):
  u,v,w = list(map(int, input().split()))
  u,v = u-1, v-1 #1-index -> 0-index
  if u not in V:
    V[u] = [[v,w]]
  else:
    V[u].append([v,w])
  if v not in V:
    V[v] = [[u,w]]
  else:
    V[v].append([u,w])
     
#print(V)
ANS = [-1] * N
visited = [False] * N

def dfs(pos):
  visited[pos] = True
  for x,w in V[pos]:
    if visited[x]:
      continue
    if w % 2 == 0:
      ANS[x] = ANS[pos]
    else:
      ANS[x] = 1 - ANS[pos]
    #print(pos,x,ANS)
    dfs(x)
  return

ANS[0] = 0
dfs(0)

for a in ANS:
  print(a)

### FIXED CODE ###

import sys
N = int(input())
V = {}
if N == 1:
  print(0)
  exit(0)

# change limit for deep tree (recursion)
sys.setrecursionlimit(N)

# Vertice
for i in range(N-1):
  u,v,w = list(map(int, input().split()))
  u,v = u-1, v-1 #1-index -> 0-index
  if u not in V:
    V[u] = [[v,w]]
  else:
    V[u].append([v,w])
  if v not in V:
    V[v] = [[u,w]]
  else:
    V[v].append([u,w])
     
#print(V)
ANS = [-1] * N
visited = [False] * N

def dfs(pos):
  visited[pos] = True
  for x,w in V[pos]:
    if visited[x]:
      continue
    if w % 2 == 0:
      ANS[x] = ANS[pos]
    else:
      ANS[x] = 1 - ANS[pos]
    #print(pos,x,ANS)
    dfs(x)
  return

ANS[0] = 0
dfs(0)

for a in ANS:
  print(a)
n, m = map(int, input().split())
print(n*(n-1)//2 + m*(m-1)//2a)

### FIXED CODE ###

def combination(n, x, mod=10**9+7):
    # nCx, a=n!, b=x!, c=(n-x)!
    # ex) combination(5, 2) = 10
    _factorial = [1] * (n+1)
    tmp = 1
    for i in range(1, n+1):
        tmp = (tmp * i) % mod
        _factorial[i] = tmp

    tmp = _factorial[n]
    tmp = (tmp * pow(_factorial[x], mod-2, mod)) % mod
    tmp = (tmp * pow(_factorial[n-x], mod-2, mod)) % mod
    return tmp

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

if m > 1 and n > 1:
    M = combination(m, 2)
    N = combination(n, 2)
elif m <= 1 and n > 1:
    M = 0
    N = combination(n,2)
elif m > 1 and n <= 1:
    M = combination(m, 2)
    N = 0
else:
    M, N = 0, 0

print(M+N)
n, k = map(int, input().split())
fruits = list(map(int, input().split()))

mix = []

for mix in range(k):
    mix.append(min(fruits))
    fruits.remove(min(fruits))

print(sum(mix))

### FIXED CODE ###

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

mix = []
a = 0

while a < k:
    mix.append(min(fruits))
    fruits.remove(min(fruits))
    a += 1

print(sum(mix))
def main():
    n, m = map(int, input().split())
    s = [0] * n
    c = [0] * n
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0:
            ans[s[i]-1] = c[i]
        if ans[s[i]-1] == c[i]:
            continue
        if ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n == 3:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    s = [0] * m
    c = [0] * m
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
H, W = map(int, input().split(' '));

board = []
flags = [ True for x in range(W)]
for i in range(H):
    line = list(input())
    if ( '#' in line ):
        board.append(line)
        flags = [ f and s == '.' for s,f in zip(line, flags) ]

for i, flag in enumerate(flags):
    if flag:
        for b in board:
            b.pop(i)
for b in board:
    print(''.join(b))

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
H, W = map(int, input().split(' '));

board = []
flags = [ True for x in range(W)]
for i in range(H):
    line = list(input())
    if ( '#' in line ):
        board.append(line)
        flags = [ f and s == '.' for s,f in zip(line, flags) ]

j = 0
for b in board:
    for l,flag in zip(b,flags):
        if not flag:
            sys.stdout.write(l)
    print()
import bisect
import sys
sys.setrecursionlimit(3*10**5)

INF = 10**10

N = int(input())
a = list(map(int,input().split()))
T = [set() for x in range(N)]
for i in range(N-1):
    u,v = map(int,input().split())
    u -= 1
    v -= 1
    T[u].add(v)
    T[v].add(u)

A = [INF]*N

ans = [-1]*N

def dfs(V):
    num = a[V]
    k = bisect.bisect_left(A,num)
    v = A[k]
    A[k] = num
    ans[V] = bisect.bisect_left(A,INF)
    # このにぶたん無駄じゃね？まあ間に合うからいいか……
    for VV in T[V]:
        dfs(VV)
        T[VV].remove(V)
    A[k] = v

dfs(0)

print(*ans,sep="\n")

### FIXED CODE ###

import bisect
import sys
sys.setrecursionlimit(3*10**5)

INF = 10**10

N = int(input())
a = list(map(int,input().split()))
T = [set() for x in range(N)]
for i in range(N-1):
    u,v = map(int,input().split())
    u -= 1
    v -= 1
    T[u].add(v)
    T[v].add(u)

search = [0]*N

A = [INF]*N

ans = [-1]*N

def dfs(V):
    num = a[V]
    k = bisect.bisect_left(A,num)
    v = A[k]
    A[k] = num
    ans[V] = bisect.bisect_left(A,INF)
    # このにぶたん無駄じゃね？まあ間に合うからいいか……
    for VV in T[V]:
        if search[VV]:
            continue
        search[VV] = 1
        dfs(VV)
    A[k] = v

search[0] = 1
dfs(0)

print(*ans,sep="\n")
import numpy as np

def solve():
    H,W=map(int,input().split(' '))
    max_value = H+W
    values =[]
    for i in range(H):
      values.append([0 if i == '#' else max_value for i in list(input())])
    values = np.array(values)

    for x in range(W-1):
        values[:,x+1] = np.minimum(values[:,x]+1,values[:,x+1])
    for x in range(W-1,0,-1):
        values[:,x] = np.minimum(values[:,x+1]+1,values[:,x])
    for x in range(H-1):
        values[x+1,:] = np.minimum(values[x,:]+1,values[x+1,:])
    for x in range(H-1,0,-1):
        values[x,:] = np.minimum(values[x+1,:]+1,values[x,:])

    print(np.max(values),)
solve()

### FIXED CODE ###

import numpy as np

def solve():
    H,W=map(int,input().split(' '))
    max_value = H+W
    values =[]
    for i in range(H):
      values.append([0 if i == '#' else max_value for i in list(input())])
    values = np.array(values)

    for x in range(W-1):
        values[:,x+1] = np.minimum(values[:,x]+1,values[:,x+1])
    for x in range(W-1,0,-1):
        values[:,x-1] = np.minimum(values[:,x-1],values[:,x]+1)
    for x in range(H-1):
        values[x+1,:] = np.minimum(values[x,:]+1,values[x+1,:])
    print('')
    for x in range(H-1,0,-1):
        values[x-1,:] = np.minimum(values[x,:]+1,values[x-1,:])
    print(np.max(values))
solve()
N, M = map(int, input().split())

a = 0
for i in range(M):
  c_sum = int(input())
  a += b

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)

### FIXED CODE ###

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

c = list(map(int,input().split()))
c_sum = sum(c)

day_count = N-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)
#n段の上り方のバリエーションはフィボナッチ数列になっている

def Fib(dan):
    
    if dan == 0:
        return 0
    elif dan == 1:
        return 1
    else:
        return Fib(dan-1)+Fib(dan-2)

N, M = map(int,input().split())
ans = 1
lasthole = 0
if M == 0:
    print(Fib(N+1)%1000000007)
else:
    alist = list()
    for i in range(M):
        alist.append( int(input()))
    for a in alist:
        dan = a - lasthole 
        lasthole = a +1
        ans *= Fib(dan)
        ans = ans % 1000000007
    ans *= Fib(N - alist[M-1])
    
print(ans%1000000007)





### FIXED CODE ###

N, M = map(int,input().split())
alist = list()
for _ in range(M):
    alist.append(int(input()))


li = {}
li[0] = 1

for i in range(1,N+1):
    if len(alist)>=1 and i ==  alist[0]:
        li[i] = 0
        alist.pop(0)
    else:
        if i == 1:
            li[i] = 1
        else:
            li[i] = ((li[i-1] + li[i-2])%(10**9+7))
print(li[N]%(10**9+7))
n = int(input())
a = list(map(int, input().split()))
diff_dict = {}
total_sum = 0
for i in a:
    if i not in diff_dict:
        temp = (count_dict[i])*(count_dict[i]-1)//2
        diff_dict[i] = temp-(count_dict[i]-1)*(count_dict[i]-2)//2
        total_sum += temp
for i in a:
    print(total_sum - diff_dict[i])

### FIXED CODE ###

import collections
n = int(input())
a = list(map(int, input().split()))
cnt = collections.Counter(a)
total = 0
for key in cnt.keys():
    total += cnt[key]*(cnt[key]-1) // 2
for i in a:
    ans = total
    ans -= cnt[i] * (cnt[i]-1) / 2
    ans += (cnt[i]-1) * (cnt[i]-2) / 2
    print(int(ans))
s = list(input().split("T"))
x, y = map(int, input().split())
s2 = [len(x) for x in s]
pos = [0, 0]
LR = [s2[i] for i in range(len(s2)) if i % 2 == 0]
UD = [s2[i] for i in range(len(s2)) if i % 2 == 1]

flag = False
tmp = 1
tmp = tmp << sum(LR)
for d in LR:
    tmp = tmp << d | tmp >> d

if x >= 0:
    tmp = tmp >> sum(LR)
    if (tmp >> x) % 2 == 1:
        flag = True
else:
    if (tmp >> (sum(LR) + x)) % 2 == 1:
        flag = True
if flag:

    tmp = 1
    tmp = tmp << sum(UD)
    flag = False
    for d in UD:
        tmp = tmp << d | tmp >> d
    if y >= 0:
        tmp = tmp >> sum(UD)
        if (tmp >> y) % 2 == 1:
            flag = True
    else:
        if (tmp >> (sum(UD) + y)) % 2 == 1:
            flag = True

if flag:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

s = list(input().split("T"))
x, y = map(int, input().split())
s2 = [len(x) for x in s]
LR = [s2[i] for i in range(len(s2)) if i % 2 == 0]
UD = [s2[i] for i in range(len(s2)) if i % 2 == 1]

flag = False
tmp = 1
tmp = tmp << sum(LR)
for i, d in enumerate(LR):
    if i != 0:
        tmp = tmp << d | tmp >> d
    else:
        tmp = tmp << d

if x >= 0:
    tmp = tmp >> sum(LR)
    if (tmp >> x) % 2 == 1:
        flag = True
else:
    if sum(LR) + x >= 0:
        if (tmp >> (sum(LR) + x)) % 2 == 1:
            flag = True
if flag:

    tmp = 1
    tmp = tmp << sum(UD)
    flag = False
    for d in UD:
        tmp = tmp << d | tmp >> d
    if y >= 0:
        tmp = tmp >> sum(UD)
        if (tmp >> y) % 2 == 1:
            flag = True
    else:
        if sum(UD) + y >= 0:
            if (tmp >> (sum(UD) + y)) % 2 == 1:
                flag = True

if flag:
    print("Yes")
else:
    print("No")
#C-Poll
import collections
n=int(input())
num=0
words = [input() for _ in range(n)]
count = collections.Counter(words)
Flg = True
ansallay = []
while Flg:
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[0][1] != count.most_common()[num+1][1]):
        Flg = False
        break
    num += 1
    if(num == n-1):
      if(count.most_common()[0][1] == count.most_common()[num][1]):
        ansallay.append(count.most_common()[num][0])
      break
ansallay.sort()
for word in ansallay:
    print(word)

### FIXED CODE ###

#C-Poll
import collections
n=int(input())
words = [input() for _ in range(n)]
count = collections.Counter(words)
leng = len(count)
ansallay = []
#抽出用に何回出てればansに出すかを変数に突っ込む
record = count.most_common()[0][1]
ms=count.most_common()
for num in range(leng):
    if(ms[num][1] == record):
        ansallay.append(ms[num][0])
    else:
        break
ansallay.sort()
for word in ansallay:
    print(word)