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

# -*- coding: utf-8 -*-


def main():
    from fractions import gcd

    n = int(input())
    a = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    lcm = a[0]
    ans = 0

    for ai in a[1:]:
        lcm = lcm * ai // gcd(lcm, ai)

    for ai in a:
        ans += lcm // ai
        ans %= mod

    print(ans % mod)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-


def main():
    from fractions import gcd

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

    for ai in a:
        lcm = lcm * ai // gcd(lcm, ai)

    for ai in a:
        ans += lcm // ai

    print(ans % mod)


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

#!/usr/bin/env python3
import sys


def solve_naive(n: int, a: "List[int]"):
    b = list()
    for i in range(n):
        b.append(str(a[i]))
        b.reverse()
    print(" ".join(b))
    return

def solve_(n: int, a: "List[int]"):
    a = list(map(str, a))
    b = list()
    for i in range(n):
        if i % 2 == 0:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    if n % 2 == 0:
        b.reverse()
    print(" ".join(b))
    return

def solve(n: int, a: "List[int]"):
    a = list(map(str, a))
    b = list()
    for i in range(n):
        if i % 2 == (n-1) % 2:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    print(" ".join(b))
    return

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, a)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve_naive(n: int, a: "List[int]"):
    b = list()
    for i in range(n):
        b.append(str(a[i]))
        b.reverse()
    print(" ".join(b))
    return

def solve_(n: int, a: "List[int]"):
    a = list(map(str, a))
    b = list()
    for i in range(n):
        if i % 2 == 0:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    if n % 2 == 0:
        b.reverse()
    print(" ".join(b))
    return

def solve__(n: int, a: "List[int]"):
    a = list(map(str, a))
    b = list()
    for i in range(n):
        if i % 2 == (n-1) % 2:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    print(" ".join(b))
    return

def solve___(n: int, a: "List[int]"):
    b = list()
    for i in range(n):
        if i % 2 == (n-1) % 2:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    print(*b)
    return

def solve(n: int, a: "List[int]"):
    import collections
    b = collections.deque()
    for i in range(n):
        if i % 2 == (n-1) % 2:
            # push
            b.appendleft(a[i])
        else:
            # append
            b.append(a[i])
    print(*b)
    return

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, a)

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

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

t = 1
a = 1

for i in range(N):
    T, A = TA[i]
    mul = 2
    while t > T or a > A:
        T = TA[i][0] * mul
        A = TA[i][1] * mul
        mul += 1
    t = T
    a = A
print(t+a)

### FIXED CODE ###

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

t = 1
a = 1

for i in range(N):
    T, A = TA[i]
    if t > T or a > A:
        tmul = (t+T-1) // T
        amul = (a+A-1) // A
        mul = max(tmul, amul)
        T *= mul
        A *= mul
    t = T
    a = A
print(t+a)
### BUGGY CODE ###

import bisect
import math
N = int(input())
A = list(map(int, input().split()))
A.sort()
already = set()

def is_in(t, n):
    i = bisect.bisect_left(A, t)
    if i >= n:
        return -1

    while i < n and t == A[i]:
        if i not in already:
            already.add(i)
            return i
        i += 1

    return -1

res = 0
for n in range(len(A) - 1, -1, -1):
    if n in already:
        continue

    a = A[n]
    t = 1 << (int(math.log2(a)) + 1)

    while t > a:
        i = is_in(t - a, n)
        if i != -1:
            res += 1
            break
        t >>= 1

print(res)



### FIXED CODE ###

import bisect
import math
N = int(input())
A = list(map(int, input().split()))
T = [2 ** i for i in range(31)]
A.sort()
already = set()


def to_dic(A):
    d = {}
    for a in A:
        d[a] = d.setdefault(a, 0) + 1

    return d

def is_in(t, num):
    i = D.setdefault(t, 0)
    if i == 0:
        return 0
    s = min(i, num)
    D[t] -= s
    return s


res = 0
D = to_dic(A)
A2 = list(D.keys())
A2.sort()

for n in range(len(A2) - 1, -1, -1):
    a = A2[n]

    if a in T:
        res += D[a] // 2
        D[a] = 0

        if D[a] % 2 == 0:
            continue

    num = D[a]
    t = 1 << (int(math.log2(a)) + 1)

    while t > a:
        s = is_in(t - a, num)
        res += s
        num -= s
        if num == 0:
            break

        t >>= 1

print(res)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')

