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

class Node():
    def __init__(self, key):
        self.prev = None
        self.next = None
        self.key = key
    
class Solution:
    def display(self):
        result = []
        cur = nil.next
        while True:
            if cur == nil:
                break
            result.append(cur.key)
            cur = cur.next
        return result
    
    def insert(self, key):
        x = Node(key)

        if nil.next == None:
            nil.next = x
            nil.prev = x
            x.prev = nil
            x.next = nil
        else:
            x.next = nil.next
            nil.next.prev = x
            nil.next = x
            x.prev = nil

    def listSearch(self, key):
        cur = nil.next
        while cur != nil:
            if cur.key == key:
                break
            cur = cur.next
        return cur
    
    def deleteNode(self, node):
        if node == nil:
            return
        node.prev.next = node.next
        node.next.prev = node.prev

    def delete(self, key):
        self.deleteNode(self.listSearch(key))
    
    def deleteFirst(self):
        self.deleteNode(nil.next)
    
    def deleteLast(self):
        self.deleteNode(nil.prev)


myList = Solution()
nil = Node(None)

for _ in range(int(input())):
    s = input()
    try:
        com, val = s.split()
        val = int(val)
    except ValueError:
        com = s
    
    if com == 'insert':
        myList.insert(val)
    elif com == 'delete':
        myList.delete(val)
    elif com == 'deleteFirst':
        myList.deleteFirst()
    elif com == 'deleteLast':
        myList.deleteLast()

print(*myList.display())



### FIXED CODE ###

import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)
### BUGGY CODE ###

count = 0
K,S = map(int,input().split())

for i in range(K+1):
	for j in range(K+1):
		for k in range(K+1):
			if i + j + k == S:
				count += 1
				
print(count)

### FIXED CODE ###

count = 0
K,S = map(int,input().split())

for i in range(K+1):
	for j in range(K+1):
			k = S - i - j
			if 0 <= k <= K:	
				count += 1
				
print(count)
### BUGGY CODE ###

from math import gcd
import sys

N = int(input())

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

A = max(a)+1

# 全ての数に対して、入っているかいないかを判別する配列を作る
c = [0]*A
for i in range(N):
    c[a[i]] += 1

# print(c)

pairwise = True

for i in range(2,A):
    cnt = 0

    # 素因数ずつ数を増やしていき、同じ素因数を持つことがあればpairwiseではない
    # たとえば、3ならば、3,6,9,,と増やしていき、それがc[]に１つ以上含まれているか調べていく
    for j in range(i,A,i):
        cnt += c[j]
    if (cnt > 1):
        pairwise = False

if pairwise:
    print("pairwise coprime")
    sys.exit()

g = 0
for i in range(N):
    g = gcd(g,a[i])
if (g == 1):
    print("setwise coprime")
    sys.exit()

else:
    print('not coprime')

### FIXED CODE ###

from math import gcd
import sys

N = int(input())

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

A = max(a)+1

# 全ての数に対して、入っているかいないかを判別する配列を作る
c = [0]*A
for i in range(N):
    c[a[i]] += 1

# print(c)

pairwise = True

for i in range(2,A):
    cnt = 0

    # 素因数ずつ数を増やしていき、同じ素因数を持つことがあればpairwiseではない
    # たとえば、3ならば、3,6,9,,と増やしていき、それがc[]に１つ以上含まれているか調べていく
    for j in range(i,A,i):
        cnt += c[j]
    if (cnt > 1):
        pairwise = False

if pairwise:
    print("pairwise coprime")
    sys.exit()

g = 0
for i in range(N):
    g = gcd(g,a[i])
if (g == 1):
    print("setwise coprime")
    sys.exit()

else:
    print('not coprime')
### BUGGY CODE ###

#入力
HWD = list(map(int, input().split()))
H, W, D = HWD[0], HWD[1],  HWD[2]
field = []
for i in range(H):
    field.append(list(map(int, input().split())))
           
