Harryxun/stf_run huggingface dataset:
h,w=map(int,input().split())
a=[[] for _ in range(h)]
for i in range(h):
    s=input()
    for j in s:
        if j=='.':
            a[i].append(-1)
        else:
            a[i].append(0)

def bfs():
    d=[[0,1],[1,0],[-1,0],[0,-1]]
    q=[]
    c=-1
    for i in range(h):
        for j in range(w):
            if a[i][j]==0:
                q.append((i,j))
    while q:
        t=q[:]
        q=[]
        c+=1
        for i,j in t:
            for dd in d:
                di,dj=dd[0],dd[1]
                if (i+di)*(h-1-i-di)>=0 and (j+dj)*(w-1-j-dj)>=0 and a[i+di][j+dj]<0:
                    a[i+di][j+dj]=1
                    q.append((i+di,j+dj))
    return(c)

print(bfs(5,5))


### FIXED CODE ###

from collections import deque
h,w=map(int,input().split())
a=[[] for _ in range(h)]
for i in range(h):
    s=input()
    for j in s:
        if j=='.':
            a[i].append(-1)
        else:
            a[i].append(0)

def bfs():
    d=[[0,1],[1,0],[-1,0],[0,-1]]
    q=deque()
    c=0
    for i in range(h):
        for j in range(w):
            if a[i][j]==0:
                q.append((i,j))
    while(len(q)>0):
        cur=q.popleft()
        i,j=cur
        for dd in d:
            di,dj=dd[0],dd[1]
            if (i+di)*(h-1-i-di)>=0 and (j+dj)*(w-1-j-dj)>=0 and a[i+di][j+dj]<0:
                c=a[i][j]+1
                a[i+di][j+dj]=c
                q.append((i+di,j+dj))
    return(c)

print(bfs())
W, H, x, y = map(int,input().split())

area_H = sorted([x * H, (W - x) * H])
area_W = sorted([y * W, (H - y) * W])

area_h = area_H[0]
area_w = area_W[0]

area = sorted([area_h, area_w])
switch = int(area[0] == area[1])

print(f"{float(area[1])} {switch}")

### FIXED CODE ###

W, H, x, y = map(int, input().split())

is_center = int(x * 2 == W and y * 2 == H)
min_sq = W * H / 2

print("{} {}".format(min_sq, is_center))
#dp[i][j]:S[i-x:i]==S[j-x:j]となる最大のx
import numpy as np

def solve(N, S, dp):
    for i in range(N - 1):
        for j in range(i + 1, N):
            dp[i][j] = min(j - i, dp[i - 1][j - 1] + 1) if S[i] == S[j] else 0
    return dp.max()

def main():
    N = int(input())
    S = np.array([ord(_) for _ in input()])
    print(solve(I))

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()
#dp[i][j]:S[i-x:i]==S[j-x:j]となる最大のx
import numpy as np

def solve(NS):
    N = NS[0]
    S = NS[1:]
    for i in range(N - 1):
        for j in range(i + 1, N):
            dp[i][j] = min(j - i, dp[i - 1][j - 1] + 1) if S[i] == S[j] else 0
    return dp.max()

def main():
    NS = np.array([int(input())] + [ord(_) for _ in input()])
    print(solve(NS))

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()


### FIXED CODE ###

import itertools
N = int(input())
S = input()
dp = [[0] * N for _ in range(N)]
ans = 0
for i, j in itertools.combinations(range(N), 2):
    if S[i] == S[j]:
        dp[i][j] = dp[i - 1][j - 1] + 1
    else:
        dp[i][j] = 0
    ans = max(ans, min(j - i, dp[i][j]))
print(ans)
a=input()
a=a.sort()
if a=="abc":
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a=input()
if a[0]!=a[1] and a[1]!=a[2] and a[2]!=a[0]:
  print("Yes")
else:
  print("No")
a,b=input().split()
ai=int(a)
b=int(float(b)*100)//1

print(int(a*b/100))


### FIXED CODE ###

a,b=input().split()
ai=int(a)
bi=int(float(b)*100)//1
bi=int(b.replace('.',''))

