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

n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    x,y = map(int,input().split())
    for j in range(n):
        if a[j] == x:
            a[j] = y
    print(sum(a))


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
tmp = [0] * 100001
ans = 0
for i in range(n):
    tmp[a[i]] += 1
    ans += a[i]
q = int(input())
for i in range(q):
    x,y = map(int,input().split())
    ans -= x * tmp[x]
    ans += y * tmp[x]
    tmp[y] += tmp[x]
    tmp[x] = 0
    print(ans)
### BUGGY CODE ###

N=int(input())
P=list(map(int,input().split()))
ans=1
for i in range(1,N):
    if min(P[:i])>P[i]:
        ans+=1
print(ans)

### FIXED CODE ###

N=int(input())
P=list(map(int,input().split()))
x=N+1
cnt=0

for i in range(N):
    if P[i]<x:
        cnt+=1
        x=P[i]
print(cnt)
### BUGGY CODE ###

n = int(input())


def solve(n):
    ans = 0
    for x in range(1, 100 + 1):
        rest = n - x ** 2
        if rest < x + x + 2:
            break
        for y in range(1, 100 + 1):
            rest2 = rest - y ** 2 - x * y
            if rest2 < y + 1:
                break
            for z in range(1, 100 + 1):
                rest3 = rest2 - z ** 2 - y * z - z * x
                if rest3 < 0:
                    break
                if rest3 == 0:
                    ans += 1
    return ans


for i in range(1, n + 1):
    print(solve(i))


### FIXED CODE ###

n = int(input())
ans = [0 for _ in range(n + 1)]

for x in range(1, 100 + 1):
    if x ** 2 > n - 2 * x - 2:
        break
    for y in range(1, 100 + 1):
        if x**2 + y ** 2 > n - x - y - x * y:
            break
        for z in range(1, 100 + 1):
            f = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if f > n:
                break
            ans[f] += 1


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

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

dp = [sys.maxsize]*n
dp[0]=0


for i in range(n):
  for j in range(i+1,i+k+1):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))
      
print(dp[n-1])

### FIXED CODE ###

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

dp = [sys.maxsize]*n
dp[0]=0

#print(dp)
for i in range(n):
  for j in range(i+1,i+k+1):
    if j<n:
      dp[j] = min(dp[j],dp[i]+abs(a[i]-a[j]))
  #print(dp)
      
print(dp[n-1])
### BUGGY CODE ###

h,w,d = map(int,input().split())
a = [list(map(int,input().split())) for i in range(h)]
q =int(input())
l = [0]*q
r = [0]*q
for i in range(q):
    l[i],r[i] = map(int,input().split())


for i in range(q):
    c = 0
    x = l[i]
    
    
    jkl = 0
    while x != r[i]+d:
        op = 0
        p = 0
        
        while op != 1:
            j = 0
            
            while op != 1 and j != h:
                if x == a[j][p]:
                    jkl +=1
                    
                    if jkl != 1:
                        c = c +  abs(j-ab) + abs(p-bc)
                    ab = j
                    bc = p
                    j = 0
                    p = 0
                    op = 1
                j +=1
            p +=1
        x += d
        
    print(c)


### FIXED CODE ###

H, W, D = map(int, input().split())
xy = {}
for i in range(H):
    A = list(map(int, input().split()))
    for j in range(W):
        xy[A[j]] = (i + 1, j + 1)
 
d = [0] * (H * W + 1)
for i in range(D + 1, H * W + 1):
    x1, y1 = xy[i]
    x2, y2 = xy[i - D]
    d[i] = d[i - D] + abs(x1 - x2) + abs(y1 - y2)
 
Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    ans = d[R] - d[L]
    print(ans)
### BUGGY CODE ###

a, b, c, d = map(int, input().split(" "))
i = 0
while a > 0 or c > 0:
  if i%2 == 0:
    c -= b
  else:
    a -= d
    i += 1
print("YNeos"[i%2::2])

### FIXED CODE ###

import sys
from math import sqrt, gcd, ceil, log
from bisect import bisect
from collections import defaultdict
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))

# sys.setrecursionlimit(10**6)



def solve():
	a, b, c, d = map(int, input().split(" "))
	i = 0
	while a > 0 or c > 0:
		if i%2 == 0:
			c -= b
		else:
			a -= d
		i += 1
	print("YNeos"[i%2::2])



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

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
for i in range(n):
  b = a.copy()
  b.pop(i)
  print(max(b))

### FIXED CODE ###