N, W = MAP()
w, v = ZIP(N)
max_v = N*sum(v)
dp = [INF]*(max_v+1)
dp[0] = 0
for w, v in zip(w, v):
	for i in range(max_v, -1, -1):
		if i-v >= 0:
			dp[i] = min(dp[i], dp[i-v]+w)

ans = 0
for i in range(len(dp)):
	if dp[i] <= W:
		ans = max(ans, i)
print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')

N, W = MAP()
w, v = ZIP(N)
max_v = sum(v)
dp = [INF]*(max_v+1)
dp[0] = 0
for w, v in zip(w, v):
	for i in range(max_v, -1, -1):
		if i-v >= 0:
			dp[i] = min(dp[i], dp[i-v]+w)

ans = 0
for i in range(len(dp)):
	if dp[i] <= W:
		ans = i
print(ans)
### BUGGY CODE ###

import math
from functools import reduce
from collections import deque,defaultdict
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def hoge(n):
    count = 0
    i = 0
    while count < n:
        if "0" not in str(2019*i):
            count += 1
            print(2019*i)
        i += 1


s = input()
X = list(map(int, list(s)))
n = len(s)

ruiseki = [0] * (n+1)
for i in (range(n-1, -1, -1)):
    ruiseki[i] = (X[i] * 10**(n-i-1) + ruiseki[i+1]) % 2019

# log(ruiseki)

ans = 0
count = defaultdict(int)

for x in ruiseki:
    # log(count[x])
    ans += count[x]
    count[x] += 1
# log(count)
print(ans)


### FIXED CODE ###

import math
from functools import reduce
from collections import deque,defaultdict
import sys
sys.setrecursionlimit(10**7)

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

s = input()
X = list(map(int, list(s)))
n = len(s)

ruiseki = [0] * (n+1)
for i in (range(n-1, -1, -1)):
    ruiseki[i] = (X[i] * pow(10, (n-i-1), 2019) + ruiseki[i+1]) % 2019

# log(ruiseki)

ans = 0
count = defaultdict(int)

for x in ruiseki:
    # log(count[x])
    ans += count[x]
    count[x] += 1
# log(count)
print(ans)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import deque

N,Q = map(int,readline().split())
ki = []
for i in range(N-1):
    ki.append(list(map(int,readline().split())))
co = []
for i in range(Q):
    co.append(list(map(int,readline().split())))
 
#print(ki)

kid = deque(ki)
#print(kid)

ver = []
for i in range(N):
    ver.append([0,False])
 
for i in range(Q):
    ver[co[i][0]-1][0] += co[i][1]

ver[0][1] = True
#print(ver)


while len(kid) != 0:
    k = kid.popleft()
    if ver[k[0]-1][1] == True:
        ver[k[1]-1][0] += ver[k[0]-1][0]
        ver[k[1]-1][1] = True
    elif ver[k[1]-1][1] == True:
        ver[k[0]-1][0] += ver[k[1]-1][0]
        ver[k[0]-1][1] = True
    else:
        kid.append(k)

for i in range(N):
    print(ver[i][0],end=' ')


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import deque

N,Q = map(int,readline().split())
ki = []
for i in range(N-1):
    ki.append(list(map(int,readline().split())))
co = []
for i in range(Q):
    co.append(list(map(int,readline().split())))
 
ki.sort(key=lambda x: x[1])

kid = deque(ki)
ver = []
check = []
for i in range(N):
    ver.append(0)
    check.append(False)
 
for c in co:
    ver[c[0]-1] += c[1]

check[0] = True

kid2 = deque()

while len(kid) != 0:
    k = kid.popleft()
    if check[k[0]-1] == True:
        ver[k[1]-1] += ver[k[0]-1]
        check[k[1]-1] = True
    elif check[k[1]-1] == True:
        ver[k[0]-1] += ver[k[1]-1]
        check[k[0]-1] = True
    else:
        kid2.append(k)

while len(kid2) != 0:
    k = kid2.pop()
    if check[k[0]-1] == True:
        ver[k[1]-1] += ver[k[0]-1]
        check[k[1]-1] = True
    elif check[k[1]-1] == True:
        ver[k[0]-1] += ver[k[1]-1]
        check[k[0]-1] = True
    else:
        kid2.appendleft(k)


print(' '.join(map(str,ver)))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]
amax = max(A)
amaxcnt = A.count(amax)

for i in range(N):
    a0 = A.pop(0)
    if a0 == amax and amaxcnt == 1:
        print(max(A))
    else:
        print(amax)


### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]
amax = max(A)
amaxcnt = A.count(amax)

