Harryxun/stf_run huggingface dataset:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()
a = na()
cb = []
for i in range(m):
    b, c = na()
    cb.append([c, b])

a.sort()
cb.sort(reverse=True)

cur = 0
for i in range(n):
    c, b = cb[cur]
    if a[i] < c:
        a[i] = c
        b -= 1
        if b == 0:
            cur += 1
        cb[cur][1] = b
    else:
        break

print(sum(a))

### FIXED CODE ###

import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()
a = na()
cb = []
for i in range(m):
    b, c = na()
    cb.append([c, b])

a.sort()
cb.sort(reverse=True)

cur = 0
for i in range(n):
    if cur >= len(cb):
        break
    c, b = cb[cur]
    if a[i] < c:
        a[i] = c
        b -= 1
        cb[cur][1] = b
        if b == 0:
            cur += 1
    else:
        break

print(sum(a))
import math
n = int(input())
lis = []
for i in range(n):lis.append(int(input()))
if lis[0] != 0:
    print("-1")
    exit()
cou = 0
print(lis,cou)
for k in range(n-1):
    if lis[n-(k+1)] > lis[n-(k+2)]:
        cou += math.ceil(lis[n-(k+1)] / (lis[n-(k+2)]+1))
        lis[n-(k+1)] = 0
    else:
        cou += lis[n-(k+1)]
        lis[n-(k+2)] -= lis[n-(k+1)]-1
        lis[n-(k+1)] = 0
    print(lis,cou)
print(cou)

### FIXED CODE ###

n = int(input())
lis = [int(input()) for i in range(n)]
if lis[0] != 0:print(-1);exit()
ans = 0
for i in range(n-1,0,-1):
    if lis[i] - lis[i-1] > 1:print(-1);exit()
    elif lis[i] - lis[i-1] == 1:ans += 1
    else:ans += lis[i]
print(ans)
n = int(input())

data = dict()

for i in range(1, n + 1):
  city, score = input().split()
  data[city] = [int(score), i]

for key in sorted(data.keys()):
  for _, num in sorted(data[key], key=lambda x: -x[0]):
    print(num)

### FIXED CODE ###

n = int(input())

scores = []
for i in range(1, n+1):
    c, s = input().split()
    scores.append(("{0}{1}{2:03d}".format(c, "0" * (10 - len(c)), 101 - int(s)), i))

for c, ind in sorted(scores):
    print(ind)
def judge(a, b):
    k = 0
    while 2 ** k  - 1 <= a + b:
        if 2 ** k - 1 == a + b:
            return True
        k += 1
    return False

L = int(input(),2)
count = (L + 1) * 2 - 1
for i in range(1,L + 1):
    for j in range(1,L - i + 1):
        if Judge(i, j):
            count += 1


print(count % (10 ** 9 + 7))

### FIXED CODE ###

L = input()
#dp1[k] := k桁目までを確定させ、その時点でA+BがL以下が確定
#dp2[k] := k桁目までを確定させ、その時点でA+BがL以下が確定していない
dp1 = [0 for i in range(len(L))]
dp2 = [0 for i in range(len(L))]
mod = 10**9 + 7
dp1[0] = 1 # A,Bの最上位bitが(0,0)
dp2[0] = 2 # A,Bの最上位bitが(0,1), (1,0)の二通り
#最上位bitを(1,1)にしてしまうと、Lを超えてしまうのでない
for i in range(1,len(L)):
    #dp1の更新から行う
    if L[i] == '1':
        dp1[i] = dp1[i-1] * 3 + dp2[i-1]
        dp2[i] = dp2[i-1] * 2
    else:
        dp1[i] = dp1[i-1] * 3
        dp2[i] = dp2[i-1]
    dp1[i] %= mod
    dp2[i] %= mod