import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
max_a_num = a.count(max(a))
b = sorted(a, reverse=True)
m1, m2 = b[0], b[1]
for i in range(n):
  if max_a_num == 1:
    if a[i] == m1:
      print(m2)
    else:
      print(m1)
  else:
    print(m2)
### BUGGY CODE ###

import sys
def main():
  input = sys.stdin.readline
  R=list()
  s=0
  L=list()
  N=int(input())
  for i in range(N):
    S=sorted(list(input()))
    if S not in R:
      R.append(S)
    L.append(S)
  for i in range(len(R)):
    c=L.count(R[i])
    s+=(c*(c-1))//2
  print(s)
if __name__ == '__main__':
    main()

### FIXED CODE ###

import collections
N=int(input())
j=0
L=list()
R=list()
for i in range(N):
  S="".join(sorted(list(input())))
  L.append(S)
c = collections.Counter(L)
counts=c.values()
counts=list(counts)
A=[i*(i-1)//2 for i in counts]
print(sum(A))
### BUGGY CODE ###

import bisect

n = int(input())
alist = list(sorted(map(int, input().split())))
blist = list(sorted(map(int, input().split())))
clist = list(sorted(map(int, input().split())))

ans = 0
for a in alist:
  bi = bisect.bisect_right(blist, a)
  if bi == len(blist):
    break
  for b in blist[bi:]:
    ci = bisect.bisect_right(clist, b)
    if ci == len(clist):
      break
    ans += len(clist) - ci
print(ans)


### FIXED CODE ###

import bisect

n = int(input())
alist = list(sorted(map(int, input().split())))
blist = list(map(int, input().split()))
clist = list(sorted(map(int, input().split())))

ans = 0
for b in blist:
  ai = bisect.bisect_left(alist, b)
  ci = bisect.bisect_right(clist, b)
  if ai == 0 or ci == len(clist):
    continue
  else:
    ans += ai * (len(clist) - ci)
print(ans)
### BUGGY CODE ###

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

for i in range(1,n):
    if max(a[:i]) >= a[i]:
        ans += max(a[:i]) - a[i]
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 0
m = 0
for i in range(n):
    m = max(m,a[i])
    ans += m - a[i]
print(ans)
### BUGGY CODE ###

#from matplotlib import pyplot as plt
def binary_search(mn,mx,a,x,y):
    #リストlからaの値のインデックスをサーチする。
    #二分探索を可能にするためにはリストlはソートされていなければならない。
    z = (mx+1)//2
    low = mn
    high = mx+1
    while low <= high:
        temp = rule2(x,y,z)
        if temp == a:
            if z <= 0:
                return None
            return z
        elif temp < a:
            low = z + 1
        elif temp > a:
            high = z - 1

        z = (low + high) // 2
    return None

def rule2(x,y,z):
    return x ** 2 + y ** 2 + z**2 + x * y + y * z + z*x
def main():
    n = int(input())
    x = []
    y = []
    for i in range(1,n+1):
        #x.append(i)
        #y.append(f(i))
        print(f(i))
    #plt.scatter(x,y)
    #plt.show()


def f(n):
    counter = 0
    for x in range(1,n):
        if x ** 2 > n:
            break
        for y in range(x,n-x**2):
            if y < x:
                continue
            if x ** 2 + y ** 2 > n:
                break
            z = binary_search(y,n-x**2-y**2-x*y,n,x,y)
            if z == None:
                continue
            else:
                if rule2(x,y,z) == n:
                    if x == y and y == z and z == x:
                        counter += 1
                    elif x != y and y != z and z != x:
                        counter += 6
                    else:
                        counter += 3

    return counter


if __name__ == '__main__':
    main()

#6 24 54 96
#1  4  9 16
#18

### FIXED CODE ###

#from matplotlib import pyplot as plt
def binary_search(mn,mx,a,x,y):
    #リストlからaの値のインデックスをサーチする。
    #二分探索を可能にするためにはリストlはソートされていなければならない。
    z = (mx+1)//2
    low = mn
    high = mx+1
    while low <= high:
        temp = rule2(x,y,z)
        if temp == a:
            if z <= 0:
                return None
            return z
        elif temp < a:
            low = z + 1
        elif temp > a:
            high = z - 1

        z = (low + high) // 2
    return None

def rule2(x,y,z):
    return x ** 2 + y ** 2 + z**2 + x * y + y * z + z*x
def main():
    n = int(input())
    x = []
    y = []
    for i in range(1,n+1):
        #x.append(i)
        #y.append(f(i))
        print(f(i))
    #plt.scatter(x,y)
    #plt.show()


def f(n):
    counter = 0
    for x in range(1,n):
        if x ** 2 > n:
            break
        for y in range(x,n-x**2):
            if y < x:
                continue
            if x ** 2 + y ** 2 > n:
                break
            z = binary_search(y,n-x**2-y**2-x*y,n,x,y)
            if z == None:
                continue
            else:
                if rule2(x,y,z) == n:
                    if x == y and y == z and z == x:
                        counter += 1
                    elif x != y and y != z and z != x:
                        counter += 6
                    else:
                        counter += 3

    return counter


if __name__ == '__main__':
    main()

#6 24 54 96
#1  4  9 16
#18
### BUGGY CODE ###

N = int(input())
S = input()

cnt = [0]*11
i = 0
T = ''
for s in S:
  cnt[int(s)]+=1
  if min(cnt)<=3:
    T += s
#print(T)
ans = 0
P = []
for a in range(10):
  A = str(a)
  k = 0
  ind1 = -1
  while k < len(T)-2:
    t = T[k]
    if A == t:
      ind1 = k
      break
    k += 1
  if ind1 == -1:
    continue
  for b in range(10):
    B = str(b)
    l = ind1+1
    ind2 = -1
    while l < len(T)-1:
      t = T[l]
      if B == t:
        ind2 = l
        break
      l += 1
    #print(a,b,ind1,ind2)
    if ind2 == -1:
      continue
    for c in range(10):
      C = str(c)
      m = ind2+1
      while m < len(T):
        t = T[m]
        if C == t:
          ans += 1
          break
        m += 1
print(ans)

#print(*ans, sep='/n')

### FIXED CODE ###

n=int(input())
s=input()
ans=0
 
for i in range(10):
    for j in range(10):
        for k in range(10):
            x=s.find(str(i))
            if x!=-1:
                y=s.find(str(j),x+1)
                if y!=-1:
                    z=s.find(str(k),y+1)
                    if z!=-1:
                        ans+=1
print(ans)
### BUGGY CODE ###

# 各クエリに対して,二分探索で解を求める

def bs(x,li):
    # 値xがliの2連続した値a,b達が作る[a,b)のどこに入るか
    # aを返す
    # liはソート済みとする
    left,right=0,len(li)
    while left+1<right:
        mid = (left+right)//2
        if li[mid]<=x:
            left=mid
        else:
            right=mid
    return left

def get(L):
    ret=[-10**13]
    for _ in range(L):
        ret.append(int(input()))
    ret.append(10**13)
    return ret

A,B,Q=map(int,input().split())
S=get(A)
T=get(B)
for _ in range(Q):
    x=int(input())

    # sn,sp,tn,tpを二分探索で出す
    sn,tn=bs(x,S),bs(x,T)
    sp,tp=sn+1,tn+1

    # これらからさらに二分探索で最寄りのs,tを出して,minをansとして保持
    ans=10**13
    # print(sn,sp,tn,tp)
    for y in [S[sn],S[sp]]:
        l=bs(y,T)
        d=abs(y-x)+abs(T[l]-y)
        ans=min(ans,d)
        if l+1<len(T):
            e=abs(y-x)+abs(T[l+1]-y)
            ans=min(ans,e)
    for y in [T[tn],T[tp]]:
        l=bs(y,S)
        d=abs(y-x)+abs(S[l]-y)
        ans=min(ans,d)
        if l+1<len(S):
            e=abs(y-x)+abs(S[l+1]-y)
            ans=min(ans,e)
    print(ans)

### FIXED CODE ###

# 各クエリに対して,二分探索で解を求める

def bs(x,li):
    # 値xがliの2連続した値a,b達が作る[a,b)のどこに入るか
    # aを返す
    # liはソート済みとする
    left,right=0,len(li)
    while left+1<right:
        mid = (left+right)//2
        if li[mid]<=x:
            left=mid
        else:
            right=mid
    return left

def get(L):
    ret=[-10**13]
    for _ in range(L):
        ret.append(int(input()))
    ret.append(10**13)
    return ret

A,B,Q=map(int,input().split())
S=get(A)
T=get(B)
for _ in range(Q):
    x=int(input())

    # sn,sp,tn,tpを二分探索で出す
    sn,tn=bs(x,S),bs(x,T)

    # これらの経路の組み合わせの中に最小値が含まれている
    # 全部で8パターンあるので全探索してminをansとして保持
    ans=10**13
    for s in [S[sn],S[sn+1]]:
        for t in [T[tn],T[tn+1]]:
            d=abs(s-x)+abs(t-s)
            e=abs(t-x)+abs(s-t)
            ans=min([ans,d,e])
    print(ans)
### BUGGY CODE ###

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

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod
    
def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

ans=0
mod = 10**9+7
a=a[::-1]
for i in range(n-k+1):
    ans += (a[i] * comb(n-i-1, k-1, mod))%mod
a=a[::-1]
for i in range(n-k+1):
    ans -= (a[i] * comb(n-i-1, k-1, mod))%mod


print(ans%mod)

### FIXED CODE ###

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

factorial = [1]
inverse = [1]
for i in range(1, n+2):
    factorial.append(factorial[-1] * i % mod)
    inverse.append(pow(factorial[-1], mod - 2, mod))
 
def comb(n, r, mod):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % mod

a=a[::-1]
for i in range(n-k+1):
    ans += (a[i] * comb(n-i-1, k-1, mod))%mod
a=a[::-1]
for i in range(n-k+1):
    ans -= (a[i] * comb(n-i-1, k-1, mod))%mod


print(ans%mod)
### BUGGY CODE ###

N = int(raw_input())
S = raw_input()

score_list = []
for i in range(N):
	E_num = S[i+1:].count('E')
	W_num = S[:i].count('W')
	score_list.append(E_num+W_num)

print min(score_list)

### FIXED CODE ###

N = int(raw_input())
S = raw_input()

num = S[1:].count('E')
score_list = []
score_list.append(num)

for i in range(N-1):
	if S[i]=='W':
		num+=1
	if S[i+1]=='E':
		num-=1
	score_list.append(num)
	
print min(score_list)
### BUGGY CODE ###

N,K = map(int,input().split())
P = list(map(int,input().split()))

ans = []
l = []
for i in range(N-K+1):
    l.append(sum(P[i:i+K]))
idx = l.index(max(l)) 
ls = P[idx:K+idx]
for j in range(K):
    ans.append((ls[j]+1)*ls[j]/(2*ls[j]))
print(sum(ans))

### FIXED CODE ###

N,K = map(int,input().split())
P = list(map(int,input().split()))

summ = sum(P[0:K])
maxi = summ
idx = 0
ans = []
for i in range(N-K):
    summ = summ - P[i] + P[K+i]
    if summ > maxi:
        maxi = summ
        idx = i+1
for j in range(K):
    ans.append((P[idx+j]+1)/2)
print(sum(ans))
### BUGGY CODE ###

N, Q = map(int, input().split())
S = str(input())
i = 1
while i <= Q:
    l, r = map(int, input().split())
    s = S[l-1:r]
    ans = s.count('AC')
    print (ans)
    i += 1

### FIXED CODE ###

N, Q = map(int, input().split())
S = str(input())
i = [0] * (N + 1)
j = 1
while j < N:
    i[j+1] = i[j] 
    if (S[j-1] == 'A' and S[j] == 'C'):
        i[j+1] += 1
    j += 1
k = 0
#print (i)
while k < Q:
    l, r = map(int, input().split())
    ans = i[r]-i[l]
    k += 1
    print (ans)
### BUGGY CODE ###

N,K = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
if a[0] >= K:
    print(0)
    exit()

a = [a[i] for i in range(N) if a[i]<K]
a.reverse()
N = len(a)
ans = N
dp = [False]*K
dp[0] = True
Smax = 0
for i in range(N):
    a_ = a[i]
    if Smax + a_ >= K:
        ans = N-i-1
    updated = False
    for j in range(min(Smax,K-a_-1),-1,-1):
        if dp[j]:
            dp[j+a_]=True
            if not updated:
                Smax = max(Smax,j+a_)
                updated = True

print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
a = list(map(int,input().split()))

def f(N,K,a):
    a.sort()
    if a[0] >= K:
        print(0)
        exit()

    a = [a[i] for i in range(N) if a[i]<K]
    N = len(a)
    ans = N
    dp = [False]*K
    dp[0] = True
    Smax = 0
    for i,a_ in reversed(list(enumerate(a))):
        if Smax + a_ >= K:
            ans = i
        updated = True
        for j in range(min(Smax,K-a_-1),-1,-1):
            if dp[j]:
                dp[j+a_]=True
                if updated:
                    Smax = max(Smax,j+a_)
                    updated = False
    return ans

print(f(N,K,a))
### BUGGY CODE ###

def knapsack01(n, W, weights, values, dp, i, j):
    # i = up until item i, j = up until weight j
    if i == 0 or j <= 0:
        return 0
    
    # start with first item
    if dp[i-1][j] == -1:
        dp[i-1][j] = knapsack01(n, W, weights, values, dp, i-1, j)
    
    if weights[i-1] > j:
        # weights[i] doesn't fit in knapsack
        dp[i][j] = dp[i-1][j]
    else:
        if dp[i-1][j-weights[i-1]] == -1:
            dp[i-1][j-weights[i-1]] = knapsack01(n, W, weights, values, dp, i-1, j-weights[i-1])
        dp[i][j] = max(dp[i-1][j], dp[i-1][j-weights[i-1]] + values[i-1])
        
    return dp[i][j]
    
n,W = [int(x) for x in input().split()]
weights = []
values = []
for i in range(n):
    l = [int(x) for x in input().split()]
    weights += [l[0]]
    values += [l[1]]

# repeatableKnapsack(n, W, weights, values)

dp = [[-1 for _ in range(W+1)] for _ in range(n+1)]
res = knapsack01(n, W, weights, values, dp, n, W)
# print(dp)
print(res)

### FIXED CODE ###


def knapsack01iter(n, W, weights, values, dp):
    for i in range(1,n+1):
        for j in range(0, W+1):
            if j < weights[i-1]: # if knapsack cannot fit item i
                dp[i][j] = dp[i-1][j]
            elif j >= weights[i-1]: # knapsack can fit item i
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-weights[i-1]]+values[i-1])
    
    return dp[-1][-1]
    
    
