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

import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def solve(n, arr):
    sum = 0
    bitcount = [0]*100
    for num in arr:
        b = reversed(bin(num)[2:])
        for i, s in enumerate(b):
            if i != "0":
                bitcount[i] += int(s)
    for i, b in enumerate(bitcount):
        sum += b * (n-b) * 2**i
    return sum % (10**9 + 7)


def main():
    N = int(input())
    A_l = [int(i) for i in input().split()]
    print(solve(N, A_l))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def solve(n, arr):
    sum = 0
    bitcount = [0]*100
    for num in arr:
        b = reversed(bin(num)[2:])
        for i, s in enumerate(b):
            if i != "0":
                bitcount[i] += int(s)
    for i, b in enumerate(bitcount):
        sum += b * (n-b) * 2**i
    return sum % (10**9 + 7)


def main():
    N = int(input())
    A_l = [int(i) for i in input().split()]
    print(solve(N, A_l))


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

def retrun_index(c_lis):
    return [i for i, x in enumerate(c_lis) if x==1]

n, m = map(int, input().split())
lis = [0]*(n+1)
c = [[0]*(n+1) for i in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    c[a][b] = 1
    c[b][a] = 1
depth = [[1]]
i = 0
co = 1
se = set(depth[0])
while co < n:
    te = [k for j in depth[i] for k, x in enumerate(c[j]) if x==1]
    te = set(te) - se
    if len(te) == 0:
        break
    co += len(te)
    se = te | se
    depth.append(list(te))
    i += 1

    
if co != n:
    print("No")
else:
    print("Yes")
    for i in range(1, len(depth)):
        te = depth[i-1]
        for j in depth[i]:
            t = c[j]
            for k in te:
                if t[k]==1:
                    lis[j] = k
                    break
    for i in lis[2:]:
        print(i)

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
lis = [0]*(n+1)
c = [[] for i in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    c[a].append(b)
    c[b].append(a)
    
que = deque([1])
check = [0 for i in range(n+1)]
check[1] = 1
while que:
    now = que.popleft()
    nx = c[now]
    for i in nx:
        if check[i] == 1:
            continue
        check[i] = 1
        lis[i] = now
        que.append(i)
if 0 in lis[2:]:
    print("No")
else:
    print("Yes")
    for i in lis[2:]:
        print(i)
### BUGGY CODE ###

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

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
t = 0 
S = sum(A)
c = 0 
for i in range(len(A) - 1): 
        S -= A[i]
        t = (t + (A[i] * S)) % 1000000007
print(t)
### BUGGY CODE ###

S = list(input())
Q = int(input())

d = 1
c = 1
for i in range(Q):
    que = list(input().split())
    if que[0] == str(1):
        d += c
        c *= -1
    else:
        if (int(que[1]) ^ d) == 0:
            S.insert(0, que[2])
        else:
            S.append(que[2])

print(''.join(S) if d == 1 else ''.join(S[::-1]))


### FIXED CODE ###

from collections import deque

S = deque(input())
Q = int(input())

d = 1
c = 1
for i in range(Q):
    que = list(input().split())
    if que[0] == str(1):
        d += c
        c *= -1
    else:
        if (int(que[1]) ^ d) == 0:
            S.appendleft(que[2])
        else:
            S.append(que[2])

print(''.join(S) if d == 1 else ''.join(S)[::-1])
### BUGGY CODE ###

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

x = sorted(lst, key=lambda x:x[1])
dic = {}
for p,y in x:
    if p in dic.keys():
        dic[p].append(y)
    else:
        dic[p] = [y]
for p,y in lst:
    print(str(p).zfill(6)+str(dic[p].index(y)+1).zfill(6))

### FIXED CODE ###

n,m = map(int,input().split())
city_inf = []
for i in range(m):
    array = [i]
    array.extend(list(map(int,input().split())))
    city_inf.append(array)

city_inf.sort(key=lambda x:x[2])
order_counter = {}

for list in city_inf:
    if list[1] in order_counter.keys():
        order_counter[list[1]] += 1
        list.append(order_counter[list[1]])
    else:
        order_counter[list[1]] = 1
        list.append(1)

city_inf.sort(key=lambda x:x[0])
zero_p = ''
zero_y = ''
for list in city_inf:
    zero_p = '0'*(6-len(str(list[1])))
    zero_y = '0'*(6-len(str(list[3])))
    list.append(zero_p + str(list[1]) + zero_y + str(list[3]))
    print(list[4])
### BUGGY CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    for i in range(N-1):
        print(A.count(i+1))
    print("0")
resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = [0]*N
    for i in A:
        ans[i-1] += 1
    for j in ans:
        print(j)
resolve()
### BUGGY CODE ###

n = int(input())
keta = len(str(n))
s = 0
for i in range(keta-1,-1,-1):
    r,n = divmod(n,10**i)
    s += r
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

n = int(input())
if n % 9 == 0:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

from collections import Counter 

n = int(input())
li = list()
for _ in range(n):
    li.append(input())
a = Counter(li)
m = [x[0] for x in a.items() if x[1] == max(a.values())]
m.sort()
for i in m:
    print(i)

### FIXED CODE ###

import collections

n = int(input())
mozi = list()
for i in range(n):
    mozi.append(input())

c = collections.Counter(mozi)
m = max(c.values())
c = sorted(c.items())

for i in c:
    if (i[1] == m):
        print(i[0])
### BUGGY CODE ###

import copy

h,w = map(int,input().split())
a = [input() for _ in range(h)]
b = [[False]*w for _ in range(h)]
c = []
d = [(-1,0), (1,0), (0,-1), (0,1)]
ans = 0

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            b[i][j] = True
            c.append((i,j))

while True:
    tmp = []
    for i,j in c:
        for d1,d2 in d:
            if 0 <= i + d1 < h and 0 <= j + d2 < w:
                if not b[i+d1][j+d2]:
                    tmp.append((i+d1, j+d2))
                    b[i+d1][j+d2] = True
    if tmp:
        c = copy.deepcopy(tmp)
        ans += 1
    else:
        break

print(ans)


### FIXED CODE ###

import copy
#import time

h,w = map(int,input().split())
a = [input() for _ in range(h)]
b = [[False]*w for _ in range(h)]
#s = time.time()
c = []
d = [(-1,0), (1,0), (0,-1), (0,1)]
ans = 0

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            b[i][j] = True
            c.append((i,j))
#print(time.time()-s)

while True:
    tmp = []
    cnt = 0
    for i,j in c:
        for d1,d2 in d:
            if 0 <= i + d1 < h and 0 <= j + d2 < w:
                if not b[i+d1][j+d2]:
                    tmp.append((i+d1, j+d2))
                    b[i+d1][j+d2] = True
                    cnt += 1
    #print(time.time()-s)
    if cnt > 0:
        c = copy.copy(tmp)
        ans += 1
    else:
        break
    #print(time.time()-s)

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

n,k=map(int,input().split())
ans=10e20
if n%k==0:
    ans=0
else:
    while ans>=n:
        ans=abs(n-k)
        n=abs(n-k)
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
ans=n%k
print(min(ans,abs(ans-k)))
### BUGGY CODE ###

A = list(input())
N = len(A)

ans = 0

flg = True
while flg:
    flg = False
    for i in range(N-1):
        if A[i] != A[i+1]:
            ans += 2
            N -= 2
            flg = True
            for j in range(i, N):
                A[j] = A[j+2] 
            break

print(ans)


### FIXED CODE ###

A = list(input())
N = len(A)

C0 = A.count("0")
C1 = A.count("1")

print(2 * min(C0, C1))
### BUGGY CODE ###

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    H, W = LI()
    Ch, Cw = LI_()
    Dh, Dw = LI_()
    S = [SS() for _ in range(H)]

    d = ((1, 0), (0, 1), (-1, 0), (0, -1)) 
    dist = [[INF] * W for _ in range(H)]
    que = collections.deque()
    que.append((Ch, Cw, 0))
    dist[Ch][Cw] = 0
    while que:
        cy, cx, cost = que.popleft()
        for dy, dx in d:
            ny = cy + dy
            nx = cx + dx
            if 0 <= ny < H and 0 <= nx < W and S[ny][nx] == '.' and cost < dist[ny][nx] :
                dist[ny][nx] = cost
                que.appendleft((ny, nx, cost))
        for dy, dx in itertools.product(range(-2, 3), repeat=2):
            ny = cy + dy
            nx = cx + dx
            if 0 <= ny < H and 0 <= nx < W and S[ny][nx] == '.' and cost + 1 < dist[ny][nx] :
                dist[ny][nx] = cost + 1
                que.append((ny, nx, cost + 1))

    if dist[Dh][Dw] == INF:
        print(-1)
    else:
        print(dist[Dh][Dw])

if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    H, W = LI()
    Ch, Cw = LI_()
    Dh, Dw = LI_()
    S = [SS() for _ in range(H)]

    d = ((1, 0), (0, 1), (-1, 0), (0, -1)) 
    dist = [[INF] * W for _ in range(H)]
    que = collections.deque()
    que.append((Ch, Cw, 0))
    dist[Ch][Cw] = 0
    while que:
        cy, cx, cost = que.popleft()
        for dy, dx in d:
            ny = cy + dy
            nx = cx + dx
            if 0 <= ny < H and 0 <= nx < W and S[ny][nx] == '.' and cost < dist[ny][nx] :
                dist[ny][nx] = cost
                que.appendleft((ny, nx, cost))
        for dy, dx in itertools.product(range(-2, 3), repeat=2):
            ny = cy + dy
            nx = cx + dx
            if 0 <= ny < H and 0 <= nx < W and S[ny][nx] == '.' and cost + 1 < dist[ny][nx] :
                dist[ny][nx] = cost + 1
                que.append((ny, nx, cost + 1))

    if dist[Dh][Dw] == INF:
        print(-1)
    else:
        print(dist[Dh][Dw])

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

n = int(input())
a_s = [] 
for i in range(n):
    a_s.append([int(item) - 1 for item in input().split()])

total = n * (n - 1) // 2
days = 0
itrs = [0] * n
fights = 0

while True:
    wants = set()
    has_match = False
    for item in range(n):
        idx = itrs[item]
        if idx == n - 1:
            continue
        want = a_s[item][idx]
        # Check there is match or not
        if a_s[want][itrs[want]] == item:
            has_match = True
            if item < want:
                wants.add((item, want))
            else:
                wants.add((want, item))
    if not has_match:
        break
    # Process match
    for a, b in wants:
        itrs[a] += 1
        itrs[b] += 1
        fights += 1
    days += 1

if fights == total:
    print(days)
else:
    print(-1)

### FIXED CODE ###

class DirectedGraph:
    def __init__(self, adj):
        self.n = len(adj)
        self.adj = adj
        self.is_asyclic = False
        self.max_path_len = None

    def topological_sort(self):
        indegree = [0] * self.n
        for i, vs in enumerate(self.adj):
            for dest in vs:
                indegree[dest] += 1
        zero_v = []
        for v, indeg in enumerate(indegree):
            if indeg == 0:
                zero_v.append(v)
        max_path_len = 1
        tp_sorted = []
        to_be_added = []
        while True:
            while zero_v:
                v = zero_v.pop()
                tp_sorted.append(v)
                for dest in self.adj[v]:
                    indegree[dest] -= 1
                    if indegree[dest] == 0:
                        to_be_added.append(dest)
            if len(to_be_added) > 0:
                zero_v += to_be_added
                to_be_added = []
                max_path_len += 1
            else:
                break
        if len(tp_sorted) == self.n:
            self.is_asyclic = True
            self.max_path_len = max_path_len
            return tp_sorted
        else:
            self.is_asyclic = False
            return None

if __name__ == "__main__":
    n = int(input())
    dic = {}
    itr = 0
    for i in range(n):
        for j in range(i+1, n):
            dic[i*n + j] = itr
            itr += 1
    edge = [[] for _ in range(n * (n-1) // 2)]
    for i in range(n):
        a = [int(item) - 1 for item in input().split()]
        for j1, j2 in zip(a, a[1:]):
            if i < j1:
                u = i * n + j1 
            else:
                u = j1 * n + i 
            if i < j2:
                v = i * n + j2 
            else:
                v = j2 * n + i 
            edge[dic[u]].append(dic[v])

    DG = DirectedGraph(edge)
    tps = DG.topological_sort()

    if DG.is_asyclic:
        print(DG.max_path_len)
    else:
        print(-1)
### BUGGY CODE ###

from pprint import pprint
INF = 1000000
dx = [1, -1, 0,  0]
dy = [0,  0, 1, -1]
# 入力
h, w = map(int, input().split())
maze = []
wallcount = 0
for i in range(h):
    l = list(input())
    maze.append(l)
    wallcount += l.count("#")

# ワーシャルフロイド用に枠を作る。
# 2次元マップしてもいいが面倒なので、１次元にする。[0 - x][0 - y]を[0- x * y]にflattenする
wsmap = lambda a, b: (a * w + b)
dp = []
# 辺がない時はINFを入れのでデフォルト値とする
for i in range(h * w):
    dp.append([INF] * (h * w))

# 迷路ををグラフにする。
for y in range(h):
    for x in range(w):
        if maze[y][x] == "#": # そのマスが壁なら何もしない(他のマストの連結はないので)
            continue
        # ワーシャルフロイドでは自分自身へのコストは0にしておく。
        dp[wsmap(y, x)][wsmap(y, x)] = 0
        # ４方向に移動できるかの判定
        for dir in range(len(dx)):
            nx, ny = x + dx[dir], y + dy[dir]
            if -1 < nx and nx < w and -1 < ny and ny < h: # 枠をはみ出ないかチェック
                if maze[ny][nx] != "#": # そのマスが壁でないなら
                    dp[wsmap(y, x)][wsmap(ny, nx)] = 1 # コストを1にする

# ワーシャルフロイドする
for kk in range(h * w):
    for ii in range(h * w):
        for jj in range(h * w):
            dp[ii][jj] = min(dp[ii][jj], dp[ii][kk] + dp[kk][jj])

# これで結果が出たので
import itertools
res = list(itertools.chain(*dp))# 二次元配列を一次元にして
needstep = dp[0][-1]
res = h * w
res -= wallcount
res -= needstep + 1
print(res if res >= 0 else "-1")


### FIXED CODE ###

from pprint import pprint
INF = 1000000
dx = [1, -1, 0,  0]
dy = [0,  0, 1, -1]
# 入力
h, w = map(int, input().split())
maze = []
wallcount = 0
for i in range(h):
    l = list(input())
    maze.append(l)
    wallcount += l.count("#")

# ワーシャルフロイド用に枠を作る。
# 2次元マップしてもいいが面倒なので、１次元にする。[0 - x][0 - y]を[0- x * y]にflattenする
wsmap = lambda a, b: (a * w + b)
dp = []
# 辺がない時はINFを入れのでデフォルト値とする
for i in range(h * w):
    dp.append([INF] * (h * w))



# 迷路ををグラフにする。
goal = -1
dis = 0
import collections
q = collections.deque( [ (0,0,0) ] ) #x,y,d

while len(q) > 0:
    x, y, d = q.popleft()
    if x == w - 1 and y == h - 1:
        goal = d
    for dir in range(len(dx)):
        nx, ny = x + dx[dir], y + dy[dir]
        if -1 < nx and nx < w and -1 < ny and ny < h:
            if nx == w-1 and ny == h - 1:
                goal = d + 1
                break
            if maze[ny][nx] == ".": # そのマスが壁でないなら
                maze[ny][nx] = d
                q.append( (nx, ny, d + 1) )

    if goal != -1:
        break

# これで結果が出たので
import itertools
if goal == -1:
    print(-1)
else:
    needstep = goal
    res = h * w
    res -= wallcount
    res -= needstep + 1
    print(res)
### BUGGY CODE ###

import sys
from collections import defaultdict


def main():
    input = sys.stdin.readline

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

    q = int(input())
    for _ in range(q):
        v, l = map(int, input().split())
        v -= 1
        items_sub = [items[v]]
        while v > 0:
            v = (v - 1) // 2
            items_sub.append(items[v])

        m = len(items_sub)
        dp = [0] * (l + 1)
        for bit in range(1 << (m // 2)):
            s_val = s_w = 0
            for i, (val, w) in enumerate(items_sub[:m // 2]):
                if (bit >> i) & 1:
                    s_val += val
                    s_w += w
            if s_w <= l:
                dp[s_w] = max(dp[s_w], s_val)
        for i in range(l):
            dp[i + 1] = max(dp[i + 1], dp[i])

        ans = 0
        for bit in range(1 << (m - m // 2)):
            s_val = s_w = 0
            for i, (val, w) in enumerate(items_sub[m // 2:]):
                if (bit >> i) & 1:
                    s_val += val
                    s_w += w
            if s_w <= l:
                ans = max(ans, dp[l - s_w] + s_val)

        print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline

    n = int(input())

    L_MAX = 10**5
    D_TH = 10
    V_MAX = (1 << D_TH) - 1
    dp = [[0] * (L_MAX + 1)]
    # items = []
    items_v = []
    items_w = []

    for i in range(n):
        val, w = map(int, input().split())
        if i < V_MAX:
            i1 = i + 1
            i0 = (i + 1) >> 1
            dp_ = dp[i0][:]

            # for j in range(w):
            #     dp[i1][j] = dp[i0][j]
            for j in range(w, L_MAX + 1)[::-1]:
                if dp_[j] < dp_[j - w] + val:
                    dp_[j] = dp_[j - w] + val
            dp.append(dp_)
        else:
            # items.append((val, w))
            items_v.append(val)
            items_w.append(w)

    # items = tuple(items)

    q = int(input())
    for _ in range(q):
        v, l = map(int, input().split())
        v -= 1

        if v < V_MAX:
            ans = dp[v + 1][l]
        else:
            vv = []
            ww = []
            while v >= V_MAX:
                # vv.append(items[v - V_MAX][0])
                # ww.append(items[v - V_MAX][1])
                vv.append(items_v[v - V_MAX])
                ww.append(items_w[v - V_MAX])
                v = (v - 1) >> 1

            ans = dp[v + 1][l]
            # m = len(vv)
            m2 = 1 << len(vv)
            v_sub = [0] * m2
            w_sub = [0] * m2
            for bit in range(1, m2):
                bit_min = bit & (-bit)
                x = bit_min.bit_length() - 1

                s_w = w_sub[bit - bit_min] + ww[x]
                w_sub[bit] = s_w
                if s_w <= l:
                    s_val = v_sub[bit - bit_min] + vv[x]
                    v_sub[bit] = s_val
                    ans = max(ans, dp[v + 1][l - s_w] + s_val)

        print(ans)


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

#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

def cmb(n, r, p):
    r = min(n - r, r)
    if r == 0:
        return 1
    over = 1
    for i in range(n, n - r, -1):
        over = over * i % p
    under = 1
    for i in range(1, r + 1):
        under = under * i % p
    inv = pow(under, p - 2, p)
    return over * inv % p

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

minus = 0
plus = 0

for i, a in enu(A):
    mval = cmb(N-i-1, K-1, MOD)
    pval = cmb(i, K-1, MOD)
    if i<=K-2:
        pval = 0
    if N-K+1<=i:
        mval = 0
#    print(mval, pval)
    minus -= a*mval
    plus += a*pval

print((plus+minus)%MOD)



### FIXED CODE ###

#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))


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

fact = [1]
for i in range(1, N+10):
    fact.append(fact[-1] * i % MOD)
def rev(x):
    return pow(x, MOD-2, MOD)
def cmb(i, k):
    if(i < k): return 0
    return fact[i] * rev(fact[k]) * rev(fact[i-k]) % MOD

minus = 0
plus = 0

for i, a in enu(A):
    mval = cmb(N-i-1, K-1)
    pval = cmb(i, K-1)
    if i<=K-2:
        pval = 0
    if N-K+1<=i:
        mval = 0
#    print(mval, pval)
    minus -= a*mval
    plus += a*pval

print((plus+minus)%MOD)
### BUGGY CODE ###

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

b = []
for i in range(N):
    if i % 2 == 1:
        b = b + [A[i]]
    else:
        b = [A[i]] + b
if N % 2 == 0:
    b = b[::-1]

print(" ".join(b))

### FIXED CODE ###

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

b = A[::2][::-1] + A[1::2]
if N % 2 == 0:
    b = b[::-1]
print(" ".join(b))
### BUGGY CODE ###

from fractions import gcd
from functools import reduce 
def lcm_base(x, y):
  return(x * y) // gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

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

mod = 1000000000 + 7
min = lcm_list(a)
sum = 0
for i in range(n):
  sum = sum + (min//a[i])%mod 
  
print(sum%mod)



### FIXED CODE ###

from fractions import gcd
from functools import reduce
     
mod = 10 ** 9 + 7
     
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
     
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
     
    # print('input >>')
N = int(input())
A = list(map(int,(input().split())))
     
lcmn = lcm(A)
    
ans = 0
for i in range(len(A)):
    ans += lcmn // A[i]
     
    # print('-----output-----')
print(int(ans%mod))
### BUGGY CODE ###

import math
N = int(input())
for n in range(1,N+1):
    r_n = math.floor(math.sqrt(n))
    count = 0
    if(n >= 6):
        for x in range(1,r_n):
            for y in range(1,x+1):
                for z in range(1,y+1):
                    if (x*x + y*y + z*z + x*y + y*z + z*x) == n:
                        if (x == y and y ==z):
                            count+=1
                        elif(x == y or y==z or z == x):
                            count+=3
                        else:
                            count+=6
    print(count)

### FIXED CODE ###

import math
N = int(input())
ans = [0 for _ in range(10050)]
r_n = math.floor(math.sqrt(N))
count = 0
for x in range(1,r_n):
    for y in range(1,r_n):
        for z in range(1,r_n):
            n = x*x + y*y + z*z + x*y + y*z + z*x
            if n < 10050:
                ans[n]+=1
for i in range(N):
    print(ans[i+1])