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

n = int(input())

s = [str(input()) for i in range(n)]

from collections import Counter
c = Counter(s)

result = [i[0] for i in c.items() if i[1]==max(c.values())]
result = sorted(result)

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

### FIXED CODE ###

n = int(input())
 
s = [str(input()) for i in range(n)]
 
from collections import Counter
c = Counter(s)

max_num = max(c.values())

result = [i[0] for i in c.items() if i[1]==max_num]
result.sort()
 
for i in range(len(result)):
    print(result[i])
### BUGGY CODE ###

import bisect
 
N = int(input())
a = list(map(int,input().split(' ')))
a.sort(reverse = True)
 
 
fathers = [a.pop(0)]
for _ in range(N):
    sons = list()
    b = list()

    for father in fathers:
        while a:
            x = a.pop(0)
            if father > x:
                sons.append(x)
                break
            else:
                b.append(x)
                
    a = b + a
    fathers.extend(sons)
    fathers.sort(reverse = True)
    


if len(fathers) == 2**N:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = int(input())
A = sorted((int(x) for x in input().split()))
 
parent = [A[-1]]
rest = A[:-1]
bl = True
for _ in range(N):
    next_parent = []
    next_rest = []
    for p in parent[::-1]:
        while rest:
            x = rest.pop()
            if x < p:
                next_parent.append(x)
                break
            else:
                next_rest.append(x)
                continue
    parent += next_parent
    parent.sort()
    rest = rest + next_rest[::-1]
 
bl = len(parent) == (2**N)
answer = 'Yes' if bl else 'No'
print(answer)
### BUGGY CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
 
DP = [0]
for i in range(N-1):
    act = float("inf")
    for k in range(K):
        if i-k < 0 : continue
        act = min(DP[-1-k] + abs(h[i-k]-h[i+1]) , act)
    DP += [act]
 
print(DP[-1])

### FIXED CODE ###

n,k = map(int, input().split())
h = [i for i in map(int, input().split())]

DP = [0]
for i in range(n-1):
    act = float("inf")
    for j in range(k):
        if i < j: continue
        act = min(abs(h[i+1]-h[i-j])+DP[-1-j], act)
    DP += [act]
    

print(DP[-1])
### BUGGY CODE ###

#!/usr/bin/env python
import math

n = int(input())
m = int(math.sqrt(n))+1
x = y = z = 0 

def p(x, y, z): 
    return x*x + y*y + z*z + x*y + y*z + z*x 

anss = [0 for _ in range(n)]
visited = []

def dfs(x, y, z): 
    if x+y+z > m or (x, y, z) in visited:
        return
    if p(x, y, z)-1 <= n-1:
        anss[p(x, y, z)-1] += 1
        visited.append((x, y, z)) 
        dfs(x+1, y, z)
        dfs(x, y+1, z)
        dfs(x, y, z+1)

# output
dfs(1,1,1)
for i in range(n):
    print(anss[i])


### FIXED CODE ###

#!/usr/bin/env python
import math

n = int(input())
m = int(math.sqrt(n))+1
x = y = z = 0 

def p(x, y, z): 
    return x*x + y*y + z*z + x*y + y*z + z*x 

anss = [0 for _ in range(n)]

for x in range(1, m): 
    for y in range(1, m): 
        for z in range(1, m): 
            if p(x, y, z)-1 <= n-1:
                anss[p(x, y, z)-1] += 1

for i in range(n):
    print(anss[i])
### BUGGY CODE ###

import sys

h, w, m = map(int, input().split())
row = [0]*h
col = [0]*w
bomb = []
for x in range(m):
    H, W = map(int, input().split())
    bomb.append((H-1, W-1))
    row[H-1] += 1
    col[W-1] += 1

maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i in range(h):
    if row[i] == maxrow:
        p.append(i)
for i in range(w):
    if col[i] == maxcol:
        q.append(i)

for i in p:
    for j in q:
        if (i, j) not in bomb:
            print(ans + 1)
            exit()
print(ans)


### FIXED CODE ###

import sys

h, w, m = map(int, input().split())
row = [0]*h
col = [0]*w
bomb = set()
for x in range(m):
    H, W = map(int, input().split())
    bomb.add((H-1, W-1))
    row[H-1] += 1
    col[W-1] += 1

maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i in range(h):
    if row[i] == maxrow:
        p.append(i)
for i in range(w):
    if col[i] == maxcol:
        q.append(i)

for i in p:
    for j in q:
        if (i, j) not in bomb:
            print(ans + 1)
            exit()
print(ans)
### BUGGY CODE ###

N = int(input())
 
s_list = {}
cnt = 0
for i in range(N):
    candidate = input()
 
    # Check key
    if (candidate[0] in s_list) == False:
        tmp = {candidate[0]:[]}
        s_list.update(tmp)
 
    for s in s_list[candidate[0]]:
        if candidate == s:
            break
    else:
        cnt += 1
        s_list[candidate[0]].append(candidate)
 
print(cnt)

### FIXED CODE ###

s_list = []
N = int(input())
for _ in range(N):
    s_list.append(input())

print(len(set(s_list)))
### BUGGY CODE ###

N = int(input())
c = 1
a = list(map(int,input().split()))
for i in range(N):
  c *= a[i]
  if i == N-1:
    if c > 1000000000000000000:
      print(-1)
      break
    else :
      print(c)

### FIXED CODE ###

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

if 0 in A:
  print(0)
  exit()

for i in range(N):
  c *= A[i]
  if c > 10 ** 18:
    print(-1)
    exit()
print(c)
### BUGGY CODE ###

s = input()
q = int(input())
top = ""
end = ""
count = 0
for i in range(q):
    a = input()
    if len(a) == 1:
        count += 1
    else:
        a = list(a.split())
        if (count + int(a[1])) % 2 == 0:
            end = end + a[2]
        else:
            top = a[2] + top
ans = top + s + end
if count % 2 == 1:
    ans = ans[::-1]
print(ans)

### FIXED CODE ###

s = input()
q = int(input())
top = ""
end = ""
count = 0
for i in range(q):
    a = input()
    if len(a) == 1:
        count += 1
    else:
        a = list(a.split())
        if (count + int(a[1])) % 2 == 0:
            end = end + a[2]
        else:
            top = a[2] + top
ans = top + s + end
if count % 2 == 1:
    ans = ans[::-1]
print(ans)
### BUGGY CODE ###

import sys
def main():
    n = int(input())

    mi = sys.maxsize
    for x in range(1, n + 1):
        if n % x == 0:
            mi = min(mi, max(len(str(x)), len(str(int(n / x)))))
    print(mi)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
def main():
    n = int(input())

    mi = sys.maxsize
    for x in range(1, n + 1):
        if x > int(n / x):
            break
        if n % x == 0:
            mi = min(mi, max(len(str(x)), len(str(int(n / x)))))
    print(mi)


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

import numpy as np

def main():
  S = input()
  MOD = int(1e9+7)
  N = len(S)

  dp = np.zeros((N, 13))
  amari = 1
  if S[N-1] != '?':
    dp[0, int(S[N-1])] = 1
  else:
    for j in range(10):
      dp[0,j] = 1

  for i in range(1,N):
    amari = amari * 10 % 13
    idx = N-i-1
    if S[idx] != '?':
      shift = int(S[idx]) * amari % 13
      for j in range(13):
        XX = (j+shift)%13
        dp[i, XX] = dp[i-1, j]
    else:
      for k in range(10):
        shift = k * amari % 13
        for j in range(13):
          XX = (j+shift)%13
          dp[i, XX] = (dp[i, XX] + dp[i-1, j]) % MOD

  print(int(dp[N-1, 5]))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import copy
S = input()
S = S[::-1]
dp = [0 for _ in range(13)]
dp[0] = 1

mod = int(1e9+7)

def calc(dp,i,k):
  dpw = [0 for _ in range(13)]
  if S[i] == '?':
    X = [i for i in range(10)]
  else:
    X = [int(S[i])]
  for j in range(13):
    for x in X:
      dpw[(j+x*k)%13] += dp[j]  
      dpw[(j+x*k)%13] %= mod
  return dpw

keta = 1
for i in range(len(S)):
  dp = calc(dp,i,keta)
  keta = keta * 10 % 13

#print(dp)
print(dp[5])
#print(sum(dp))
### BUGGY CODE ###

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