Q = int(input())
target = []
for i in range(Q):
    target.append(list(map(int, input().split())))

#動作
for test in range(Q):
    count = 0
    next_point = target[test][0]
    while not next_point == target[test][1]:
        now_point = next_point
        next_point = now_point + D
        for field_h in range(H):
            for field_w in range(W):
                if field[field_h][field_w] == now_point:
                    now_h = field_h
                    now_w = field_w
                if field[field_h][field_w] == next_point:
                    next_h = field_h
                    next_w = field_w
        count += abs(next_h - now_h) + abs(next_w - now_w)
    print(count)

### FIXED CODE ###

#入力
HWD = list(map(int, input().split()))
H, W, D = HWD[0], HWD[1],  HWD[2]
field_dict = {}
for h in range(H):
    field = list(map(int, input().split()))
    for w in range(W):
        field_dict[field[w]] = (h, w)

#numberからD動かした時の魔力
move_dict = {}
pre_length = 0
for now_point in range(1, H * W + 1):
    pre_point = now_point - D
    if now_point > D:
        pre_length = move_dict[now_point - D]
        now_h = field_dict[now_point][0]
        now_w = field_dict[now_point][1]
        pre_h = field_dict[pre_point][0]
        pre_w = field_dict[pre_point][1]
        move_dict[now_point] = abs(now_h - pre_h) + abs(now_w - pre_w) + pre_length
    else:
        move_dict[now_point] = 0
           
#試験
Q = int(input())
for test in range(Q):
    target = list(map(int, input().split()))
    count = move_dict[target[1]] - move_dict[target[0]]
    print(count)
### BUGGY CODE ###

n, m, s, t = map(int, input().split())
E = [[] for i in range(n)]
for i in range(m):
  u, v, a, b = map(int, input().split())
  E[u - 1].append([v - 1, a, b])
  E[v - 1].append([u - 1, a, b])
A = [[10 ** 15, 0] for i in range(n)]
A[s - 1][0] = 0
q_a = [s - 1]
while q_a:
  s_a = sorted([[A[q][0], q] for q in q_a], key=lambda x: x[0])[0][1]
  q_a.remove(s_a)
  A[s_a][1] = 1
  for e in E[s_a]:
    if A[e[0]][1] == 0:
      if A[s_a][0] + e[1] < A[e[0]][0]:
        A[e[0]][0] = A[s_a][0] + e[1]
        if e[0] not in q_a:
          q_a.append(e[0])
B = [[10 ** 15, 0] for i in range(n)]
B[t - 1][0] = 0
q_b = [t - 1]
while q_b:
  s_b = sorted([[B[q][0], q] for q in q_b], key=lambda x: x[0])[0][1]
  q_b.remove(s_b)
  B[s_b][1] = 1
  for e in E[s_b]:
    if B[e[0]][1] == 0:
      if B[s_b][0] + e[2] < B[e[0]][0]:
        B[e[0]][0] = B[s_b][0] + e[2]
        if e[0] not in q_b:
          q_b.append(e[0])
C = [A[i][0] + B[i][0] for i in range(n)]
for i in range(n):
  print(10 ** 15 - min(C[i:]))

### FIXED CODE ###

import heapq
n, m, s, t = map(int, input().split())
E = [[] for _ in range(n)]
A = [0] * m
B = [0] * m
for i in range(m):
  u, v, a, b = map(int, input().split())
  E[u - 1].append([v - 1, i])
  E[v - 1].append([u - 1, i])
  A[i] = a
  B[i] = b
L = [0] * n
Y = [10 ** 15] * n
S = [10 ** 15] * n
def dijkstra(s, D, W):
  Q = [[0, s]]
  D[s] = 0
  pos = 0
  while Q:
    d, q = heapq.heappop(Q)
    for adj, e in E[q]:
      if d + W[e] < D[adj]:
        D[adj] = d + W[e]
        pos += 1
        heapq.heappush(Q, [D[adj], adj])
  return D
