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

# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
X = []
Y = []
P = []
for _ in range(N):
    x,y,p = map(int,readline().split())
    X.append(x)
    Y.append(y)
    P.append(p)

DX = [[0]*N for _ in range(1<<N)]
DY = [[0]*N for _ in range(1<<N)]

for i,x in enumerate(X):
    for k in range(1<<N):
        d = abs(x)
        for j,xx in enumerate(X):
            if (k>>j)&1:
                d = min(d,abs(x-xx))
        DX[k][i] = d * P[i]    
for i,y in enumerate(Y):
    for k in range(1<<N):
        d = abs(y)
        for j,yy in enumerate(Y):
            if (k>>j)&1:
                d = min(d,abs(y-yy))
        DY[k][i] = d * P[i]                                                

PC = [0]*(1<<N)
for i in range(1<<N):
    PC[i] = PC[i//2] + 1 if i % 2 else PC[i//2]

RA = []
for i in range(1<<N):
    t = []
    for j in range(N):
        if i>>j & 1:
            t.append(j)
    RA.append(t)

INF = 10**31
mm = (1 << N) - 1
ANS = [INF]*(N+1)

for i in range(1<<N):
    m = i^mm
    j = m
    dxi = DX[i]
    pci = PC[i]
    while True:
        dyj = DY[j]
        ans = 0
        for k in RA[i^j^mm]:
            ans += min(dxi[k],dyj[k])
        pc = pci + PC[j]
        if ans < ANS[pc]:
            ANS[pc] = ans       
        if j == 0:
            break
        j = m & (j - 1)
print(*ANS,sep = '\n')

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
X = []
Y = []
P = []
for _ in range(N):
    x,y,p = map(int,readline().split())
    X.append(x)
    Y.append(y)
    P.append(p)

DX = [[0]*N for _ in range(1<<N)]
DY = [[0]*N for _ in range(1<<N)]

for i,x in enumerate(X):
    for k in range(1<<N):
        d = abs(x)
        for j,xx in enumerate(X):
            if (k>>j)&1:
                d = min(d,abs(x-xx))
        DX[k][i] = d * P[i]    
for i,y in enumerate(Y):
    for k in range(1<<N):
        d = abs(y)
        for j,yy in enumerate(Y):
            if (k>>j)&1:
                d = min(d,abs(y-yy))
        DY[k][i] = d * P[i]                                                

PC = [0]*(1<<N)
for i in range(1<<N):
    PC[i] = PC[i//2] + 1 if i % 2 else PC[i//2]

RA = []
for i in range(1<<N):
    t = []
    for j in range(N):
        if i>>j & 1:
            t.append(j)
    RA.append(t)

INF = 10**31
mm = (1 << N) - 1
ANS = [INF]*(N+1)

for i in range(1<<N):
    m = i^mm
    j = m
    dxi = DX[i]
    pci = PC[i]
    while True:
        dyj = DY[j]
        ans = 0
        for k in RA[i^j^mm]:
            ans += min(dxi[k],dyj[k])
        pc = pci + PC[j]
        if ans < ANS[pc]:
            ANS[pc] = ans       
        if j == 0:
            break
        j = m & (j - 1)
print(*ANS,sep = '\n')
### BUGGY CODE ###

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

from collections import defaultdict

cnt = defaultdict(int)
for i in range(n):
    cnt[a[i]] += 1
# print(cnt)

for key, val in list(cnt.items()):
    if val < 2:
        cnt.pop(key)
# print(cnt)

for i in range(n):
    flag = False
    if a[i] in cnt:
        cnt[a[i]] -= 1
        flag = True
    # print(cnt)
    ans = 0
    for val in cnt.values():
        if val >= 2:
            ans += val*(val-1)//2
    print(ans)
    if flag:
        cnt[a[i]] += 1

### FIXED CODE ###

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

from collections import defaultdict

cnt = defaultdict(int)
for i in range(n):
    cnt[a[i]] += 1
# print(cnt)

for key, val in list(cnt.items()):
    if val < 2:
        cnt.pop(key)
# print(cnt)

total = 0
for val in cnt.values():
    if val >= 2:
        total += val*(val-1)//2

for i in range(n):
    diff = 0
    if a[i] in cnt:
        y = (cnt[a[i]]-1)*cnt[a[i]]//2
        x = (cnt[a[i]]-1)*(cnt[a[i]]-2)//2
        diff = y - x
    print(total - diff)
        
        

# for i in range(n):
#     flag = False
#     if a[i] in cnt:
#         cnt[a[i]] -= 1
#         flag = True
#     # print(cnt)
#     ans = 0
#     for val in cnt.values():
#         if val >= 2:
#             ans += val*(val-1)//2
#     print(ans)
#     if flag:
#         cnt[a[i]] += 1
### BUGGY CODE ###

n,m,k=map(int,input().split())
r=[0]*(n+1)
c=[0]*(m+1)
l=[]
for _ in range(k):
  a,b=map(int,input().split())
  l.append([a,b])
  r[a]+=1
  c[b]+=1
m1=max(r)
x=[]
for i in range(n+1):
  if(r[i]==m1):
    x.append(i)
m2=max(c)
y=[]
for i in range(m+1):
  if(c[i]==m2):
    y.append(i)
ans=m1+m2
z=0
for i in x:
  for j in y:
    if([i,j] not in l):
      z=-1
      break
if(z==0):
  print(ans-1)
else:
  print(ans)   
      

  

### FIXED CODE ###

n,m,k=map(int,input().split())
m+=1
n+=1
r=[0]*(n)
c=[0]*(m)
d={}
for _ in range(k):
  a,b=map(int,input().split())
  d[(a,b)]=1
  r[a]+=1
  c[b]+=1
m1=max(r)
x=[]
for i in range(n):
  if(r[i]==m1):
    x.append(i)
m2=max(c)
y=[]
for i in range(m):
  if(c[i]==m2):
    y.append(i)
ans=m1+m2
z=0
for i in x:
  for j in y:
    if((i,j) not in  d):
      z=-1
      break
if(z==0):
  print(ans-1)
else:
  print(ans)
### BUGGY CODE ###

N, M = map(int, input().split(" "))
stores = []
for i in range(N):
    Ai, Bi = map(int, input().split(" "))
    tg_idx = -1
    for idx, s in enumerate(stores):
        if s[0] > Ai:
            tg_idx = idx
            break
    if tg_idx != -1:
        stores.insert(tg_idx, (Ai, Bi))
    else:
        stores.append((Ai, Bi))

price = 0
for store in stores:
    if M <= store[1]:
        price += store[0] * M
        break
    else:
        price += store[0] * store[1]
        M -= store[1]
print(price)

### FIXED CODE ###

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

for i in range(N):
    Ai, Bi = map(int, input().split(" "))
    stores.append((Ai, Bi))    

price = 0
for a, b in sorted(stores, key=lambda x: x[0]):
    if M <= b:
        price += a * M
        break
    else:
        price += a * b
        M -= b
print(price)
### BUGGY CODE ###

from heapq import heappush,heappop
n,m,s,t=map(int,input().split())
a,b=[[]for i in range (n+1)],[[]for i in range(n+1)]
for i in range(m):
    p,q,r,g=map(int,input().split())
    a[p].append((q,r))
    a[q].append((p,r))
    b[p].append((q,g))
    b[q].append((p,g))
def f(x,r):
    p=[float("inf")for i in range(n+1)]
    p[x],q=0,[[0,x]]
    while q:
        y,z=heappop(q)
        for i,j in r[z]:
            if p[i]>y+j:
                p[i]=y+j
                heappush(q,[p[i],i])
    return p
s1,t1=f(s,a),f(t,b)
p=[]
for i in range(1,n+1):
    p.append((s1[i]+t1[i],i))
p,e=sorted(p),0
for i in range(n):
    while p[e][1]<=i: e+=1
    print(10**15-p[e][0])

### FIXED CODE ###

from heapq import heappush,heappop
n,m,s,t=map(int,input().split())
a,b=[[]for i in range (n+1)],[[]for i in range(n+1)]
for i in range(m):
    p,q,r,g=(int(i) for i in input().split())
    a[p].append((q,r))
    a[q].append((p,r))
    b[p].append((q,g))
    b[q].append((p,g))
def f(x,r):
    p=[float("inf")for i in range(n+1)]
    p[x],q=0,[[0,x]]
    while q:
        y,z=heappop(q)
        for i,j in r[z]:
            if p[i]>y+j:
                p[i]=y+j
                heappush(q,[p[i],i])
    return p
s1,t1,p=f(s,a),f(t,b),[]
for i in range(1,n+1):
    p.append((s1[i]+t1[i],i))
p,e=sorted(p),0
for i in range(n):
    while p[e][1]<=i: e+=1
    print(10**15-p[e][0])
### BUGGY CODE ###

from collections import*
q=[(1,1)]
k=int(input())
m={}
while q:
 n,s=q.pop()
 if(n in m)-1:m[n]=s;q+=(n*10%k,s),;q=[(-~n%k,s+1)]+q
print(m[0])

### FIXED CODE ###

#!/usr/bin/env python3
from collections import deque

INF = 10**9
k = int(input())

# (辺の伸びる先, コスト)
G = [((10 * i % k, 0), ((i + 1) % k, 1)) for i in range(k)]
s = 1

# 01 - BFS
dist = [INF] * k
S = deque([s])
T = deque()
dist[s] = 0

d = 0
while S:
    while S:
        v = S.popleft()
        for w, c in G[v]:
            if d + c < dist[w]:
                dist[w] = d + c
                if c:
                    T.append(w)
                else:
                    S.append(w)
    S, T = T, S
    d += 1

print(dist[0] + 1)
### BUGGY CODE ###

from fractions import gcd
A, B = map(int, input().split())

count = 0
tmp = 1

for i in range(1, min(A, B)+1):
    if A%i==0 and B%i==0 and gcd(i, tmp) == 1:
        tmp *= i
        count += 1
print(count)


### FIXED CODE ###

from fractions import gcd
A, B = map(int, input().split())
G = gcd(A, B)

# nの[素因数, その数]のリストを返す
def prime_factoring(n):
    from math import sqrt
    factors = []
    for num in range(2, int(sqrt(n))+1):
        if n % num == 0:
            count = 0
            while(n % num == 0):
                n //= num
                count += 1
            factors.append([num, count])
    else:
        if n != 1:
            factors.append(n)
    return factors

print(len(prime_factoring(G))+1)
### BUGGY CODE ###

import numpy as np
H, W = map(int, input().split())
grid = [[] for i in range(H)]
for i in range(H):
    s = input()
    for j in range(W):
        grid[i].append(1 if s[j] == '#' else 0)
#print(grid)
grid = np.array(grid)

def getRowContinue(s):
    num = [0]*len(s)
    cnt = 0
    for i in range(len(s)):
        if s[i] == 1:
            num[i] = 0
            cnt = 0
        else:
            cnt += 1
            num[i] = cnt
            for j in range(cnt):
                num[i - j] = num[i]
    return num

def getColContinue(g):
    num = [[] for _ in range(len(g))]
    for i in range(len(g)):
        for _ in range(len(g[i])):
            num[i].append(0)

    h = len(g)
    w = len(g[0])
    for j in range(w):
        cnt = 0
        for i in range(h):
            if g[i][j] == 1:
                cnt = 0
                num[i][j] = 0
            else:
                cnt += 1
                num[i][j] = cnt
                for k in range(cnt):
                    num[i - k][j] = num[i][j]
    return num


contRow = []
for i in range(H):
    contRow.append(getRowContinue(grid[i]))
contCol = getColContinue(grid)
contRow = np.array(contRow)
contCol = np.array(contCol)
cont = contRow + contCol
#print(cont.flatten())
print(np.max(cont.flatten()) - 1)

### FIXED CODE ###

import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    H, W = NMI()
    grid = [input() for _ in range(H)]
    L = make_grid(H, W, 0)
    R = make_grid(H, W, 0)
    U = make_grid(H, W, 0)
    D = make_grid(H, W, 0)

    # left
    for h in range(H):
        for w in range(W):
            if grid[h][w] == "#":
                continue
            elif w == 0:
                L[h][w] = 1
            else:
                L[h][w] = L[h][w-1] + 1

    # right
    for h in range(H):
        for w in range(W-1, -1, -1):
            if grid[h][w] == "#":
                continue
            elif w == W-1:
                R[h][w] = 1
            else:
                R[h][w] = R[h][w+1] + 1

    # up
    for w in range(W):
        for h in range(H):
            if grid[h][w] == "#":
                continue
            elif h == 0:
                U[h][w] = 1
            else:
                U[h][w] = U[h-1][w] + 1

    # down
    for w in range(W):
        for h in range(H-1, -1, -1):
            if grid[h][w] == "#":
                continue
            elif h == H-1:
                D[h][w] = 1
            else:
                D[h][w] = D[h+1][w] + 1

    ans = 0
    for h in range(H):
        for w in range(W):
            if grid[h][w] == "#":
                continue
            ans = max(ans, L[h][w] + R[h][w] + U[h][w] + D[h][w] - 3)
    print(ans)


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

import sys
import heapq
 
input = sys.stdin.readline
n, m = map(int, input().split())
A = list(map(int, input().split()))
heapq.heapify(A)
 
for _ in range(m):
    b, c = map(int, input().split())
    [heapq.heappushpop(A, c) for i in [0]*b]
 
print(sum(A))

### FIXED CODE ###

import sys

input = sys.stdin.readline
n, m = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(m)]
BC.sort(key=lambda x: -x[1])

maxi = n*2
extend = A.extend
[extend([ls[1]] * ls[0]) for ls in BC if len(A) <= maxi]
A.sort(reverse=True)

print(sum(A[:n]))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)