n = int(raw_input())
R_List = []
Max = 0
for i in range(n):
    R_List.append(int(raw_input()))
    if i == 0:
        continue
    elif i == 1:
        Max = R_List[1]-R_List[0]
    else:
        for j in range(i):
            Max = max(Max, R_List[i]-R_List[j])
print Max

### FIXED CODE ###

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

n = int(raw_input())
R_List = []
Max = 0
R_min = 0
for i in range(n):
    R_List.append(int(raw_input()))
    if i == 0:
        R_min = R_List[0]
    elif i == 1:
        Max = R_List[1]-R_min
        R_min = min(R_min, R_List[1])
    else:
        Max = max(Max, R_List[i]-R_min)
        R_min = min(R_min, R_List[i])
print Max
### BUGGY CODE ###

n=int(input())
a=input().split()
a=list(map(int,a))
i=0
ans=1
if(n==0):
    print(0)
    exit()
elif(len(a)==0):
    print(0)
    exit()
for calc in a:
    if(0 in a):
        print(0)
        exit()
    ans=ans*calc
    if(ans>1000000000000000000):
        print(-1)
        exit()
    i+=1
    if(i==n):
        break
if(ans>1000000000000000000):
    print(-1)
else:
    print(ans)


### FIXED CODE ###

n=int(input())
a=input().split()
a=list(map(int,a))
ans=1
if(0 in a):
    print(0)
    exit()

for calc in a:
    ans*=calc
    if(ans>10**18):
        print(-1)
        exit()
if(ans>10**18):
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

# import math
N = int(input())

def f(x,y,z):
    return x**2 + y**2 + z**2 + x*y + y*z + z*x

ans = [0]*(N+1)

# upper = math.ceil(math.sqrt(N/6)) + 1
upper = N
for x in range(1, upper+1):
    for y in range(1, upper + 1):
        for z in range(1, upper + 1):
            v = f(x,y,z)
            if v <= N:
                ans[v] += 1
            else:
                break

for i in range(1, N+1):
    print(ans[i])

### FIXED CODE ###

N = int(input())

ans = [0]*(N+1)
for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      n = pow(x,2) + pow(y,2) + pow(z,2) + x*y + y*z + z*x
      if n <= N:
        ans[n] += 1
        
for i in range(1,N+1):
  print(ans[i])
### BUGGY CODE ###

S = str(input())
s = S
res = True
while res == True:
    if s.find('01') >= 0:
        s = s.replace('01','',1)
    elif s.find('10') >= 0:
        s = s.replace('10','',1)
    res0 = s.find('01')
    res1 = s.find('10')
    if res0 == -1 and res1 == -1:
        res = False
print(len(S) - len(s))

### FIXED CODE ###

S = str(input())
s = S
cont0 = s.count('0')
cont1 = s.count('1')
if cont0 > cont1:
    print(cont1 * 2)
else:
    print(cont0 * 2)
### BUGGY CODE ###