dijkstra(s - 1, Y, A)
dijkstra(t - 1, S, B)
for i in range(n):
  L[i] = Y[i] + S[i]
for i in range(n - 2, -1, -1):
  L[i] = min(L[i + 1], L[i])
for i in range(n):
  print(10 ** 15 - L[i])
### BUGGY CODE ###

# -*- using:utf-8 -*-
from itertools import combinations

class main:
  def v(array):
    sum = 0
    for i in range(len(array)):
      sum += array[i][0] * array[i][1]
    sum = sum % 1000000007
    print(sum)

if __name__ == "__main__":
  n = int(input())
  li = list(map(int, input().split()))
  array = list(combinations(li, 2))
  main.v(array)

### FIXED CODE ###

# -*- using:utf-8 -*-

class main:
  def function(n, a):
    mod = 10 **9 +7
    S = [0] * (n + 1)
    for i in range(n):
      S[i + 1] = S[i] + a[i]
    SN = S[-1]
    ans = 0
    for i in range(n - 1):
      cnt = a[i] * (SN - S[i + 1])
      ans += cnt
    print(ans % mod)



if __name__ == "__main__":
  n = int(input())
  a = list(map(int, input().split()))
  main.function(n,a)
### BUGGY CODE ###

import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
i=0
while i<n:
    s=l[n-i-1]
    b=1
    while b<=s:
        b*=2
    g=b-s
    p=bisect.bisect_left(l[:n-i-1],g)
    if p==n-i-1:
        i+=1
        continue
    else:
        if l[p]==g:
            l.pop(n-i-1)
            l.pop(p)
            i+=2
            ans+=1
print(ans)


### FIXED CODE ###

from bisect import bisect_left
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
A.sort()
t=0
for i in range(N):
    while 2**t<=A[i]:
        if 2**t<=A[i]<2**(t+1):
            break
        t+=1
    B[i]=2**(t+1)-A[i]
i=N-1
count=0
flag=[0]*N
for i in range(N-1,0,-1):
    if flag[i]==1:
        continue
    flag[i]=1
    b=bisect_left(A,B[i])
    if A[b]==B[i] and flag[b]==0:
        flag[i]=1
        flag[b]=1
        A[b]-=1
        count+=1
print(count)
### BUGGY CODE ###

def lcs1d(X,Y):
    lx = len(X)
    ly = len(Y)
    T = [0] * ly
    for j in range(1,lx):
        C = T[:]
        for k in range(1,ly):
            k1 = k-1
            if X[j] == Y[k]:
                T[k] = C[k1] + 1
            elif C[k] > T[k1]:
                T[k] = C[k]
            else:
                T[k] = T[k1]
    return T[k]

def main():
    """ ????????? """
    num = int(input())
    for i in range(num):
        X = " " + input()
        Y = " " + input()
        max = lcs1d(X,Y)
        print(max)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    num = int(input())
    A = []
    for i in range(num):
        X = input()
        Y = " " + input()
        lx = len(X)
        ly = len(Y)
        T = [0] * ly
        for j in range(lx):
            xj = X[j]
            C = T[:]
            for k in range(1,ly):
                k1 = k-1
                if xj == Y[k]:
                    T[k] = C[k1] + 1
                elif T[k] < T[k1]:
                    T[k] = T[k1]
        print(T[k])
if __name__ == '__main__':
    main()
### BUGGY CODE ###

# 配るDPで解く
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp = [float('inf')]*N

dp[0] = 0
# 配っていく
for i in range(N):
    for j in range(i+1, min(i+1+K, N)):
        dp[j] = min(dp[j], dp[i]+abs(H[j]-H[i]))
print(dp[N-1])


### FIXED CODE ###

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


def frog(n, k, h):
    d = [float('inf')] * n
    d[0] = 0

    for i in range(1, n):
        d[i] = min(
            d[j] + abs(h[i] - h[j]) for j in range(max(i - k, 0), i)
        )
    return d[n - 1]


print(frog(n, k, h))
### BUGGY CODE ###