s = input().strip()
t = input().strip()
ls = len(s)
lt = len(t)

dp = [['']*lt for i in range(ls)]


def answer(si, ti):
    if si == ls or ti == lt:
        return ''

    if dp[si][ti] != '':
        return dp[si][ti]

    if s[si] == t[ti]:
        return s[si]+answer(si+1, ti+1)

    a = answer(si+1, ti)
    b = answer(si, ti+1)
    r = a if len(a) > len(b) else b
    dp[si][ti] = r
    return dp[si][ti]


print(answer(0, 0))


### FIXED CODE ###

s = input().strip()
t = input().strip()
ls = len(s)
lt = len(t)

dp = [[0]*(lt+1) for i in range(ls+1)]

for i in range(ls):
    for j in range(lt):
        v = dp[i][j]+1 if s[i] == t[j] else 0
        dp[i+1][j+1] = max([v, dp[i+1][j], dp[i][j+1]])

ans = ''
i, j = ls, lt
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1]+ans
        i -= 1
        j -= 1

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

# F
import numpy as np
from collections import deque
 
TT_list = []
# input
N, L = map(int, input().split())
T = 0.0
vt_now = 0.0
v_now = 0
que = deque()

for i in range(N):
    ti, v = map(int, input().split())
    t = float(ti)
    v_now += v
    vt_now += v*t
    # add
    if v == L:
        que.append([t, v])
    else:
        while v < L and len(que) > 0:
            t_, v_ = que.pop()
            if t_ <= t:
                que.append([t_, v_])
                que.append([t, v])
                break
            elif v + v_ > L:
                v_ = v + v_ - L
                t = ((L - v) * t_ + v * t) / L
                v = L
                que = deque([[t, v]])
                v_now = L
                vt_now = t*L
                # break
            else:
                t = (t*v + t_*v_) / (v + v_)
                v = v + v_
                if v == L:
                    que = deque([[t, v]])
                    v_now = L
                    vt_now = t*L
    # minus
    while v_now > L:
        if que[0][1] <= v_now - L:
            v_now -= que[0][1]
            vt_now -= que[0][1]*que[0][0]
            que.popleft()
        else:
            que[0][1] -= v_now - L
            vt_now -= (v_now - L)*que[0][0]
            v_now = L
            
            
    TT_list.append(vt_now / L)

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