from collections import deque
N,Q = map(int,input().split())
edge = [[]for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
tree = [0]*N
for i in range(Q):
    p,x = map(int,input().split())
    tree[p-1] += x
flag = [0]*N
flag[0] = 1
queue = deque([0])
while queue != deque([]):
    p = queue.popleft()
    for i in edge[p]:
        if flag[i] == 0:
            flag[i] = 1
            tree[i] += tree[p]
            queue.append(i)

for i in tree:
    print(i,end=" ")


### FIXED CODE ###

from collections import deque
N,Q = map(int,input().split())
edge = [[]for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
tree = [0]*N
for i in range(Q):
    p,x = map(int,input().split())
    tree[p-1] += x
flag = [0]*N
flag[0] = 1
queue = deque([0])
while queue != deque([]):
    p = queue.popleft()
    for i in edge[p]:
        if flag[i] == 0:
            flag[i] = 1
            tree[i] += tree[p]
            queue.append(i)

for i in tree:
    print(i,end=" ")
### BUGGY CODE ###

def neighbor(N, edges):
    neighbor_list = [[] for _ in range(N)]
    for a, b in edges:
        neighbor_list[a-1] += [b]
        neighbor_list[b-1] += [a]
        
    return neighbor_list


def neighbor2(N, nlist, edges):
    nneighbor_list = [[] for _ in range(N)]
    for i in range(N):
        nneighbor_list[i] += nlist[i]
        for e in nlist[i]:
            nneighbor_list[i] += nlist[e - 1]
        nneighbor_list[i] = list(set(nneighbor_list[i]))
        if i + 1 in nneighbor_list[i]:
            nneighbor_list[i].remove(i + 1)
    return nneighbor_list
        
        
def combination(N, K, nnlist):
    combi = 1
    clist = [False]*N
    for v in range(N):
        print(combi)
        combi *= (K - len([t for t in nnlist[v] if clist[t-1]]))
        clist[v] = True
    return combi

def paint(N, K, nlist, nnlist, clist, vlist, combi):
    vlist_next = []
    for v in vlist:
        #nnlistの中で塗られている頂点の数を数え、色候補数Kから引く
        combi *= (K - len([t for t in nnlist[v - 1] if clist[t - 1]])) 
        clist[v - 1] = True #頂点vを塗る
        vlist_next += [t for t in nlist[v - 1] if not clist[t - 1]]
    return combi, vlist_next, clist


if __name__ == '__main__':
    N, K = map(int, input().split())
    edges = [None]*(N-1)
    
    for i in range(N-1):
        edges[i] = list(map(int, input().split()))
    
    nlist = neighbor(N, edges)
    nnlist = neighbor2(N, nlist, edges)
    
    vlist_next = [1]
    combi = 1
    clist = [False]*N
    for i in range(N):
        combi, vlist_next, clist = paint(N, K, nlist, nnlist, clist=clist, vlist=vlist_next, combi=combi)
        if len(vlist_next) == 0:
            break
    
    print(combi%1000000007)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def neighbor(N, edges):
    neighbor_list = [[] for _ in range(N)]
    for a, b in edges:
        neighbor_list[a-1] += [b-1]
        neighbor_list[b-1] += [a-1]
        
    return neighbor_list


def paint(K, nlist, now_num, from_num, case_num):
        mod = 1000000007
        if  from_num == -1:
            can_use_color = K - 1
        else:
            can_use_color = K - 2
        
        if len(nlist[now_num]) - 1 > can_use_color:
            return 0
        
        for child in nlist[now_num]:
            if child == from_num:
                continue
            else:
                case_num *= can_use_color
                can_use_color -= 1
                case_num %= mod
        
        for child in nlist[now_num]:
            if child == from_num:
                continue
            else:
                case_num = paint(K, nlist, child, now_num, case_num)
        return case_num%mod
            

if __name__ == '__main__':
    N, K = map(int, input().split())
    edges = [None]*(N-1)
    
    for i in range(N-1):
        edges[i] = list(map(int, input().split()))
    
    nlist = neighbor(N, edges)


    print(paint(K, nlist, 0, -1, K))
### BUGGY CODE ###

import math
A, B = map(int, input().split())

digits = [0] * (100)

i = B
mid = A + (B - A) // 2

partSum = B * (B+1) // 2 - A * (A+1) // 2 + A
S = 0
while S != partSum:
	x = i
	while x >= A:
		keta = math.floor(math.log2(x))
		# print(x, bin(x), keta)
		for j in range(keta + 1):
			if x >> j & 1 == 1:
				digits[j] += 1
		S += x
		if x % 2:
			break
		x //= 2
	i -= 1
# print(digits)
for i in range(100):
	digits[i] = digits[i] % 2
# print(digits)
	
pow = 1
ans = 0
for i in range(100):
	ans += digits[i] * pow
	pow *= 2
	
print(ans)
	

### FIXED CODE ###

A, B = map(int, input().split())

ones = [0] * 101
def calcones(end, pow):
	start = pow // 2
	if end < pow // 2:
		return 0
	
	n = (end - start + 1) // pow
	n *= pow // 2
	
	if 0 < (end - start + 1) % pow <= pow // 2:
		n += (end - start + 1) % pow
		
	return n

pow = 2
for i in range(1, 101):
	ones[i] = calcones(B, pow) - calcones(A-1, pow)
	pow *= 2
	
# print(ones)
		
ans = 0
pow = 1
for i in range(1, 101):
	ans += (ones[i] % 2) * pow
	pow *= 2
	
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n = int(input())
A = [int(input())]
for i in range(n-1):
    a = int(input())
    if a in A:
        A.remove(a)
    else:
        A.append(a)
print(len(A))


### FIXED CODE ###

import collections
import sys
input = sys.stdin.readline

n = int(input())
a = [0]*n
ans = 0
for i in range(n):
    a[i] = int(input())
count_a = collections.Counter(a).most_common()
for i in range(len(count_a)):
    if count_a[i][1]%2 != 0:
        ans += 1
print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())
s = []
mod = 998244353
for _ in range(k):
    l, r = map(int, input().split())
    s += [i for i in range(l, r + 1)]

s.sort()

dp = [0] * 2 * n
dp[1] = 1

for i in range(1, n):
    for j in s:
        if i + j <= n:
            dp[i + j] += dp[i]
            dp[i + j] %= mod

print(dp[n] % mod)


### FIXED CODE ###

n, k = map(int, input().split())
mod = 998244353
lr = [list(map(int, input().split())) for _ in range(k)]

dp = [0] * (n + 10)
dp[1] = 1
cumsum = [0] * (n + 10)
cumsum[1] = 1

for i in range(2, n + 1):
    for l, r in lr:
        if l >= i:
            continue

        ll = max(1, i - r)
        rr = i - l
        if ll <= rr:
            dp[i] += cumsum[rr] - cumsum[ll - 1]
            dp[i] %= mod
    cumsum[i] = cumsum[i - 1] + dp[i]
    cumsum[i] %= mod

print(dp[n] % mod)
### BUGGY CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))
G = [set() for _ in range(N)]
for i in range(M):
    u, v = sorted(map(int, input().split()),key=lambda x:[X[x-1],-x])
    G[v-1].add((u-1,i))
X,d,C = sorted([(x,i) for i, x in enumerate(X)]),[0]*M,[0]*N
for x, u in X:
    if C[u]:continue
    if not G[u]:break
    C[u]=1
    for c, _ in G[u]:
        if C[c]:
            C[u] = -C[c]
    S = [u]
    while S:
        q = S.pop()
        for c, i in G[q]:
            d[i] = str(x)
            if C[c]:continue
            S.append(c)
            C[c] = -C[q]
print("".join(" BW"[i] for i in C)+"\n"+"\n".join(d) if C[u] else -1)

### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
bxs = list(map(int, input().split()))
xs = bxs[:]
dd = defaultdict(set)
for i, x in enumerate(xs):
    dd[x].add(i+1)
xs = list(set(xs))
xs.sort()

#for x, i in xs:
G = [set() for _ in range(N+1)]
G2 = [set() for _ in range(N+1)]
es = []
for i in range(M):
    u, v = map(int, input().split())
    if bxs[u-1] == bxs[v-1]:
        G[v].add(u)
        G[u].add(v)
    elif bxs[u-1] > bxs[v-1]:
        G[u].add(v)
    else:
        G[v].add(u)
    e = (min(u,v), max(u,v))
    es.append(e)

r = True
d = dict()
cc = [-1 for _ in range(N+1)]
for i in range(N):
    if len(G[i+1]) == 0:
        print(-1)
        sys.exit()
for x in xs:
    for u in dd[x]:
        if cc[u] != -1:
            continue
        for c in G[u]:
            if cc[c] == -1:
                cc[u] = 1
                break
            else:
                cc[u] = 1-cc[c]
        stack = [u]
        while stack:
            q = stack.pop()
            for c in G[q]:
                e = (min(q,c), max(q,c))
                if e in d:
                    continue
                d[e] = x
                if cc[c] != -1:
                    continue
                stack.append(c)
                cc[c] = 1 - cc[q]
for i in range(1, N+1):
    if cc[i] == -1:
        print(-1)
        sys.exit()
for i in range(1, N+1):
    print("B"if cc[i] else "W", end="")
print()
for i in range(M):
    print(d[es[i]])
### BUGGY CODE ###

import numpy as np


def main():
    n, k = map(int, input().split())
    ps = (np.array(list(map(int, input().split()))) + 1) / 2

    ans = -float("inf")
    for i in range(n-k+1):
        ans = max(ans, sum(ps[i:i+k]))
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


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

n = int(input())
s = "a" + input() + "a"
ma = n

for i in range(1,n+1):
  c = s[:i].count("W") + s[i+1:].count("E")
  ma = min(c,ma)
  
print(ma)

### FIXED CODE ###

n = int(input())
s = input()
ma = s[1:].count("E")
maa = ma

for i in range(n-1):
  if s[i] == "W" and s[i+1] == "W":
    ma += 1
  elif s[i] == "E" and s[i+1] == "E":
    ma -= 1
    
  maa = min(maa,ma)
  
print(maa)
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)[:K]
B = sorted(map(int, input().split()), reverse=True)[:K]
C = sorted(map(int, input().split()), reverse=True)[:K]