n,W = [int(x) for x in input().split()]
weights = []
values = []
for i in range(n):
    l = [int(x) for x in input().split()]
    weights += [l[0]]
    values += [l[1]]

# repeatableKnapsack(n, W, weights, values)

# dp = [[-1 for _ in range(W+1)] for _ in range(n+1)]
# res = knapsack01rec(n, W, weights, values, dp, n, W)
# print(dp)
dp = [[0 for _ in range(W+1)] for _ in range(n+1)]
res = knapsack01iter(n, W, weights, values, dp)
# print(dp)
print(res)
### BUGGY CODE ###

N,W = map(int, input().split())
v = [0] * N
w = [0] * N
dp = [[0]*(W+1)]*(N+1)

for i in range(N):
    v[i], w[i] = map(int, input().split())

def rec(i,j,dp):
    res = 0
    if dp[i][j] > 0:
        return dp[i][j]
    if i<0:
        return 0
    elif j < w[i]:
        res = rec(i-1, j, dp)
    else:
        res = max(rec(i-1,j,dp),rec(i-1, j-w[i],dp)+v[i])

    return res
print(rec(N-1,W,dp))

### FIXED CODE ###

N,W = map(int, input().split())
dp = [0]*(W+1)

for i in range(1,N+1):
    v,w = map(int,input().split())
    for j in range(W, w-1, -1):
        x = v+dp[j-w]
        if x > dp[j]: dp[j] = x