### FIXED CODE ###

# F
from collections import deque
 
TT_list = []
# input
N, L = map(int, input().split())
T = 0.0
vt_now = 0.0
v_now = 0
que = deque()

for i in range(N):
    ti, v = map(int, input().split())
    t = float(ti)
    v_now += v
    vt_now += v*t
    # add
    if v == L:
        que.append([t, v])
    else:
        while v < L and len(que) > 0:
            t_, v_ = que[-1]
            if t_ <= t:
                que.append([t, v])
                break
            elif v + v_ >= L:
                v_ = v + v_ - L
                t = ((L - v) * t_ + v * t) / L
                v = L
                que = deque([[t, v]])
                v_now = L
                vt_now = t*L
                # break
            else:
                t = (t*v + t_*v_) / (v + v_)
                v = v + v_
                que.pop()
    # minus
    while v_now > L:
        if que[0][1] <= v_now - L:
            v_now -= que[0][1]
            vt_now -= que[0][1]*que[0][0]
            que.popleft()
        else:
            que[0][1] -= v_now - L
            vt_now -= (v_now - L)*que[0][0]
            v_now = L
            
    TT_list.append(vt_now / L)

for i in range(N):
    print(TT_list[i])
### BUGGY CODE ###

import collections
n = int(input())
a = list(map(int,input().split()))