AB = sorted([a + b for a in A for b in B], reverse=True)[:K]
ABC = sorted([ab + c for ab in AB for c in C], reverse=True)[:K]
for v in ABC:
    print(v)


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

for cakes in A, B, C:
    cakes.sort(reverse=True)

cake_values = []
for i in range(len(A)):
    if i + 1 > K:
        break
    for j in range(len(B)):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(len(C)):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            cake_values.append(A[i] + B[j] + C[k])
cake_values.sort(reverse=True)
for i in range(K):
    print(cake_values[i])
### BUGGY CODE ###

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

for i in range(1, n+1):
    print(a_list.count(i))


### FIXED CODE ###

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

ans_dict = {}
for a in a_list:
    if not(a in ans_dict):
        ans_dict[a] = 0
    ans_dict[a] += 1

for i in range(1, n+1):
    if i in ans_dict:
        print(ans_dict[i])
    else:
        print(0)
### BUGGY CODE ###

#coding=utf-8
import itertools

#[a] -> {a: Int} 
def group_count(l):
    group = list(set(l))
    dic = {}
    for x in group:
        dic[x] = l.count(x)
    return dic

def solve(n, ss):
    filtered_ss = list(filter(lambda x: x in "MARCH", map(lambda x:x[0], ss)))

    gc = group_count(filtered_ss)
    if len(gc) < 3:
        return 0

    ans = 0
    for permutation in itertools.combinations("MARCH", 3):
        if permutation[0] in gc.keys() and permutation[1] in gc.keys() and permutation[2] in gc.keys():
            tmp = (gc[permutation[0]] * gc[permutation[1]] * gc[permutation[2]])
            ans = ans + tmp

    return ans