for i in range(N):
    ai = A[i]
    if ai == amax and amaxcnt == 1:
        A.pop(i)
        print(max(A))
        A.insert(i, 0)
    else:
        print(amax)
### BUGGY CODE ###

from queue import Queue

#入力
H, W = map(int, input().split())

lst = []
for i in range(H):
    lst += [list(input())]

count = 0 #白色のマスの総数
for i in range(H):
    for j in range(W):
        if lst[i][j] == '.':
            count += 1

sx, sy = 1, 1 #スタート位置
gx, gy = H, W #ゴール位置

move = [[-1, 0], [1,0], [0, -1], [0, 1]]

def bfs(x, y):
    q = Queue()
    INF = 10 ** 9
    d = [[INF]* W for _ in range(H)]
    q.put(x)
    q.put(y)
    d[x][y] = 0

    while True:
        px = q.get()
        py = q.get()
        if px == gx-1 and py == gy-1:
            break
        else:
            for dx, dy in move:
                nx = px + dx
                ny = py + dy

                if 0 <= nx and nx < H and 0 <= ny and ny < W and lst[nx][ny] == '.' and d[nx][ny] == INF:
                    q.put(nx)
                    q.put(ny)
                    d[nx][ny] = d[px][py] + 1
    return d[gx-1][gy-1]

a = bfs(sx-1, sy-1)

if a == 10 **9:
    print (-1)
else:
    print (count - a - 1)


### FIXED CODE ###

from queue import Queue

#入力
H, W = map(int, input().split())

#lst = [['a']*W for _ in range(H)]
count = 0 #白色のマスの総数
lst = []
row = []
for i in range(H):
    row = list(input())
    count += row.count('.')
    lst += [row]
 
#for i in range(H):
#    for j in range(W):
#        if lst[i][j] == '.':
#            count += 1

#sx, sy = 1, 1 #スタート位置
#gx, gy = H, W #ゴール位置

move = [[-1, 0], [1,0], [0, -1], [0, 1]]

def bfs():
    q = Queue()
    INF = 10 ** 9
    d = [[INF]* W for _ in range(H)]
    q.put(0)
    q.put(0)
    d[0][0] = 0

    while True:
        if q.empty():
            break
        else:
            px = q.get()
            py = q.get()
            if px == H-1 and py == W-1:
                break
            else:
                for dx, dy in move:
                    nx = px + dx
                    ny = py + dy

                    if 0 <= nx and nx < H and 0 <= ny and ny < W and lst[nx][ny] == '.' and d[nx][ny] == INF:
                        q.put(nx)
                        q.put(ny)
                        d[nx][ny] = d[px][py] + 1
    return d[H-1][W-1]

a = bfs()

if a == 10 **9:
    print (-1)
else:
    print (count - a - 1)
### BUGGY CODE ###

import itertools

N,M,R = map(int,input().split())
r = list(map(int,input().split()))
L = []
ans = float('inf')
for i in range(M):
    L.append(list(map(int,input().split())))
cost = []
for i in range(N):
    T = [float('inf') for j in range(N)]
    cost.append(T)
for i in range(M):
    cost[L[i][0]-1][L[i][1]-1] = L[i][2]
    cost[L[i][1]-1][L[i][0]-1] = L[i][2]
for l in range(N):
    for k in range(N):
        for m in range(N):
            cost[k][m] = min(cost[k][l]+cost[l][m], cost[k][m])

junretu = list(itertools.permutations(r))
for i in range(len(junretu)):
    temp = 0
    for j in range(len(r)-1):
        c = junretu[i][j]
        d = junretu[i][j+1]
        temp += cost[c-1][d-1]
    ans = min(ans,temp)
print(ans)

### FIXED CODE ###

from scipy.sparse.csgraph import floyd_warshall
import itertools
n,m,r = map(int,input().split())
L = list(map(int,input().split()))
d = [[float("inf")]*n for i in range(n)]
for i in range(n):
    d[i][i] = 0
for i in range(m):
    a,b,l = map(int,input().split())
    d[a-1][b-1] = l
    d[b-1][a-1] = l
d = floyd_warshall(d)
ans = float('inf')
seq = []
for i in range(r):
  seq.append(i)
K = list(itertools.permutations(seq))
for i in range(len(K)):
  cur = 0
  for j in range(1,r):
    p = L[K[i][j-1]]-1
    q = L[K[i][j]]-1
    cur += d[p][q]
  if cur != float('inf'):
    if cur <= ans:
      ans = cur