used = collections.Counter(a)
a.sort()
a.reverse()

two = [2]
i = 0
while two[i]*2 <= 2*10**9:
    two.append(two[i]*2)
    i += 1
two.reverse()

counter = 0
for i in range(n):
    if used[a[i]] > 0:
        while two[-1] > 2*a[i]:
            two.pop(-1)
        for k in range(len(two)):
            if used[two[k]-a[i]] >= 1:
                if two[k]-a[i] != a[i]:
                    counter += 1
                    used[two[k]-a[i]] -= 1
                    used[a[i]] -= 1
                else:
                    if used[a[i]] >= 2:
                        counter += 1
                        used[two[k]-a[i]] -= 1
                        used[a[i]] -= 1
print(counter)

### FIXED CODE ###

import collections
n = int(input())
a = list(map(int,input().split()))

used = collections.Counter(a)
a.sort()
a.reverse()

two = [2]
i = 0
while two[i]*2 <= 2*10**9:
    two.append(two[i]*2)
    i += 1

counter = 0
for i in range(n):
    if used[a[i]] > 0:
        used[a[i]] -= 1
        while two[-1] > 2*a[i]:
            two.pop(-1)

        if used[two[-1]-a[i]] >= 1:
            counter += 1
            used[two[-1]-a[i]] -= 1