def main():
    n = int(input())
    ss = []
    for x in range(n):
        ss = ss + [input()]
    print(solve(n, ss))

if __name__ == '__main__':
    main()


### FIXED CODE ###

#coding=utf-8
from itertools import combinations
from collections import Counter

def solve(n, gc):
    #filtered_ss = list(filter(lambda x: x in "MARCH", ss))

    #gc = Counter(filtered_ss)
    if len(gc) < 3:
        return 0

    ans = 0
    for permutation in combinations("MARCH", 3):
        ans += (gc[permutation[0]] * gc[permutation[1]] * gc[permutation[2]])

    return ans

def main():
    n = int(input())
    gc = {'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0}
    for _ in range(n):
        x = input()[0]
        if x in "MARCH":
            gc[x] += 1
    print(solve(n, gc))

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

N = int(input())
A = [int(num) for num in input().split()]

ans = 0
mod = 1e9+7

for i in range(N-1):

    if A[i] > mod:

        A[i] = A[i]%mod

    for j in range(i+1, N):

        if A[j] > mod:
        
            A[j] = A[j]%mod
        
        ans += A[i]*A[j]

ans = int(ans%mod)
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = sum(a)
ans = 0
for i in range(n-1):
    ans += a[i] *(b-a[i])
    b = b - a[i]
print(ans % (10**9 + 7))
### BUGGY CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N = i()
A = l()
num = sum(A)//2
A = A+A
ans = [0]*N
for i in range(N):
    tmp = num
    for j in range(i,i+N-2,2):
        tmp -= A[j]
    ans[i-1] = tmp*2
for i in ans:
    print(i)

### FIXED CODE ###

def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))

N = i()
A = l()
num = sum(A)//2
A += A
ans = []
for i in range(1):
    num2 = 0
    for j in range(0,N,2):
        num2 += A[i+j]
    ans.append(abs((num-num2))*2)
    r = abs((num-num2))*2
for i in range(1,N):
    r = A[i-1]*2-r
    ans.append(r)
print(*ans)