print(ai*bi//100)
import collections


def solve(string):
    n, v = map(int, string.split())
    if len(set(v)) == 1:
        return str(n // 2)
    else:
        odds = v[1::2]
        _o = collections.Counter(odds)
        r_o = {str(v): k for k, v in _o.items()}
        evens = v[::2]
        _e = collections.Counter(evens)
        r_e = {str(v): k for k, v in _e.items()}
        ans1 = 0
        tmp = max(_o.values())
        ans1 += len(odds) - tmp
        key = r_o[str(tmp)]
        if key in _e.keys():
            _e[key] = 0
        ans1 += len(evens) - max(_e.values())

        ans2 = 0
        _o = collections.Counter(odds)
        r_o = {str(v): k for k, v in _o.items()}
        _e = collections.Counter(evens)
        r_e = {str(v): k for k, v in _e.items()}
        tmp = max(_e.values())
        ans2 += len(evens) - tmp
        key = r_e[str(tmp)]
        if key in _o.keys():
            _o[key] = 0
        ans2 += len(evens) - max(_o.values())

        return str(min(ans1, ans2))


if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

import collections
n = int(input())
v = input().split(" ")
"""
n = 10000
# v = [_i % 10 for _i in range(n)]
v = [_i for _i in range(n)]
n = 10
v = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2]
"""
if len(set(v)) == 1:
    print(n // 2)
else:
    odds = v[1::2]
    _o = collections.Counter(odds)
    r_o = {str(v): k for k, v in _o.items()}
    evens = v[::2]
    _e = collections.Counter(evens)
    r_e = {str(v): k for k, v in _e.items()}
    ans1 = 0
    tmp = max(_o.values())
    ans1 += len(odds) - tmp
    key = r_o[str(tmp)]
    if key in _e.keys():
        _e[key] = 0
    ans1 += len(evens) - max(_e.values())

    ans2 = 0
    _o = collections.Counter(odds)
    r_o = {str(v): k for k, v in _o.items()}
    _e = collections.Counter(evens)
    r_e = {str(v): k for k, v in _e.items()}
    tmp = max(_e.values())
    ans2 += len(evens) - tmp
    key = r_e[str(tmp)]
    if key in _o.keys():
        _o[key] = 0
    ans2 += len(evens) - max(_o.values())

    print(min(ans1, ans2))
import math

input()
a_list = [int(s) for s in input().split()]
N = len(a_list)

min_last_hp = None

for start in range(N):
    for c in range(start+1, N):
        last_hp = math.gcd(a_list[start], a_list[c])
        if min_last_hp == None:
            min_last_hp = last_hp
        if last_hp < min_last_hp:
            min_last_hp = last_hp

print(min_last_hp)


### FIXED CODE ###

# import math
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

input()
a_list = [int(s) for s in input().split()]

N = len(a_list)
min_last_hp = 10**10

f = min(a_list)
a_list.remove(f)

for i in a_list:
    last_hp = gcd(f, i)
    if last_hp < min_last_hp:
        min_last_hp = last_hp

s = min(a_list)
kouho=gcd(f,s)
if kouho < min_last_hp:
    print(kouho)
else:
    print(min_last_hp)
N = int(input())
print([0, 1][if N > 105])

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n+1,2):
    co = 0
    for f in range(1,i+1):
        if i % f == 0:
            co += 1
    if co == 8:
        ans += 1
print(ans)
import rs
li = input()
if re.match("^(dream|dreamer|erase|eraser)+$", li):
  print('YSE')
else:
  print('NO')

### FIXED CODE ###

import re
S = input()
'''
メタ文字：
^ = 文字列の先頭、
| = OR
+ = 直前のパターンを1回以上繰り返し、
$ = 文字列の末尾
'''
if re.match("^(dream|dreamer|erase|eraser)+$", S):
    print('YES')
else:
    print('NO')
S=list(input())
T=list(input())
ans_li=[]
for i in range(len(S)-len(T)):
    ans=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            ans+=1
    ans_li.append(ans)
print(min(ans_li))

### FIXED CODE ###

S=list(input())
T=list(input())
ans_li=[]
for i in range(len(S)-len(T)+1):
    ans=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            ans+=1
    ans_li.append(ans)
print(min(ans_li))
N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x "c['AC'])
print("WA x "c['WA'])
print("TLE x "c['TLE'])
print("RE x "c['RE'])

### FIXED CODE ###

N = int(input())

import collections
l = []
for n in range(N):
  S = input()
  l.append(S)

c = collections.Counter(l)


print("AC x " + str(c['AC']))
print("WA x " + str(c['WA']))
print("TLE x " + str(c['TLE']))
print("RE x " + str(c['RE']))
x = int(input())
y = int(input())
z = int(input())

a = z
b = x
c = y

print(a, b, c)

### FIXED CODE ###

x, y, z = map(int, input().split())

print(z, x, y)
import numpy as np

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

A = np.array(A)

A = np.sort(A)

B = np.copy(A)

if A[0] <= 0 and A[n-1] >= 0:
    for i in range(n-1):
        A[i] = min(A[i], -A[i])

    print(np.sum(A[:-1]) * -1 + A[n-1])

    k = n - 2
    a = B[0]
    while B[k] >= 0:
        print(a, B[k])
        a = a - B[k]
        k -= 1
        if k == 0:
            break

    b = B[n-1]

    while k != 0:
        print(b, B[k])
        b = b - B[k]
        k -= 1

    print(b, a)

elif A[n-1] < 0:
    A[n-1] = A[n-1] - A[n-2]
    A[n-2] = 0
    for i in range(n-1):
        A[i] = min(A[i], -A[i])

    print(np.sum(A[:-1]) * -1 + A[n-1])

    a = B[n-1]
    for i in range(n-1):
        print(a, B[i])
        a = a - B[i]

else:
    A[0] = A[0] - A[1]
    A[1] = 0
    for i in range(n-1):
        A[i] = min(A[i], -A[i])

    print(np.sum(A[:-1]) * -1 + A[n-1])

    k = n - 2
    a = B[0]
    while B[k] >= 0:
        print(a, B[k])
        a = a - B[k]
        k -= 1
        if k == 0:
            break

    b = B[n-1]

    while k != 0:
        print(b, B[k])
        b = b - B[k]
        k -= 1

    print(b, a)


### FIXED CODE ###

import numpy as np

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

A = np.array(A)

A = np.sort(A)

B = np.copy(A)
if n == 2:
    print(A[1] - A[0])
    print(A[1], A[0])

elif A[0] <= 0 and A[n-1] >= 0:
    for i in range(n-1):
        A[i] = min(A[i], -A[i])

    print(np.sum(A[:-1]) * -1 + A[n-1])

    k = n - 2
    a = B[0]
    while B[k] >= 0:
        print(a, B[k])
        a = a - B[k]
        k -= 1
        if k == 0:
            break

    b = B[n-1]

    while k != 0:
        print(b, B[k])
        b = b - B[k]
        k -= 1

    print(b, a)

elif A[n-1] < 0:
    A[n-1] = A[n-1] - A[n-2]
    A[n-2] = 0
    for i in range(n-1):
        A[i] = min(A[i], -A[i])

    print(np.sum(A[:-1]) * -1 + A[n-1])

    a = B[n-1]
    for i in range(n-1):
        print(a, B[i])
        a = a - B[i]

else:
    A[0] = A[0] - A[1]
    A[1] = 0
    for i in range(n-1):
        A[i] = min(A[i], -A[i])

    print(np.sum(A[:-1]) * -1 + A[n-1])

    k = n - 2
    a = B[0]
    while B[k] >= 0:
        print(a, B[k])
        a = a - B[k]
        k -= 1
        if k == 0:
            break

    b = B[n-1]

    while k != 0:
        print(b, B[k])
        b = b - B[k]
        k -= 1

    print(b, a)
N = int(input())
ans = 0
for i in range(1, N + 1)
	if len(str(i)) % 2 == 1:
    	ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
cnt = 0
for i in range(1, n + 1):
  if len(str(i)) % 2 == 1:
    cnt +=1
print(cnt)
import numpy as np
N=int(input())
div = np.zeros(N+1, np.int64)
for n in range(1, N+1):
  for m in range(n, N+1, n):
    div[m] += 1
print(sum(div))

### FIXED CODE ###

n = int(input())
c = 0
for i in range(1,n):
    c+=(n-1)//i
print(c)
import math
N = int(input())
A = list(map(int, input().split()))

A.sort()
if A[0] == A[1]:
    cnt = N-1
else:
    cnt = N

for i in range(1, N):
    for j in range(i):
        if A[i] % A[j] == 0:
            cnt -= 1
            break

print(cnt)
        


### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))

A.sort()
max_num = A[-1]
counter = Counter(A)
s = set()
cnt = 0
for a in A:
    if a in s:
        continue
    if counter[a] == 1:
        cnt += 1
    idx = 1
    while a * idx <= max_num:
        s.add(a * idx)
        idx += 1
print(cnt)
if n%2==0:
  print(n)
else:
  print(n*2)

### FIXED CODE ###

n = int(input())
if n%2==0:
  print(n)
else:
  print(n*2)
N = int(input())
A = [int(i) for i in input().split()]
 
sub = [A[i]-(i+1) for i in range(N)]
res = 0

if N % 2 != 0:
    b = sub[int(N-1/2)+1]
    res = 0
    for i in range(N):
        res += abs(A[i]-(b+i+1))
else:
    b1 = sub[int(N-1/2)]
    b2 = sub[int(N-1/2)+1]
    res1 = 0
    for i in range(N):
        res1 += abs(A[i]-(b1+i+1))
    res2 = 0
    for i in range(N):
        res2 += abs(A[i]-(b2+i+1))
    res = min(res1,res2)

print(res)

### FIXED CODE ###

import collections
 
N = int(input())
A = [int(i) for i in input().split()]
 
sub = [A[i]-(i+1) for i in range(N)]
res = 0
sub = sorted(sub)
b = sub[int(N/2)]
 
res = 0
for i in range(N):
    res += abs(A[i]-(b+i+1))
 
print(res)
a = list(map(int,input().split()))
a.sort()
if a[0] == 5 and a[1] == 5 amd a[2] == 7:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a = list(map(int,input().split()))
a.sort()
if a[0] == 5 and a[1] == 5 and a[2] == 7:
  print("YES")
else:
  print("NO")
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]

for i in range(N):
    a = A.copy()
    del a[i]
    print(max(a))

### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
a = sorted(A.copy())
a1 = a[len(A)-1]
a2 = a[len(A)-2]

for i in A:
    if i == a1:
        print(a2)
    else:
        print(a1)
N, A, B=map(int, input().split())
ans=(N-N%(A+B))*A/(A+B)+min(A,N%(A+B))
print(int(round(ans)))


### FIXED CODE ###

S = str(input())
flag=1
if S[0]==S[1]:
    if S[1]==S[2]:
        flag=0
if flag==1:
    print('Yes')
else:
    print('No')
list = [int(i) for i in input().split()]
L = sort.list()
print(' '.join([str(i) for i in L]))

### FIXED CODE ###

L = [int(i) for i in input().split()]
print(' '.join([str(i) for i in sorted(L)]))
x = int(input())
y = int(input())
z = int(input())
k = int(input())
a = list(map(int,[input() for i in range(x)]))
b = list(map(int,[input() for i in range(y)]))
c = list(map(int,[input() for i in range(z)]))
d = []
for i in a:
  for j in b:
    for k in c:
      d.append(i+j+k)
d.sort(reverse=True)
for i in range(k):
  print(d[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.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
q = []
heapq.heapify(q)
heapq.heappush(q,(-(A[0] + B[0] + C[0]),0,0,0))
for _ in range(K):
    m, i, j, k = heapq.heappop(q) #mに和、ijkにインデックス
    print(-m) #親から取り出すが、親は子よりも小さい、大きい順にするために-を入れている
    if i + 1 < X: #最初にiには０が挿入されている,pythonではインデックスが０から始まるから<xでいい
        s = (-(A[i+1] + B[j] + C[k]), i+1, j, k)
        if s not in q:
            heapq.heappush(q,s)
    if j + 1 < Y:
        s = (-(A[i] + B[j+1] + C[k]), i, j+1, k)
        if s not in q:
            heapq.heappush(q, s)
    if k + 1 < Z:
        s = (-(A[i] + B[j] + C[k+1]), i, j, k+1)
        if s not in q:
            heapq.heappush(q,s)
import bisect
import math

n,m = map(int,input().split())
a = [int(i) for i in input().split()]

a.sort(reverse=True)

ans=[math.ceil(-a[0]/2)]
num = 0
now = 1

if n == 1:
    print(a[0] // 2**m)
    exit()
    
for i in range(m-1):
    #print(ans[0],a[now],now,ans)
    if ans[0] <= -a[now]:
        tmp = math.ceil(ans[0] / 2)
        idx = bisect.bisect_right(ans,tmp)
        #print(ans,idx,tmp)
        ans.insert(idx,tmp)
        del ans[0]
    else:
        ans.append(math.ceil(-a[now]/2))
        now += 1
#print(ans,ans,ans,ans)
        
if len(ans) == len(a):
    print(-sum(ans))
    exit()
        
print(-sum(ans)+sum(a[len(ans):]))
exit()
for i in range(1,n):
 if num >= m:
   break
 if -a[i]>=ans[-1]: #i番目の要素がansの最小値以下であればansに付け加える
   ans.append(-a[i]//2)
   num+=1
 else:
   pos=bisect.bisect_right(ans,-a[i]) #i番目の要素以下の値で、最も大きい値の位置を求める
   ans[pos]=-a[i] #その位置の値をi番目の要素と置き換える

print(ans)
print(-sum(ans))
exit()

a = [-a]
print(a)
exit()

tmp = a[0] // 2

del a[0]

idx = bisect.bisect_right(a,tmp)
a.insert(idx,tmp)
print(a,idx)
exit()

if a[0] >= a[1]:
    a[0] = a[0] // 2
else:
    a[1] = a[1] // 2
    
print(a)

### FIXED CODE ###

import bisect
import math

n,m = map(int,input().split())
a = [int(i) for i in input().split()]

a.sort(reverse=True)

ans=[math.ceil(-a[0]/2)]
num = 0
now = 1

if n == 1:
    print(a[0] // 2**m)
    exit()
    
for i in range(m-1):
    #print(ans[0],a[now],now,ans)
    if now >= n:
        tmp = math.ceil(ans[0] / 2)
        idx = bisect.bisect_right(ans,tmp)
        #print(ans,idx,tmp)
        ans.insert(idx,tmp)
        del ans[0]
        continue
    if ans[0] <= -a[now]:
        tmp = math.ceil(ans[0] / 2)
        idx = bisect.bisect_right(ans,tmp)
        #print(ans,idx,tmp)
        ans.insert(idx,tmp)
        del ans[0]
    else:
        ans.append(math.ceil(-a[now]/2))
        now += 1
#print(ans,ans,ans,ans)
        
if len(ans) == len(a):
    print(-sum(ans))
    exit()
        
print(-sum(ans)+sum(a[len(ans):]))
exit()
for i in range(1,n):
 if num >= m:
   break
 if -a[i]>=ans[-1]: #i番目の要素がansの最小値以下であればansに付け加える
   ans.append(-a[i]//2)
   num+=1
 else:
   pos=bisect.bisect_right(ans,-a[i]) #i番目の要素以下の値で、最も大きい値の位置を求める
   ans[pos]=-a[i] #その位置の値をi番目の要素と置き換える

print(ans)
print(-sum(ans))
exit()

a = [-a]
print(a)
exit()

tmp = a[0] // 2

del a[0]

idx = bisect.bisect_right(a,tmp)
a.insert(idx,tmp)
print(a,idx)
exit()

if a[0] >= a[1]:
    a[0] = a[0] // 2
else:
    a[1] = a[1] // 2
    
print(a)
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right - left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)

### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
 
count = 0
for key in T:
    left = 0
    right = n
    while left < right:
        mid = (right + left) // 2
        if S[mid] == key:
            count = count + 1
            break
        if key < S[mid]:
            right = mid
        else:
            left = mid + 1
print(count)
= int(input())
a = list(map(int, input().split()))
print(len([i for i, ai in enumerate(a) if i%2 and ai%2]))

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
print(len([i for i, ai in enumerate(a) if i%2==0 and ai%2]))
N = int(input())
L = [0] * N
L[0] = 2
L[1] = 1

for i in range(2, N):
  L[i] = L[i-1] + L[i-2]

print(L[N-1])

### FIXED CODE ###

N = int(input())
L = [0] * (N + 1)
L[0] = 2
L[1] = 1
 
for i in range(2, N+1):
  L[i] = L[i-1] + L[i-2]
 
print(L[N])
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = []
ans = 0
for i in range(n):
    arr = list(map(int,input().split()))
    a.append(arr)
for i in a:
    tmp = c
    for j in range(n+1):
        tmp += i[j]*b[j]
    if tmp > 0:ans+=1
print(ans)

### FIXED CODE ###

n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = []
ans = 0
for i in range(n):
    arr = list(map(int,input().split()))
    a.append(arr)
for i in a:
    tmp = c
    for j in range(m):
        tmp += i[j]*b[j]
    if tmp > 0:ans+=1
print(ans)
from math import ceil
N, K = map(int, input().split)
nums = list(map(int, input().split))
index = nums.index(1)
print(ceil(index / (K - 1)) + ceil((N - index - 1) / (K - 1)))

### FIXED CODE ###

import math
N, K = map(int, input().split())
nums = input()
print(math.ceil((N - 1) / (K - 1)))
a = map(int,input().split())

for i in a:
  if a.count(i) > 1:
    print(i)
    break

### FIXED CODE ###

a = list(map(int,input().split()))
 
for i in a:
  if a.count(i) <= 1:
    print(i)
    break
import sys
sys.setrecursionlimit(10**7)
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
    u,v=map(int,input().split())
    u,v=u-1,v-1
    g[u].append(v)
mi=set(range(n))
flg=False
def dfs(v,seen):
    mi.discard(v)
    for nv in g[v]:
        if seen[nv]!=-1:# 巡回閉路
            seen[nv]=v
            return nv
        else:
            seen[nv]=v
            t=dfs(nv,seen)
            if t!=-1:return t
            seen[nv]=-1
    return -1
while mi:
    v=mi.pop()
    seen=[-1]*n
    f=dfs(v,seen)
    if f!=-1:break
if f==-1:
    print(-1)
    exit()
ff=f
path={f}
while seen[f] not in path:
    f=seen[f]
    path.add(f)

#print(seen,path,ff)
from collections import deque
todo=deque([ff])
seen=[[-1,-1] for _ in '_'*n]
d=0
seen[ff][1]=d
flg=False
start=[-1,-1]
while todo:
    v=todo.popleft()
    d+=1
    for nv in g[v]:
        if nv in path:
            if seen[nv][1]!=-1:
                seen[nv][0]=v
                if start[0]==-1:
                    start=[nv,seen[nv][1]]
                else:
                    if start[1]<seen[nv][1]:
                        start=[nv,seen[nv][1]]
                flg=True
            else:
                todo.append(nv)
                seen[nv]=[v,d]
    if flg:break
s=start[0]
ans=[s+1]
nv=s
#print(seen,nv)
cnt=0
while seen[nv][0]!=s:
    nv=seen[nv][0]
    ans.append(nv+1)
    if cnt>n:print(hoge)
    cnt+=1

print(len(ans))
print(*ans,sep='\n')


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
  u,v=map(int,input().split())
  u,v=u-1,v-1
  g[u].append(v)
mi=set(range(n))
flg=False
def func(path):
  chk=set(path)
  if len(path)!=2:
    for i,v in enumerate(path):
      nvs=[nv for nv in g[v] if nv in chk]
      if len(nvs)==1:continue
      for nv in nvs:
        if nv==path[(i+1)%len(path)]:continue
        ary=[nv]
        for j,vj in enumerate(path):
          if vj==nv:break
        if i>j:
          ary=path[j:i+1]
        else:
          ary=path[:i+1]+path[j:]
        #print(path,ary,i,j)
        func(ary)
  print(len(path))
  for v in path:
    print(v+1)
  exit()

def dfs(v,seen):
  mi.discard(v)
  for nv in g[v]:
    if seen[nv]!=-1:# 巡回閉路
      seen[nv]=v
      path=[v]
      chk={v}
      while seen[v] not in chk:
        v=seen[v]
        path.append(v)
        chk.add(v)
      path.reverse()
      func(path)
    else:
      seen[nv]=v
      dfs(nv,seen)
      seen[nv]=-1
while mi:
  v=mi.pop()
  seen=[-1]*n
  dfs(v,seen)
print(-1)
exit()
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

R = i()
G = i()print(R+(G-R)*2)

### FIXED CODE ###

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

R = i()
G = i()
print(R+(G-R)*2)
import itertools
N = int(input())

ans = [0]*(10**4)
for i1 in range(1, 500):
    i2 = i1+1
    i3 = i1+2
    L = list(itertools.combinations_with_replacement((i1, i2, i3), 3))
    for i in L:
        i = list(i)
        x = i[0]
        y = i[1]
        z = i[2]
        n = (x**2)+(y**2)+(z**2)+(x*y)+(y*z)+(z*x)
        if n > 10**4:
            break
        if len(list(set(i))) == 1:
            ans[n] += 1
        if len(list(set(i))) == 2:
            ans[n] += 3
        if len(list(set(i))) == 3:
            ans[n] += 6
        
for k in range(1, N+1):
    print(ans[k])

### 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])