print((dp1[-1] + dp2[-1]) % mod)
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = -float('inf')
for i in range(n):
    s = []
    j = p[i]-1 
    s.append(c[j])
    while j != i:
        j = p[j]-1
        s.append(s[-1]+c[j])
    l = len(s)
    if k <= l:
        a = max(s[:k])
    elif s[-1] <= 0:
        a = max(s)
    else:
        w, r = divmod(k, l)
        a1 = s[-1]*(w-1) + max(s)
        a2 = s[-1]*w + max(0, max(s[:r]))
        a = max(a1, a2)
    ans = max(ans, a)
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = -float('inf')
for i in range(n):
    s = []
    j = p[i]-1 
    s.append(c[j])
    while j != i:
        j = p[j]-1
        s.append(s[-1]+c[j])
    l = len(s)
    if k <= l:
        a = max(s[:k])
    elif s[-1] <= 0:
        a = max(s)
    else:
        w, r = divmod(k, l)
        a1 = s[-1]*(w-1) + max(s)
        a2 = s[-1]*w
        if r != 0:
            a2 += max(0, max(s[:r]))
        a = max(a1, a2)
    ans = max(ans, a)
print(ans)

'''

n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = -float('inf')
for i in range(n):
    j = p[i] - 1
    s = [c[j]]
    while j != i:
        j = p[j] - 1
        s.append(s[-1] + c[j])
    l = len(s)
    if k <= l:
        score = max(s[:k])
    elif s[-1] <= 0:
        score = max(s)
    else:
        w, r = divmod(k, l)
        score1 = s[-1] * (w - 1)
        score1 += max(s)
        score2 = s[-1] * w
        if r != 0:
            score2 += max(0, max(s[:r]))
        score = max(score1, score2)

    ans = max(ans, score)

print(ans)
'''
ts = input().split(" ")
stack = []
for t in ts:
    if t not in ("-", "+", "*"):
        stack.push(int(t))
    else:
        n2 = stack.pop()
        n1 = stack.pop()
        if t == "-":
            stack.push(n1 - n2)
        elif t == "+":
            stack.push(n1 + n2)
        else:
            stack.push(n1 * n2)
print(stack.pop())

### FIXED CODE ###

ts = input().split(" ")
stack = []
for t in ts:
    if t not in ("-", "+", "*"):
        stack.append(int(t))
    else:
        n2 = stack.pop()
        n1 = stack.pop()
        if t == "-":
            stack.append(n1 - n2)
        elif t == "+":
            stack.append(n1 + n2)
        else:
            stack.append(n1 * n2)
print(stack.pop())
r = float(input())
print(float(r*r*math.pi),float(2*r*math.pi))


### FIXED CODE ###

from math import pi
r = float(input())
print("{:.010f} {:.010f}".format(r * r * pi, 2 * pi * r))
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
import math
import bisect
import numpy as np
from collections import defaultdict, deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
# MOD = 10 ** 9 + 7
INF = float("inf")


def dijkstra(s, n, graph):
    dist = [INF] * n
    visited = [False] * n
    dist[s] = 0
    hq = [(0, s)]  # (重み，頂点)
    while hq:
        di, pi = heappop(hq)
        visited[pi] = True
        for dj, pj in graph[pi]:
            if visited[pj]:
                continue
            if dist[pj] > di + dj:
                dist[pj] = di + dj
                heappush(hq, (dist[pj], pj))
    return dist


def main():
    N, M = map(int, input().split())
    graph = [[] for _ in range(N)]
    edge = []
    for _ in range(M):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        graph[a].append((1, b))
        graph[b].append((1, a))
        edge.append((a, b))
    cnt = 0
    for a, b in edge:
        graph[a].remove((1, b))
        graph[b].remove((1, a))
        d = dijkstra(0, N, graph)
        if INF in d:
            cnt += 1
        graph[b].append((1, a))
        graph[a].append((1, b))
    print(cnt)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict, deque
import sys
input = sys.stdin.readline


def bfs(s, n, g):
    dist = [-1] * n
    dist[s] = 0
    que = deque([])
    que.append(s)
    while que:
        v = que.popleft()
        for nv in g[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v] + 1
            que.append(nv)
    if -1 in dist:
        return True
    else:
        return False