N,Q = map(int, input().split())
s = input()

l_list = []
r_list = []

for q in range(Q):
  l,r = map(int, input().split())
  s_q = s[l-1:r]
  cnt = 0
  
  for i in range(len(s_q)-1):
    if s_q[i] == 'A' and s_q[i+1] == 'C':
      cnt += 1
  
  print(cnt)
  




### FIXED CODE ###

N,Q = map(int,input().split())
s = input()

cnt = 0
n = [0]
for i in range(N-1):
    if s[i]+s[i+1] == 'AC':
        cnt += 1
    n.append(cnt)


for i in range(Q):
    l,r = map(int,input().split())
    print(n[r-1]-n[l-1])
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N: int, A: "List[int]"):
    mLEN = len(format(max(A),'b'))
    bA = [[0]*N for _ in range(mLEN)]

    for i in range(N):
        a = format(A[i],'b').zfill(mLEN)
        for k in range(mLEN):
            bA[k][i] = a[k]

    ruiseki = [[()]*N for _ in range(mLEN)]
    for keta in range(mLEN):
        zero = bA[keta].count('0')
        one = bA[keta].count('1')

        for i in range(0,N):
            if bA[keta][i] == '1':
                one -= 1
            else:
                zero -= 1
            ruiseki[keta][i] = (zero,one)
    
    answer = 0
    for keta in range(mLEN):
        a = 0
        for i in range(N):
            if bA[keta][i] == '1':
                a += ruiseki[keta][i][0]
            else:
                a += ruiseki[keta][i][1]

        answer += a*2**(mLEN-1-keta)
        answer %= MOD

    print(answer%MOD)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import numpy as np

MOD = 1000000007  # type: int

def solve(N: int, A: "List[int]"):
    mLEN = len(format(max(A),'b'))

    A = np.array(A)
    ans = 0
    d = 1
    while d < (1 << mLEN):
        cnt = np.count_nonzero(A & d)
        ans += (N - cnt) * cnt * d
        ans %= MOD
        d <<= 1
    print(ans)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

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

import sys

read = sys.stdin.buffer.read


def main():
    N, *X = map(int, read().split())
    A = [0] * N
    for i in range(N):
        A[i] = X[(N - 1) * i : (N - 1) * (i + 1)]

    M = N * (N - 1) // 2

    total_mathces = 0
    for day in range(M):
        matches = 0
        played = [False] * N
        for i in range(N - 1):
            if played[i] or not A[i]:
                continue
            j = A[i][-1] - 1
            if not played[j] and i + 1 == A[j][-1]:
                played[i] = played[j] = True
                A[i].pop()
                A[j].pop()
                matches += 1

        if matches == 0:
            ans = -1
            break

        total_mathces += matches
        if total_mathces == M:
            ans = day + 1
            break

    print(ans)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    A = [0] * N
    for i in range(N):
        A[i] = [int(s) - 1 for s in readline().split()]

    M = N * (N - 1) // 2

    total_mathces = 0
    changed = set(range(N))
    for day in range(M):
        matches = 0
        changed_prev, changed = changed, set()
        for i in changed_prev:
            if i in changed or not A[i]:
                continue
            j = A[i][-1]
            if j not in changed and i == A[j][-1]:
                changed.add(i)
                changed.add(j)
                A[i].pop()
                A[j].pop()
                matches += 1

        if matches == 0:
            ans = -1
            break

        total_mathces += matches
        if total_mathces == M:
            ans = day + 1
            break

    print(ans)
    return


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

import sys

num = sys.stdin.readline().split(' ')
K = int(num[0])
S = int(num[1])

counter = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k == S:
                counter += 1
            else:
                continue

print(counter)

### FIXED CODE ###

import sys

num = sys.stdin.readline().split(' ')
K = int(num[0])
S = int(num[1])

counter = 0
for i in range(K+1):
    for j in range(K+1):
        if 0 <= S-i-j <= K:
            counter += 1
        else:
            continue

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

n = int(input())