print(counter)
### BUGGY CODE ###

S = input()
N = len(S)
mod = 10**9+7
P = 13

dp = [[0 for _ in range(P)] for _ in range(N)]

# 1桁目だけ事前計算
if S[N-1] == '?':
    tmp = [0 for _ in range(P)]
    for i in range(10):
        tmp[i % P] = 1
    dp[0] = tmp
else:
    dp[0][int(S[N-1]) % P] = 1

for i in range(1, N):
    k = N-i-1
    if S[k] == '?':
        base = 10**i % P
        rems = [0 for _ in range(P)]
        for j in range(10):
            rems[base * j % P] += 1
        for m in range(P):
            for n in range(P):
                a = dp[i-1][m] * rems[n] % mod
                dp[i][(m+n) % P] = (dp[i][(m+n) % P] + a) % mod
    else:
        r = 10**i * int(S[k]) % P
        for j in range(P):
            dp[i][(j+r)%P] = max(dp[i][(j+r)%P], dp[i-1][j])

print(dp[-1][5])

### FIXED CODE ###

S = input()
N = len(S)
mod = 10**9+7
P = 13
 
dp = [[0 for _ in range(P)] for _ in range(N)]
 
# 1桁目だけ事前計算
if S[N-1] == '?':
    tmp = [0 for _ in range(P)]
    for i in range(10):
        tmp[i % P] = 1
    dp[0] = tmp
else:
    dp[0][int(S[N-1]) % P] = 1
 
for i in range(1, N):
    k = N-i-1
    if S[k] == '?':
        base = pow(10, i, P)
        for j in range(10):
            r = base*j % P
            for m in range(P):
                dp[i][(m+r)%P] = (dp[i][(m+r)%P] + dp[i-1][m]) % mod
    else:
        r = pow(10, i, P) * int(S[k]) % P
        for j in range(P):
            dp[i][(j+r)%P] = max(dp[i][(j+r)%P], dp[i-1][j])
 
print(dp[-1][5])
### BUGGY CODE ###

n = int(input())
s = list(input())
q = int(input())
query = []
a = []
for _ in range(q):
    method, i, c = input().split()
    if method == "1":
        a.append([i, c])
    else:
        a.append([i, c])
        query.append(a)
        a = []
string = []
now = s
for qq in query:
    if len(qq) == 1:
        string.append("".join(now))
        continue
    for i, c in qq[:-1]:
        i = int(i)
        now[i-1] = c
    string.append("".join(now))
for qq, ss in zip(query, string):
    l, r = map(int, qq[-1])
    print(len(set(ss[l-1:r])))

### FIXED CODE ###