print(dp[W])
### BUGGY CODE ###

X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A_B=[0]*(X*Y)
for i in range(X):
    for j in range(Y):
        A_B[i*Y+j]=A[i]+B[j]
A_B.sort(reverse=True)
if len(A_B)>3000:
    A_B=A_B[:3000]
W=len(A_B)
A_B_C=[0]*(W*Z)
for i in range(W):
    for j in range(Z):
        A_B_C[Z*i+j]=A_B[i]+C[j]
A_B_C.sort(reverse=True)
for i in range(K):
    print(A_B_C[i])

### FIXED CODE ###

import heapq
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()))
a=sorted([-i for i in a])
b=sorted([-i for i in b])
c=sorted([-i for i in c]) # avoid reverse=True 
a_dif=[a[i+1]-a[i] for i in range(x-1)]
b_dif=[b[i+1]-b[i] for i in range(y-1)]
c_dif=[c[i+1]-c[i] for i in range(z-1)]#差分をとる

que=[(a[0]+b[0]+c[0],(0,0,0))]
heapq.heapify(que)
s=set([(0,0,0)])
while k>0:
    ans,(ia,ib,ic)=heapq.heappop(que)
    print(-ans) #because sort with - 
    k-=1
    
    if ia < x-1 and (ia+1,ib,ic) not in s:
        heapq.heappush(que,(ans+a_dif[ia],(ia+1,ib,ic)))
        s.add((ia+1,ib,ic))
    if ib < y-1 and (ia, ib+1, ic) not in s:
        heapq.heappush(que, (ans+b_dif[ib], (ia, ib+1, ic)))
        s.add((ia, ib+1, ic))
    if ic < z-1 and (ia, ib, ic+1) not in s:
        heapq.heappush(que, (ans+c_dif[ic], (ia, ib, ic+1)))
        s.add((ia, ib, ic+1))