# 約数列挙O(√N)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    return divisors


ans = 0
for c in range(1, n):
    ans += len(make_divisors(n - c))
print(ans)


### FIXED CODE ###

n = int(input())
ans = 0
for a in range(1, n):
    for b in range(1, n):
        if a * b >= n:
            break
        else:
            ans += 1
print(ans)
### BUGGY CODE ###

def main():
    N = int(input())
    A = [0] + [int(i) for i in input().split()] + [0]
    l = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
    print("\n".join(
        [str(sum(l) - l[i] - l[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)]))

    return


main()


### FIXED CODE ###

def main():
    N = int(input())
    A = [0] + [int(i) for i in input().split()] + [0]
    l = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
    num = sum(l)
    print("\n".join(
        [str(num - l[i] - l[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)]))

    return


main()
### BUGGY CODE ###

a, b, k = map(int, input().split())
l = [i for i in range(a, b + 1)]
s = sorted(l)
if len(s) > k * 2:
    s = s[:k] + s[-k:]
for i in s:
    print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
n = b - a + 1
if n <= k * 2:
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)
    for j in range(b - k + 1, b + 1):
        print(j)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N,M=list(map(int,raw_input().split()))

nl=[[0]*(N+1) for i in range(N+1)]
a=[0]*M
for i in range(M):
	x,y=map(int,raw_input().split())
	nl[x][y]=1
	nl[y][x]=1	
#print nl

def dfs(v,p):
	#print v,p,color
	global bip_graph
	F[v]=1

	for j in range(N+1):

		#色塗り
		if nl[v][j]!=0:
			#print v,j,color
			if color[v]=="w" and color[j]==0:
				color[j]="b"
			elif color[v]=="b" and color[j]==0:
				color[j]="w"				
			elif color[v]==color[j]:
				#二分木ではない
				bip_graph="NO"


		#頂点 v に隣接しているかつ未訪問
		if bip_graph!="NO" and nl[v][j]!=0 and F[j]==0:
			#DFS(次の頂点i, 次に親となる頂点v, d+ 頂点vと頂点iの間の辺のコスト)
			
			dfs(j,v)


bip_graph="YES"
color=[0]*(N+1)
F=[0]*(N+1)
color[1]="b"
dfs(1,-1)
#print bip_graph
#print color

if bip_graph=="YES":
	print color.count("b")*color.count("w")-M
elif bip_graph=="NO":
	print N*(N-1)/2-M



### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**7)
N,M=list(map(int,raw_input().split()))

nl=[[] for i in range(N+1)]
for i in range(M):
	x,y=map(int,raw_input().split())
	nl[x].append(y)
	nl[y].append(x)	
#print nl


def dfs(v):
	F[v]=1
	for i in nl[v]:
		if color[v]=="w" and color[i]==0:
			color[i]="b"
		elif color[v]=="b" and color[i]==0:
			color[i]="w"				
		elif color[v]==color[i]:
			#２部グラフではない
			print N*(N-1)/2-M
			sys.exit()
		else:
			continue
		#print v,i,color,F
		
		if F[i]==0:
			dfs(i)


F=[0]*(N+1)
color=[0]*(N+1)
color[1]="w"
dfs(1)

#２部グラフの場合
print color.count("b")*color.count("w")-M
### BUGGY CODE ###

N = int(input())
li = list(map(int, input().split()))
for i in range(N):
  ans = str(li.index(i+1) + 1)
  print(ans, end = " ")

### FIXED CODE ###

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

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

flag = 1
for i in range(N-1):
  for j in range(i+1,N):
    if A[i] == A[j]:
      flag = 0
      break
  if flag == 0:
    break
if flag == 1:	print('YES')
else:			print('NO')

### FIXED CODE ###

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

flag = 1
for i in range(N-1):
  if A[i] == A[i+1]:
    flag = 0
    break

if flag == 1:	print('YES')
else:			print('NO')
### BUGGY CODE ###

from operator import itemgetter
import bisect
import heapq
import sys
input = sys.stdin.readline

def main():
    N,M = [int(x) for x in input().split()]
    work = {}
    for _ in range(N):
        a,b = [int(x) for x in input().split()]
        if(a in work):
            work[a].append(b)
        else:
            work[a] = [b]

    cand = []
    cnt = 0
    for i in range(1,M+1):
        if(i in work):
            cand += work[i]
        if(len(cand)==0):
            continue
        x = max(cand)
        cand.remove(x)
        cnt += x

    print(cnt)

if __name__ == '__main__':
    main()


### FIXED CODE ###

from operator import itemgetter
import bisect
import heapq
import sys
input = sys.stdin.readline

def main():
    N,M = [int(x) for x in input().split()]
    work = {}
    for _ in range(N):
        a,b = [int(x) for x in input().split()]
        if(a in work):
            work[a].append(-b)
        else:
            work[a] = [-b]

    cand = []
    heapq.heapify(cand)
    cnt = 0
    for i in range(1,M+1):
        if(i in work):
            for x in work[i]:
                heapq.heappush(cand,x)
        if(len(cand)==0):
            continue
        x = -heapq.heappop(cand)
        cnt += x

    print(cnt)

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

import bisect
import numpy as np

n, m = map(int, input().split())
a = map(int, input().split())
a = np.array(sorted(list(a)), dtype="uint64")
for _ in range(m):  # O(m*n)
    max_num = a[-1]  # O(1)
    index = bisect.bisect(a[:-1], max_num // 2)  # O(log n)
    if index != n - 1:
        a[index + 1:] = a[index:-1]
    a[index] = max_num // 2
print(int(sum(a)))

### FIXED CODE ###

class heap():
    def __init__(self, maxcom=True):
        if maxcom:
            self.compare = lambda x, y: x > y
        else:
            self.compare = lambda x, y: x < y

    def heappush(self, x, heap):
        heap.append(x)
        length = len(heap)
        pointer = length
        while True:
            if pointer == 1:
                break
            if self.compare(heap[pointer - 1], heap[(pointer >> 1) - 1]):
                heap[pointer - 1], heap[(pointer >> 1) - 1] = heap[(pointer >> 1) - 1], heap[pointer - 1]
                pointer = pointer >> 1
            else:
                break

    def heapreplace(self, function, heap):
        heap[0] = function(heap[0])
        pointer = 1
        length = len(heap)
        while True:
            if (pointer << 1) > length:
                break
            elif (pointer << 1) + 1 > length :
                if self.compare(heap[(pointer << 1) - 1], heap[pointer - 1]):
                    heap[(pointer << 1) - 1], heap[pointer - 1] = heap[pointer - 1], heap[(pointer << 1) - 1]
                else:
                    break
            else:
                if self.compare(heap[(pointer << 1) - 1], heap[pointer << 1]):
                    next_pointer = pointer << 1
                else:
                    next_pointer = (pointer << 1) + 1
                if self.compare(heap[next_pointer - 1], heap[pointer - 1]):
                    heap[next_pointer - 1], heap[pointer - 1] = heap[pointer - 1], heap[next_pointer - 1]
                    pointer=next_pointer
                else:
                    break


n, m = map(int, input().split())
a = map(int, input().split())
heapq = []
heapc=heap(True)
for i in a:
    heapc.heappush(i,heapq)
for _ in range(m):
    heapc.heapreplace(lambda x:x>>1,heapq)
print(sum(heapq))
### BUGGY CODE ###

n=int(input())

for i in range(1,n+1):
  count=0
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        a=x**2+z**2+(x+y)*(y+z)
        if i<a:
          break
        if i==a:
          count+=1
          
  print(count)

### FIXED CODE ###

n=int(input())
ans=[0]*n
for x in range(1,101):
  for z in range(1,101):
    for y in range(1,101):
      a=(x+y+z)**2-(x*y+y*z+z*x)
      if a<=n:
          ans[a-1]+=1
for i in ans:
  print(i)