class SegmentTree:

    def __init__(self, ls, ide, seg_func):
        n = len(ls)
        self.num = 2 ** (n - 1).bit_length()
        self.seg_func = seg_func
        self.ide = ide
        self.tree = [self.ide] * (2 * self.num - 1)
        for i, l in enumerate(ls):
            self.tree[i + self.num - 1] = l

        for i in range(self.num - 2, -1, -1):  # 子を束ねて親を更新
            self.tree[i] = seg_func(self.tree[2 * i + 1], self.tree[2 * i + 2])

    def update(self, i, x):
        i += self.num - 1
        self.tree[i] = x
        while i:
            i = (i-1)//2
            self.tree[i] = self.seg_func(self.tree[2 * i + 1], self.tree[2 * i + 2])

    def query(self, l, r):
        if r < l:
            return ValueError('invalid index')

        l += self.num - 1
        r += self.num - 2
        res = self.ide
        while r - l > 1:  # 右から寄りながら結果を結合していくイメージ
            if l & 1 == 0:
                res = self.seg_func(res, self.tree[l])
            if r & 1 == 1:
                res = self.seg_func(res, self.tree[r])
                r -= 1
            l = l // 2  # 親の一つ右に移動
            r = (r - 1) // 2  # 親の一つ左に移動
        if l == r:
            res = self.seg_func(res, self.tree[l])
        else:
            res = self.seg_func(res, self.tree[l])
            res = self.seg_func(res, self.tree[r])
        return res


def f(a, b):
    return a | b


n = int(input())
s = [1 << (ord(r) - ord("a")) for r in input()]
q = int(input())
st = SegmentTree(s, 0, f)

for _ in range(q):
    m, i, c = input().split()

    if int(m) - 1:
        x = st.query(int(i)-1, int(c))
        print(bin(x).count("1"))
    else:
        st.update(int(i)-1, 1 << (ord(c) - ord("a")))
### BUGGY CODE ###

n = int(input())
l = []
for i in range(n):
    l.append(input())

ans = 0
i = 0
while i < len(l):
    ans += sum([sorted(l[i]) == sorted(l[n]) for n in range(i+1,n)])
    i += 1
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
d = {}
for i in range(n):
    s = ''.join(sorted(input()))
    if s not in d.keys():
        d[s] = 1
    else:
        ans += d[s]
        d[s] += 1

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

from math import sqrt
n = int(input())

n_cnt = [0]*n

for x in range(1, int(sqrt(2*n))+1):
    for y in range(1, int(sqrt(2*n))+1):
        for z in range(1, int(sqrt(2*n))+1):
            t = (x+y)**2 + (y+z)**2 + (z+x)**2
            if t % 2 == 0 and t // 2 - 1 < n:
                n_cnt[t // 2 - 1] += 1


for i in range(n):
    print(n_cnt[i])


### FIXED CODE ###

from math import sqrt
n = int(input())

n_cnt = [0]*n

for x in range(1, int(sqrt(2*n))+1):
    for y in range(1, int(sqrt(2*n))+1):
        for z in range(1, int(sqrt(2*n))+1):
            t = (x+y)**2 + (y+z)**2 + (z+x)**2
            if t % 2 == 0 and t // 2 - 1 < n:
                n_cnt[t // 2 - 1] += 1


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

N = int(input())
a = list(map(int,input().split()))
x =[0]*(10**5+1)
a_set =  set(a)
a_list = list(a_set)

a_list.sort()
ans = 0
temp = 0
x[a_list[0]-1]=0

for i in a_list:
    x[i]=a.count(i)
    if i+1 in a_list:
        temp = x[i-1]+x[i]+a.count(i+1)
    else:
        temp = x[i-1]+x[i]

    if temp>ans:
        ans = temp

print(ans)
    

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
c =[0]*(10**5+2)


for i in a:
    c[i-1] +=1
    c[i] +=1
    c[i+1] +=1

print(max(c))
### BUGGY CODE ###

from collections import OrderedDict
def resolve():
    n = int(input())

    l = []
    for _ in range(n):
        l.append(input())

    count = OrderedDict()

    for name in l:
        if name not in count.keys():
            count[name] = 1

        else:
            count[name] += 1

    count = OrderedDict(
        sorted(count.items(), key=lambda x: x[0])
    )
    max_polls = max(count.values())

    for k, v in count.items():
        if v == max_polls:
            print(k)
            
resolve()

### FIXED CODE ###

from collections import OrderedDict
import sys
input = sys.stdin.readline

def resolve():
    n = int(input())

    count = OrderedDict()
    for _ in range(n):
        name = input()
        if name not in count.keys():
            count[name] = 1

        else:
            count[name] += 1

    count = OrderedDict(
        sorted(count.items(), key=lambda x: x[0])
    )
    max_polls = max(count.values())

    for k, v in count.items():
        if v == max_polls:
            print(k)
            
resolve()