def main():
    n, m = map(int, input().split())
    g = [[] for _ in range(n)]
    gg = []
    for _ in range(m):
        a, b = [int(i) - 1 for i in input().split()]
        g[a].append(b)
        g[b].append(a)
        gg.append((a, b))
    ans = 0
    for a, b in gg:
        g[a].remove(b)
        g[b].remove(a)
        if bfs(0, n, g):
            ans += 1
        g[a].append(b)
        g[b].append(a)
    print(ans)
    return


if __name__ == "__main__":
    main()
l, r = map(int, list(input().split()))

if r - l >= 2018:
    print(0)

else:
    array = range(l, r + 1, 1)
    kouho = 2018
    for i in array:
        for j in array:
            if i != j:
                mod = (i * j) % 2019
                if kouho > mod:
                    kouho = mod

print(kouho)

### FIXED CODE ###

l, r = map(int, list(input().split()))

if r - l >= 2018:
    print(0)

else:
    array = range(l, r + 1, 1)
    kouho = 2018
    for i in array:
        for j in array:
            if i != j:
                mod = (i * j) % 2019
                if kouho > mod:
                    kouho = mod

    print(kouho)
while True:
	x = raw_input()
	i += 1
	if x == '0':
		break
	print 'Case ' + str(i) + ': ' + str(x)

### FIXED CODE ###

i = 0
while 1:
	foo = raw_input()
	i += 1
	if foo == '0':break
	print 'Case %s: %s'%(i,foo)
a = [str(item) for item in input().split()]
seki = a[0] * a[1]

if seki / 2 == 0:
    print('Odd')
else:
    print('Even')

### FIXED CODE ###

a = [int(item) for item in input().split()]
seki = a[0] * a[1]
if seki % 2 == 0:
    print('Even')
else:
    print('Odd')
ans = 0
s = []
for i in range(int(input())):
  a,b = map(int,input().split())
  if a==b:
    ans += 1
    s.append(ans)
  else:
    ans = 0
if max(s)>=3:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

ans = 0
s = []
for i in range(int(input())):
  a,b = map(int,input().split())
  if a==b:
    ans += 1
    s.append(ans)
  else:
    ans = 0
if len(s)!=0 and max(s)>=3:
  print('Yes')
elif len(s)==0:
  print('No')
else:
  print('No')
# input
N, M, K = map(int, input().split())

Frends = [[] for _ in range(N)]
Fs = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Frends[a].append(b)
    Frends[b].append(a)
    if a < b:
        Fs[a].append[b]
    else:
        Fs[b].append[a]

Blocked = [[] for _ in range(N)]
for _ in range(K):
    c, d = map(int, input().split())
    c -= 1
    d -= 1
    Blocked[c].append(d)
    Blocked[d].append(c)

# process
# 友人グループを作成
fg = []
for i in range (N):
    l = Fs[i] 
    if len(l) == 0:
        continue

    l.append(i)
    s = set(l)

    t = -1
    j = 0
    fglen = len(fg)
    while j < fglen:
        sfg = s&fg[j]
        if len(sfg) > 0:
            if t < 0:
                t = j
                fg[j] |= s
            else:
                fg[t] |= fg[j]
                fg.pop(j)
                fglen -= 1
        j += 1

    if t < 0:
        fg.append(s)

# 友人候補を抽出、カウント
cand = [0 for _ in range(N)]
for g in fg:
    for f in g:
        cand[f] = len(g)-len(Frends[f])-len(set(Blocked[f])&g)-1

# output
#print(fg)
print(" ".join(map(str, cand)))


### FIXED CODE ###

# input
N, M, K = map(int, input().split())