### BUGGY CODE ###

import queue
from collections import deque
import numpy as np
n, x, y = map(int,input().split())
g = [[] for _ in range(n)] 
for i in range(n-1):

    g[i] += i+1,
    g[i+1] += i,
g[x-1] += y-1,
g[y-1] += x-1,

# if n%2==0:
#     ma = int(n/2)
# else:
#     ma = int((n+1)/2)
# print(ma)

ans = [0]*n
for start in range(n):
    dist = [-1] * n
    dist[start] = 0
    # que = queue.Queue()
    # que.put(start)
    q = deque([start])
    while q:
        # v = que.get()
        v = q.popleft()
        for nv in g[v]:
            if dist[nv] == -1:
                dist[nv] = dist[v]+1
                # que.put(nv)
                q.append(nv)
    for i in dist:
        ans[i] += 1
    # d.append(dist)
# d = np.array(d).flatten()
# for i in range(1,n):
#     # print(int(np.count_nonzero(d==i)/2))
#     print(int(ans[i]/2))
print(' '.join(str(i//2) for i in ans[1:]))


### FIXED CODE ###

def main():
    from collections import deque
    n,x,y=map(int,input().split())
    e=[[]for _ in range(n)]
    for i in range(n-1):
        e[i]+=i+1,
        e[i+1]+=i,
    e[x-1]+=y-1,
    e[y-1]+=x-1,
    a=[0]*n
    for s in range(n):
        d=[-1]*n
        d[s]=0
        q=deque([s])
        add,pop=q.append,q.popleft
        while q:
            v=pop()
            for w in e[v]:
                if d[w]<0:
                    d[w]=d[v]+1
                    add(w)
        for i in d:a[i]+=1
    print(' '.join(str(i//2)for i in a[1:]))
main()
### BUGGY CODE ###

n=int(input())
s1=[input() for x in range(n)]
s2=list(set(s1))
ans_s=[]
max_num=0
for num in s2:
    if max_num < s1.count(num):
        max_num=s1.count(num)
        ans_s.clear()
        ans_s.append(num)
    elif max_num == s1.count(num):
        ans_s.append(num)
ans_s.sort()
[print(x) for x in ans_s]

### FIXED CODE ###

n = int(input())

data = dict()

for i in range(n):
    s = input()
    if s in data:
        data[s] += 1
    else:
        data.setdefault(s,1)
ans = sorted(data.items(),key=lambda x:x[1],reverse=True)
max_num = ans[0][1]
A = []
for item,i in ans:
    if i == max_num:
        A.append(item)
A.sort()

for item in A:
    print(item)
### BUGGY CODE ###

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

import collections

dct=collections.Counter(lst)


for i in range(N):
    Sum=0
    for v in dct.values():
        Sum+=v*(v-1)//2


for i in range(N):
    print(Sum-dct[lst[i]]+1)

### FIXED CODE ###

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

import collections

dct=collections.Counter(lst)


#for i in range(N):
Sum=0
for v in dct.values():
        Sum+=v*(v-1)//2


for i in range(N):
    print(Sum-dct[lst[i]]+1)
### BUGGY CODE ###

N=int(input())
for i in range(1,N+1):
  count=0
  k=i//5+1
  for x in range(k):
    if(x==0):
      continue
    if(x>=22):
      break
    for y in range(x,k):
      if(y==0):
        continue
      if(y>=22):
        break
      for z in range(y,k):
        if(z==0):
          continue
        if(z>=22):
          break
        if((x+y)**2+(y+z)**2+(z+x)**2)//2==i:
          #print(x,y,z)
          #print(i)
          if (x==y and y==z and z==x):
            count+=1
          elif (x!=y and y!=z and z!=x):
            count+=6
          else:
            count+=3
  print(count)

### FIXED CODE ###

n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
  for j in range(1,105):
    for k in range(1,105):
      v = i*i+j*j+k*k+i*j+j*k+k*i;
      if v<10050:
        ans[v]+=1
for i in range(n):
    print(ans[i+1])