print(int(ans))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

MOD = 998244353

def init(G, robots, fs, p):
    q = p+1
    while q < len(robots) and robots[q][0] < robots[p][0] + robots[p][1]:
        if fs[q]:
            G[p].append(q)
            fs[q] = False
            init(G, robots, fs, q)
        q += 1

def calc(G, p, fs):
    fs[p] = False
    if len(G[p]) == 0:
        return 2
    tmp = 1
    for v in G[p]:
        tmp *= calc(G, v, fs)
        tmp %= MOD
    tmp += 1
    return tmp

def main():
    n = int(input())
    robots = [list(map(int, input().split())) for _ in range(n)]
    G = [[] for _ in range(n)]
    robots.sort(key=lambda x: x[0])
    fs = [True]*n
    for i in range(n):
        if fs[i]:
            fs[i] = False
            init(G, robots, fs, i)
    fs = [True]*n
    ans = 1
    for i in range(n):
        if fs[i]:
            ans *= calc(G, i, fs)
            ans %= MOD
    print(ans % MOD)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

MOD = 998244353

def init(G, robots, fs, p):
    q = p
    while q < len(robots) and robots[q][0] < robots[p][0] + robots[p][1]:
        if fs[q]:
            G[p].append(q)
            fs[q] = False
            q = init(G, robots, fs, q) - 1
        q += 1
    return q

def calc(G, p, fs):
    fs[p] = False
    if len(G[p]) == 0:
        return 2
    tmp = 1
    for v in G[p]:
        tmp *= calc(G, v, fs)
        tmp %= MOD
    tmp += 1
    return tmp

def main():
    n = int(input())
    robots = [list(map(int, input().split())) for _ in range(n)]
    G = [[] for _ in range(n)]
    robots.sort(key=lambda x: x[0])
    fs = [True]*n
    q = 0
    while q < n:
        if fs[q]:
            fs[q] = False
            init(G, robots, fs, q)
        else:
            q += 1
    fs = [True]*n
    ans = 1
    for i in range(n):
        if fs[i]:
            ans *= calc(G, i, fs)
            ans %= MOD
    print(ans % MOD)

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

N = int(input())
A = input().split()
cutoff = 10**18
res = 1
for n in range(N):
	res *= int(A[n])
if res > cutoff:
	res = '-1'
print(res)

### FIXED CODE ###

N = int(input())
A = input().split()
if '0' in A:
	print(0)
else:
	cutoff = 10**18
	res = 1
	for n in range(N):
		res *= int(A[n])
		if res > cutoff:
			res = '-1'
			break
	print(res)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    l, r, d = map(int, input().split())
    l, r = l - 1, r - 1
    G[l].append((r, d))
    G[r].append((l, -d))

R = [None] * N


def dfs(u):
    for w, d in G[u]:
        if not R[w]:
            R[w] = R[u] + d
            if not dfs(w):
                return False
        else:
            if R[w] != R[u] + d:
                return False
    return True


for i in range(N):
    if not R[i]:
        R[i] = 0
        if not dfs(i):
            print('No')
            exit()

print('Yes')


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
N, M = map(int, sys.stdin.readline().split())
G = [[] for i in range(N)]
for i in range(M):
    l, r, q = map(int, sys.stdin.readline().split())
    G[l - 1].append((r - 1, q))
    G[r - 1].append((l - 1, -q))

R = [None] * N


def dfs(u):
    global R, G
    for w, d in G[u]:
        if R[w] is None:
            R[w] = R[u] + d
            if not dfs(w):
                return False
        else:
            if R[w] != R[u] + d:
                return False
    return True


flag = True
for i in range(N):
    if R[i] is None:
        R[i] = 0
        flag &= dfs(i)

if flag:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

s=str(input())
L=len(s)

while '01' in s or '10' in s:

    s=s.replace('10','')
    s=s.replace('01','')

Ls=len(s)

print(L-Ls)





### FIXED CODE ###

s=str(input())

Rc=s.count('1')
Bc=s.count('0')

print(min(Rc,Bc)*2)
### BUGGY CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
ans = 0
for i in range(N):
    for j in range(i,N):
        ans += np.min(A[i:j+1])

print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
l = [i for i in range(N)]
r = [i for i in range(N)]

b = [0] * N
for i in range(N):
    b[a[i]-1] = i

ans = 0
for i in range(N-1,-1,-1):
    m = b[i]
    x,y = l[m],r[m]
    ans += (i+1)*(m-x+1)*(y-m+1)
    l[min(y+1,N-1)] = x
    r[max(x-1,0)] = y