Friends = [set() for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Friends[a].add(b)
    Friends[b].add(a)

Blocked = [set() for _ in range(N)]
for _ in range(K):
    c, d = map(int, input().split())
    c -= 1
    d -= 1
    Blocked[c].add(d)
    Blocked[d].add(c)

# process
# 友人グループを作成
checked = set()
ans = [0]*N

for i in range (N):
    if i in checked:
        continue
    
    fg = set()

    stack = list(Friends[i])
    while stack:
        f = stack.pop()
        if f in checked:
            continue

        checked.add(f)
        fg.add(f)
        stack.extend(Friends[f])

    for f in fg:
        ans[f] += len(fg)-1-len(fg&(Friends[f]|Blocked[f]))

# output
print(" ".join(map(str, ans)))
a, b = input().split()
if int(a) =< 9:
  ans = int(b) + 100 * (10 - int(a))
  print(ans)
else:
  print(b)
 

### FIXED CODE ###

a, b = input().split()
if int(a) <= 9:
  ans = int(b) + 100 * (10 - int(a))
  print(ans)
else:
  print(b)
s = input()
dp = [0 for _ in range(13)]
dp[0] = 1
c = 1000000007
m = 1
r13 = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
r10 = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
for i in range(len(s) - 1, -1, -1):
    ndp = [0 for _ in r13]
    if s[i] == "?":
        for j in r10:
            jm = j * m
            for k in r13:
                index = (jm + k) % 13
                ndp[index] = (ndp[index] + dp[k]) % c
    else:
        jm = int(s[i]) * m
        for k in r13:
            index = (jm + k) % 13
            ndp[index] = (ndp[index] + dp[k]) % c
    dp = ndp[:]
    m = m * 10 % 13
print(dp[5])


### FIXED CODE ###

A, B = map(int, input().split())
if (A + B) % 2 != 0:
    print("IMPOSSIBLE")
else:
    print((A + B) // 2)
N = int(input())

info = []
for _ in range(N):
    x, y, h = map(int, input().split())
    if h > 0:
        info.append([h, x, y])

info.sort(reverse=True)

for c_x in range(101):
    for c_y in range(101):
        H = info[0][0] + abs(info[0][1] - c_x) + abs(info[0][2] - c_y)
        flag = True
        for i in range(1, N):
            if info[i][0] != H - abs(info[i][1] - c_x) - abs(info[i][2] - c_y):
                flag = False
                break

        if flag:
            print(*[c_x, c_y, H])
            exit()

### FIXED CODE ###

N = int(input())

info = []
for _ in range(N):
    x, y, h = map(int, input().split())
    info.append([h, x, y])

info.sort(reverse=True)

for c_x in range(101):
    for c_y in range(101):
        H = info[0][0] + abs(info[0][1] - c_x) + abs(info[0][2] - c_y)
        flag = True
        for i in range(1, N):
            if info[i][0] != max(H - abs(info[i][1] - c_x) - abs(info[i][2] - c_y), 0):
                flag = False
                break

        if flag:
            print(*[c_x, c_y, H])
            exit()
import math
n=int(input())
l=[int(input()) for i in range(5)]
print(mat.ceil(n/min(l))+4)

### FIXED CODE ###

import math
n=int(input())
l=[int(input()) for i in range(5)]
print(math.ceil(n/min(l))+4)
a = int(input())
b = int(input())

if (a*b)%2 == 1:
	print("Even")
else:
	print("Odd")


### FIXED CODE ###

list = input().split()
a = int(list[0])
b = int(list[1])

if (a*b)%2 == 0:
	print("Even")
else:
	print("Odd")
n,l = map(int,input().split())
s = sorted([input() for i in range(n)] )
print(*s,sep="")

### FIXED CODE ###

a = list(map(int,input().split()))
b = [x for x in a if x !=" "]
c = sorted(b)
d =[5,5,7]
print("YES" if c == d else "NO")
n = int(input())
A = list(map(int, input().split()))

dp = [0] * (2*(10**5) + 1)

for a in A:
    dp[a] += 1

for i in range(1, len(dp)):
    if dp[i]:
        for j in range(i+i, len(dp), i):
            dp[j] = 0
print(dp.count(1))


### FIXED CODE ###

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

dp = [0] * (10**6+1)

for a in A:
    dp[a] += 1

for i in range(1, len(dp)):
    if dp[i]:
        for j in range(i+i, len(dp), i):
            dp[j] = 0
print(dp.count(1))
def main():
    from bisect import bisect_right as br
    n = int(input())
    a = sorted(list(map(int, input().split())))
    b = sorted(list(map(int, input().split())))
    #n = 10000 #
    #a = [i+1 for i in range(n)] #
    #b = [2*i+2 for i in range(n)] #
    m = n % 2
    xor = 0
    for i in b:
        xor ^= i
    for i in range(n):
        b[i] = -b[i]

    ans = 0
    for loop in range(28, -1, -1):
        j = 2**loop
        k = (xor & j) // j
        for i in range(i):
            b[i] = b[i] % j
        b.sort()
        x = k*m % 2
        b0 = br(b, 0)
        for i in a:
            k2 = m * (i & j) // j
            x += (k2 + br(b, i % j) - b0) % 2
        x %= 2
        ans += x*j
    print(ans)


main()

### FIXED CODE ###

def main():
    from bisect import bisect_right as br
    n = int(input())
    a = sorted(list(map(int, input().split())))
    b = sorted(list(map(int, input().split())), reverse=True)
    m = n % 2
    xor = 0
    for i in b:
        xor ^= i
    for i in range(n):
        b[i] = 2**28 - b[i]
    ans = 0
    for loop in range(28, -1, -1):
        j = pow(2, loop)
        k = (xor & j) // j
        temp = br(b, j-1)
        for i in range(temp, n):
            b[i] -= j
        b.sort()
        temp = br(a, j-1)
        for i in a[:temp]:
            k += (i & j) // j
        for i in range(temp, n):
            k += (a[i] & j) // j
            a[i] -= j
        x = (k+br(b, 0))*m % 2
        a.sort()
        l = 0
        for i in a:
            while l < n:
                if i >= b[l]:
                    l += 1
                else:
                    break
            x += l % 2
        ans += (x % 2)*j
    print(ans)


main()
n,a,b=map(int,input().split())

list_a="a"*a
list_b="b"*b

list=[]
for i in range(10**100):
    if len(list)>=n:
        break
    else:
        if i%2==0:
            list+=list_a
        else:
            list+=list_b

ans=0
for i in range(n):
    if list[i]=="a":
        ans+=1
    else:
        ()
print(ans)

### FIXED CODE ###

n,a,b=map(int,input().split())
a_l=n//(a+b)
b_l=n%(a+b)
if b_l > a : b_l = a
print(a_l*a+b_l)
# coding: utf-8
# Your code here!
import math
N = int(input())

def divisor(N):
    lst = []
    for i in range(2,math.ceil(math.sqrt(N))+1):
        if N%i == 0:
            lst.append(i)
            #if i != int(N/i):
                #lst.append(int(N/i))
    #lst.sort()
    return lst
    
ans = divisor(N)
#print(ans,len(ans))
if len(ans) > 0:
    A = ans[-1]
else:
    print(N-1)
if A*A < N:
    B = int(N/A)
    print(A+B-2)
else:
    print(2*A-2)
'''
if len(ans)%2 == 0 and len(ans)>1:
    A = ans[len(ans)//2-1]
    B = ans[len(ans)//2]
    #print(A,B)
    print(A+B-2)
elif len(ans)%2 == 1 and len(ans)>1:
    A = ans[len(ans)//2]
    print(2*A-2)
else:
    print(N-1)
'''
  
    

### FIXED CODE ###

# coding: utf-8
# Your code here!
import math
import sys
N = int(input())

def divisor(N):
    lst = []
    for i in range(2,math.ceil(math.sqrt(N))+1):
        if N%i == 0:
            lst.append(i)
            #if i != int(N/i):
                #lst.append(int(N/i))
    #lst.sort()
    return lst
    
ans = divisor(N)
#print(ans,len(ans))
if N == 2:
    print(1)
    sys.exit()
    
if len(ans) > 0:
    A = ans[-1]
    if A*A < N:
        B = int(N/A)
        print(A+B-2)
    else:
        print(2*A-2)
else:
    print(N-1)

'''
if len(ans)%2 == 0 and len(ans)>1:
    A = ans[len(ans)//2-1]
    B = ans[len(ans)//2]
    #print(A,B)
    print(A+B-2)
elif len(ans)%2 == 1 and len(ans)>1:
    A = ans[len(ans)//2]
    print(2*A-2)
else:
    print(N-1)
'''
n = int(input())
print(n - (-n // 1000) * 1000

### FIXED CODE ###

n = int(input())
print(- n - (-n // 1000) * 1000)
n = int(input())
v = list(map(int, input().split()))

v_even = [0]*100000
v_odd = [0]*100000

for i in range(n):
  if i%2==0:
    v_even[v[i]] += 1 
  else:
    v_odd[v[i]] += 1
    
res1 = max(v_even)
res2 = max(v_odd)
if v_even.index(res1) == v_odd.index(res2):
  if res1 >= res2:
    v_odd[v_odd.index(res2)] = 0
    res2 = max(v_odd)
  else:
    v_even[v_even.index(res1)] = 0
    res1 = max(v_even)
print(n//2-res1 + n//2-res2)

### FIXED CODE ###

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

v_even = [0]*100000
v_odd = [0]*100000

for i in range(n):
  if i%2==0:
    v_even[v[i]-1] += 1 
  else:
    v_odd[v[i]-1] += 1
    
res1 = max(v_even)
res2 = max(v_odd)
if v_even.index(res1) == v_odd.index(res2):
  if res1 > res2:
    v_odd[v_odd.index(res2)] = 0
    res2 = max(v_odd)
  elif res2 > res1:
    v_even[v_even.index(res1)] = 0
    res1 = max(v_even)
  elif res1 == res2:
    v_odd[v_odd.index(res2)] = 0
    v_even[v_even.index(res1)] = 0
    res3 = max(v_even)
    res4 = max(v_odd)
    if res3 > res4:
      res1 = res3
    else:
      res2 = res4
      
print(n//2-res1 + n//2-res2)
While True:
    array = input().split(" ")
    a = int(array[0])
    op = array[1]
    b = int(array[2])
    if op == "?":
        break
    elif op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a / /b)
    

### FIXED CODE ###

while True:
    a, op, b = input().split(" ")
    if op == "?":
        break
    elif op == "+":
        print( int(a) + int(b) )
    elif op == "-":
        print( int(a) - int(b) )
    elif op == "*":
        print( int(a) * int(b) )
    elif op == "/":
        print( int(a) // int(b) )
N = int(input())
A = [0] * 10000
for x in range(1, int(pow(N, 0.5))):
    for y in range(1, int(pow(N, 0.5))):
        for z in range(1, int(pow(N, 0.5))):
            value = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if value > 10000:
                break
            A[value] += 1
for a in A[:N]:
    print(a)

### FIXED CODE ###

N = int(input())
A = [0] * 10001
for x in range(1, int(pow(N, 0.5))):
    for y in range(1, int(pow(N, 0.5))):
        for z in range(1, int(pow(N, 0.5))):
            value = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if value > 10000:
                break
            A[value] += 1
for a in A[1:N+1]:
    print(a)
s=int(input())
n=str(s)
t=list(map(int,n))
ans=0
if t[0]==t[1] or t[1]==t[2] or t[2]==t[3]:
    ans='Bad'
else:
    ans='Good'
print(ans)

### FIXED CODE ###

t=input()
ans=0
if t[0]==t[1] or t[1]==t[2] or t[2]==t[3]:
    ans='Bad'
else:
    ans='Good'
print(ans)
a= int(input())
b= int(input())
print(a*b (a+b)2)


### FIXED CODE ###

a,b = map(int, input().split())
print(a*b, 2*(a+b))
S, T = input().split()
return T + S

### FIXED CODE ###

S, T = input().split()
print(T + S)
from math import gcd

A, B, C, D = map(int, input().split())
G = gcd(C, D)
L = C * D // G
ca = (A - 1) // C
cb = B // C
da = (A - 1) // D
db = B // D
la = (A - 1) // L
lb = B // L
div = cb + db - (ca + da) - (lb - la)
print(B - (A - 1) - div)


### FIXED CODE ###

from fractions import gcd

A, B, C, D = map(int, input().split())
G = gcd(C, D)
L = C * D // G
ca = (A - 1) // C
cb = B // C
da = (A - 1) // D
db = B // D
la = (A - 1) // L
lb = B // L
div = cb + db - (ca + da) - (lb - la)
print(B - (A - 1) - div)