print(ans)
### BUGGY CODE ###

from fractions import gcd
from functools import reduce


def gcdall(numlist):
    return reduce(gcd, numlist)


def main():
    _ = int(input())
    a = list(map(int, input().split()))
    if len(a) < 3:
        print(max(a))
        return

    gcds = []
    for i in range(len(a)):
        gcds.append(gcdall([a[j] for j in range(len(a)) if j != i]))
    print(max(gcds))


main()

### FIXED CODE ###

from fractions import gcd  # in math module python >= 3.5


def main():
    n = int(input())
    a = list(map(int, input().split()))
    if len(a) < 3:
        print(max(a))
        return

    ls = []
    for i in range(n+1):
        if i == 0:
            ls.append(0)
        else:
            ls.append(gcd(ls[i-1], a[i-1]))

    rs = []
    for i in range(n+1):
        if i == 0:
            rs.append(0)
        else:
            rs.append(gcd(rs[i-1], a[-i]))
    rs = list(reversed(rs)) + [0]

    m = [gcd(ls[i], rs[i+1]) for i in range(n+1)]

    print(max(m))


main()
### BUGGY CODE ###

p,*d,a,i=[1,1]+[0]*2020
for j in input()[::-1]:
  i=(i+int(j)*p)%2019
  a+=d[i]
  d[i]+=1
  p*=10
print(a)

### FIXED CODE ###

a,*d=[0]*2020
for i in map(int,input()):
  p=[0]*2019
  for j in range(2019):p[(j*10+i)%2019]+=d[j]
  d=p
  d[i]+=1
  a+=d[0]
print(a)
### BUGGY CODE ###

N = int(input())

S = []
Sdict = dict()
for _ in range(N):
    s = input()
    if s in S:
        Sdict[s] += 1
    else:
        S.append(s)
        Sdict[s] = 0
    
maxi = max(Sdict.values())

def get_keys_from_value(d, val):
	return [k for k, v in d.items() if v == val]

for k in sorted(get_keys_from_value(Sdict,maxi)):
	print(k)

### FIXED CODE ###

N = int(input())

Sdict = dict()
max = 0
for _ in range(N):
    s = input()
    if s in Sdict:
        Sdict[s] += 1
    else:
        Sdict[s] = 0
    
maxi = 0
lis = []
for k,v in Sdict.items():
    if v > maxi:
        lis = [k]
        maxi = v
    elif v == maxi:
        lis.append(k)
lis.sort()
for k in lis:
    print(k)
### BUGGY CODE ###

n,Q=map(int,input().split())
xs,qs = [],[]
for _ in range(n):
    s,t,x=map(int,input().split())
    s,t,x=s-x-0.5,t-x-0.5,x
    xs.append((s,1,x))
    xs.append((t,0,x))
xs.sort()
q = int(input())
rs = set()
for t,r,x in xs:
    while True:
        if q < t:
            if rs:
                print(min(rs))
            else:
                print(-1)
            Q-=1
            if Q == 0:
                break
            q = int(input())
        else:
            break
#    print(t,r,x)
    if Q==0:
        break
    if not r:
        rs.remove(x)
    else:
        rs.add(x)
print("-1\n"*Q)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n,Q=map(int,input().split())
b_num = 2**(n-1).bit_length()
mx = 10**9
segl=[mx]*2*b_num 

def update( k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
    
if __name__ == '__main__':
    xs = []
    for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
    for _ in range(Q):
        xs.append((int(input()),2))
    xs.sort(key=lambda x:x[0])
    for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx)
### BUGGY CODE ###

n=int(input())
s=input()
ans=n+1
for i in range(n):
  c=0
  c+=s[:i].count('W')
  c+=s[i+1:].count('E')
  ans=min(ans,c)
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
ans=n+1
l=[0]*(n+1)
for i in range(n):
  if s[i]=='E':
    l[i+1]=l[i]+1
  else:
    l[i+1]=l[i]
ans=n+1
for i in range(n):
  ans=min(ans,i-l[i]+l[n]-l[i+1])
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)
for i in range(N):
    tmp = 0
    for j in range(i+1, N):
        if(i+1 == A[j]):
            tmp += 1
        else:
            pass
    print(tmp)

### FIXED CODE ###


N = int(input())
A = list(map(int, input().split()))
dp = [0]*N
for i in range(len(A)):
    dp[A[i]-1] += 1
for i in range(N):
    print(dp[i])