Harryxun/stf_run huggingface dataset:
N = int(input())
for i in range(N):
    if N < i**2:
        j = i - 1
        break
print(j**2)

### FIXED CODE ###

N = int(input())
for i in range(N+1):
    if N < i**2:
        j = i - 1
        break
if N == 1:
    print(1)
else:
    print(j**2)
h,w=map(int,input().split())
mas=[[0]*w for _ in range(h)]
cnt=0
for i in range(h):
    if i%2==0:
        for j in range(w)[::2]:
            cnt += 1
    else:
        for j in range(1,w)[::2]:
            cnt += 1
print(cnt)
            

### FIXED CODE ###

h,w=map(int,input().split())
if h==1 or w==1:
    print(1)
else:
    print(-(-(h*w)//2))
s = input()
mod = 10 ** 9 + 7
dp = [[0 for _ in range(13)] for __ in range(len(s) + 1)]
dp[0][0] = 1
for i, si in enumerate(s):
    memo[i+1] = memo[i] * 10 % 13
    if si == '?':
        for n in range(10):
            for j in range(13):
                dp[i+1][(n + j * 10) % 13] += dp[i][j]
    else:
        for j in range(13):
                dp[i+1][(int(si) + j * 10) % 13] += dp[i][j]
    for k in range(13):
      dp[i+1][k] = dp[i+1][k] % mod
print(dp[len(s)][5])


### FIXED CODE ###

s = input()
mod = 10 ** 9 + 7
memo = [0] * (len(s) + 1)
memo[0] = 1
dp = [[0 for _ in range(13)] for __ in range(len(s) + 1)]
dp[0][0] = 1
for i, si in enumerate(s[::-1]):
    memo[i+1] = memo[i] * 10 % 13
    if si == '?':
        for n in range(10):
            a = n * memo[i]
            for j in range(13):
                dp[i+1][(j + a) % 13] = (dp[i+1][(j + a) % 13] + dp[i][j]) % mod
    else:
        a = int(si) * memo[i]
        for j in range(13):
            dp[i+1][(j + a) % 13] = (dp[i+1][(j + a) % 13] + dp[i][j]) % mod
print(dp[len(s)][5])
N = int(input())
S = list(input())
K  = int(input())

l_replace = [s if S[K] in s else '*' for s in S]
print(''.join(l_replace))

### FIXED CODE ###

N = int(input())
S = list(input())
K  = int(input())

l_replace = [s if S[K-1] in s else '*' for s in S]
print(''.join(l_replace))
def insertionSort(A,n,g):
        cnt = 0
        for i in range(g,n):
                v = A[i]
                j = i - g
                while j >= 0 and A[j] > v:
                        A[j+g] = A[j]
                        j = j - g
                        cnt += 1
                        A[j+g] = v
        return cnt
def shellsort(A,n):
        cnt = 0
        h = 1
	G = []
	while h <= 1:
                G.append(h)
                h = 3*h + 1
        G.reverse()

        print(len(G))

        print(" ".join(map(str,G)))
        for i in range(len(G)):
                cnt += insertionSort(A,n,G[i])
        print(cnt)
        for i in A:
                print(i)
n = int(input())
A = []
for _ in range(n):
        A.append(int(input()))
shellsort(A,n)




### FIXED CODE ###

def insertionSort(A,n,g):
    cnt = 0
    for i in range(g,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
            A[j+g] = v
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)
A, B, K = input().split(" ")
A, B, K = int(A), int(B), int(K)

res = []

for i in range(A, 1, -1):
  if A % i == 0 and B % i == 0:
    res.append(i)

print(res[K-1])

### FIXED CODE ###

A, B, K = input().split(" ")
A, B, K = int(A), int(B), int(K)

res = []

for i in range(A, 0, -1):
  if A % i == 0 and B % i == 0:
    res.append(i)

print(res[K-1])
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

MaxValue = 0
if N == 1:
  MaxValue = min(B[0], A[0]+A[1])
  print(MaxValue)
else:
  for i in range(N):
    if A[i] < B[i]:
      MaxValue += A[i]
      if A[i+1] < B[i] - A[i]:
        MaxValue += A[i+i]
        A[i+1] = 0
      else:
        temp = B[i] - A[i]
        MaxValue += temp
        A[i+1] -= temp
    else:
      MaxValue += B[i]
  print(MaxValue)

### FIXED CODE ###

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

MaxValue = 0
if N == 1:
  MaxValue = min(B[0], A[0]+A[1])
  print(MaxValue)
else:
  for i in range(N):
    if A[i] < B[i]:
      #MaxValue += A[i]
      if A[i+1] < B[i] - A[i]:
        MaxValue += A[i+1] + A[i]
        A[i+1] = 0
      else:
        temp = B[i] - A[i]
        MaxValue += B[i]
        A[i+1] -= temp
    else:
      MaxValue += B[i]
  print(MaxValue)
s=input()
for i in map(int, s.split()):
    lis.append(i)
if lis[0]>lis[1]:
    print("safe")
else:
    print("unsafe")

### FIXED CODE ###

s=input()
lis=s.split()
if int(lis[0])>int(lis[1]):
    print("safe")
else:
    print("unsafe")
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.append(10**9+1)
B.append(10**9+1)

Ac = 0
Bc = 0
Time = 0
for _ in range(N+M):
    if A[Ac] > B[Bc]:
        Time += B[Bc]
        Bc += 1
        if Time > K:
            Bc -= 1
            Time -= B[Bc]
            break
    else:
        Time += A[Ac]
        Ac += 1
        if Time > K:
            Ac -= 1
            Time -= A[Ac]
            break
            
print(Ac+Bc)

### FIXED CODE ###

a = int(input())
print(int(a+a*a+a**3))
ULURU

### FIXED CODE ###

N = list(input())
N.insert(0, '')
even = N[2::2]
odd = N[1::2]
if ('R' in even or 'L' in odd):
    print('No')
else:
    print('Yes')
import sys

sys.setrecursionlimit(100000)


def dfs(cur, dep=0):
    if cur == -1:
        x = l - dep
        return x & -x
    return dfs(trie[cur][0], dep + 1) ^ dfs(trie[cur][1], dep + 1)


n, l = map(int, input().split())
trie = [[-1, -1] for _ in range(100001)]
idx = 1
for s in (input() for _ in range(n)):
    cur = 0
    for c in map(int, s):
        if trie[cur][c] == -1:
            trie[cur][c] = idx
            idx += 1
        cur = trie[cur][c]

xor = dfs(trie[0][0]) ^ dfs(trie[0][1])
print('Alice' if xor else 'Bob')


### FIXED CODE ###

import sys

sys.setrecursionlimit(100000)


def dfs(cur, dep=0):
    if cur == -1:
        x = l - dep
        return x & -x
    return dfs(trie[cur][0], dep + 1) ^ dfs(trie[cur][1], dep + 1)


n, l = map(int, input().split())
trie = [[-1, -1] for _ in range(100001)]
idx = 1
for s in (input() for _ in range(n)):
    cur = 0
    for c in map(int, s):
        if trie[cur][c] == -1:
            trie[cur][c] = idx
            idx += 1
        cur = trie[cur][c]

xor = dfs(trie[0][0]) ^ dfs(trie[0][1])
print('Alice' if xor else 'Bob')
import numpy as np
N,Q = map(int,input().split())
ans = np.array([0]*N)
test = np.array([1]*N)
test = np.diag(test)
p = []
x = []
for i in range(1,N):
    ai,bi = map(int,input().split())
    test[ai-1,bi-1]+=1
for j in range(Q):
    pj,xj = map(int,input().split())
    p.append(pj)
    x.append(xj)

for k in reversed(range(N)):
    check = np.where(test[k] > 0)
    test[k]+=np.sum(test[check],axis=0)
test = np.where(test > 0,1,0)
for j in range(Q):
    ans += test[p[j]-1]*x[j]
print(' '.join(map(str,ans)))

### FIXED CODE ###

N,Q = map(int,input().split())
ans = [0]*N
ab = []
for i in range(1,N):
    ab.append(list(map(int,input().split())))
for j in range(Q):
    pj,xj = map(int,input().split())
    ans[pj-1] += xj
ab.sort()
for i in range(N-1):
    ans[ab[i][1]-1]+=ans[ab[i][0]-1]
print(' '.join(map(str,ans)))
l=[list(map(int,input().split())) for i in ramge(3)]
N=int(input())
b=[input() for i in range(N)]
if b.count(l[0][0])>0 and b.count(l[0][1])>0 and b.count(l[0][2])>0:
    print("Yes")
    exit()
if b.count(l[1][0])>0 and b.count(l[1][1])>0 and b.count(l[1][2])>0:
    print("Yes")
    exit()
if b.count(l[2][0])>0 and b.count(l[2][1])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][0])>0 and b.count(l[1][0])>0 and b.count(l[2][0])>0:
    print("Yes")
    exit()
if b.count(l[0][1])>0 and b.count(l[1][1])>0 and b.count(l[2][1])>0:
    print("Yes")
    exit()
if b.count(l[0][2])>0 and b.count(l[1][2])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][0])>0 and b.count(l[1][1])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][2])>0 and b.count(l[1][1])>0 and b.count(l[2][0])>0:
    print("Yes")
    exit()
else:
    print("No")

    




### FIXED CODE ###

l=[list(map(int,input().split())) for i in range(3)]
N=int(input())
b=[int(input()) for i in range(N)]
if b.count(l[0][0])>0 and b.count(l[0][1])>0 and b.count(l[0][2])>0:
    print("Yes")
    exit()
if b.count(l[1][0])>0 and b.count(l[1][1])>0 and b.count(l[1][2])>0:
    print("Yes")
    exit()
if b.count(l[2][0])>0 and b.count(l[2][1])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][0])>0 and b.count(l[1][0])>0 and b.count(l[2][0])>0:
    print("Yes")
    exit()
if b.count(l[0][1])>0 and b.count(l[1][1])>0 and b.count(l[2][1])>0:
    print("Yes")
    exit()
if b.count(l[0][2])>0 and b.count(l[1][2])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][0])>0 and b.count(l[1][1])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][2])>0 and b.count(l[1][1])>0 and b.count(l[2][0])>0:
    print("Yes")
    exit()
else:
    print("No")
ab=input()
a=int(ab.split(' ')[0])
b=int(ab.split(' ')[1])
s=a*b
l=(a+b)*2
print(s+" "+l)


### FIXED CODE ###

ab=input()
a=int(ab.split()[0])
b=int(ab.split()[1])
s=a*b
l=(a+b)*2
print("{0} {1}".format(s,l))
A,B,C,K=map(int, input().split())
num_list=[]
for i in range(A):
    num_list.append(1)
for j in range(B):
    num_list.append(0)
for k in range(C):
    num_list.append(-1)
print(sum(num_list[0:K]))


### FIXED CODE ###

S=input()
T=input()

if S==T[0:-1] and len(S)<=10:
    print('Yes') 
else:
    print('No')
N = int(input())

ACcount = 0 
WAcount = 0
TLEcount = 0
REcount = 0
for i in range(N):
	S=input()

	if S == "AC":
		ACcount = ACcount + 1
	elif S == "WA":
		WAcount = WAcount + 1
	elif S == "TLE":
		TLEcount = TLEcount + 1
	elif S == "RE":
		REcount = REcount + 1

print("AC x" + str(ACcount))
print("WA x" + str(WAcount))
print("TLE x" + str(TLEcount))
print("RE x" + str(REcount))

### FIXED CODE ###

N = int(input())

if N % 1000 == 0:
	print(0)
else:
	print(1000 - (N % 1000))
N, R = map(int,input().split())
 print(type(N), N, R)

if N<10:
    R=R+100*(10-N)
    print(R)
else:
    print(R)


### FIXED CODE ###

N,R = map(int,input().split())


if N<10:
    R=R+100*(10-N)
    print(R)
else:
    print(R)
in_list = input().split()
A, B, K = int(in_list[0]), int(in_list[1]), int(in_list[2])

for k in range(K):
  if A > 0:
    A -= 1
  elif B > 0:
    B -= 1
  elif:
    pass

print(A, B)


### FIXED CODE ###

import sys

def stdin_parse_int():
    a = list(map(int,input().split()))
    return a

list = stdin_parse_int()
A = list[0]
B = list[1]
K = list[2]

if A > K:
    print(str(A-K) + " " + str(B))
elif A+B > K:
    print(str(0) + " " + str(A+B-K))
else:
    print("0 0")
a= input()
print(a//3600+':'+(a%3600)//60+':'+(a%3600)%60)


### FIXED CODE ###

a= int(input())
h = a//3600
m = (a%3600)//60
s = (a%3600)%60
print('%d:%d:%d' % (h, m, s))
h,w=map(int,input().split())
l=[[0]*(w+2)]
for i in range(h):
  a=list(input())
  a.insert(0,0)
  a.append(0)
  l.append(a)
l.append([0]*(w+2))
pointx=[-1,0,1]
pointy=[-1,0,1]
for i in range(1,h+1):
  for j in range(1,w+1):
    count=0
    if l[i][j]=='.':
      for k in pointx:
        for m in pointy:
          if l[i+k][i+m]=='#':
            count+=1
      l[i][j]=str(count)

del l[0]
del l[h]
for i in range(h):
  l[i]=l[i][1:w+1]
for i in l:
  print(''.join(i))

### FIXED CODE ###

h,w=map(int,input().split())
l=[[0]*(w+2)]
for i in range(h):
  a=list(input())
  a.insert(0,0)
  a.append(0)
  l.append(a)
l.append([0]*(w+2))
pointx=[-1,0,1]
pointy=[-1,0,1]
for i in range(1,h+1):
  for j in range(1,w+1):
    if l[i][j]=='.':
      count=0
      for k in pointx:
        for m in pointy:
          if l[i+k][j+m]=='#':
            count+=1
      l[i][j]=str(count)

del l[0]
del l[h]
for i in range(h):
  l[i]=l[i][1:w+1]
for i in l:
  print(''.join(i))
def hantei(A,B,C,R=0):
    h,t = sorted([A,B,C])[:2]
    if h**2 + t**2 < 4 * R**2:
        print 'OK'
    else:
        print 'NA'

while True:
    try:
        A,B,C = map(int,raw_input().split())
    except EOFError:
        break

    for k in range(int(raw_input())):
        hantei(A,B,C,int(raw_input()))
    
    a,b,c = map(int,raw_input().split())
    if (a,b,c) == (0,0,0):
        break

### FIXED CODE ###

def hantei(A,B,C,R=0):
    p,q = sorted([A,B,C])[:2]
    if p**2 + q**2 < 4 * R**2:
        print 'OK'
    else:
        print 'NA'

while True:
    try:
        A,B,C = map(int,raw_input().split())
        if (A,B,C) == (0,0,0):
            break
    except EOFError:
        break

    for k in range(int(raw_input())):
        hantei(A,B,C,int(raw_input()))
n = int(input())
alist=list(map(int,input().split()))
core = 0
for i in range(n-3):
  core +=min(alist[i],alist[i+1],alist[i+2])
print(core+min(alist[-2],alist[-1]) +alist[-1] +min(alist[0],alist[1]))

### FIXED CODE ###

n = int(input())
alist=list(map(int,input().split()))
alist.insert(0,1e7)
alist.append(1e7)
core = 0
for i in range(n):
  core +=min(alist[i],alist[i+1])
print(core)
# 最初に入れておくとinputが早くなる
import sys
from math import gcd
input = sys.stdin.readline

a, b, c, d = map(int, input().split())
a -= 1
# warikireru = set()
# for i in range(b//c+1):
#    for j in range(b // d+1):
#        k = c ** i * d ** j
#        if(a <= k <= b):
#            warikireru.add(k)
# print(warikireru)
# print(b-a+1-len(warikireru))

k = c * d / gcd(c, d)

print(b-a-b//c+a//c-b//d+b//k+a//d-a//k)

### FIXED CODE ###

from fractions import gcd

a,b,c,d=map(int,input().split())
lcm=int(c*d/gcd(c,d))
A=a-1
x1=A-A//c-A//d+A//lcm
x2=b-b//c-b//d+b//lcm
print(x2-x1)
n = int(input())
s = input()
if s.count('#') == 0:
    print('0')
    exit()
ssp = s.split('.')
num = s[s.find('#'):].count('.')
num = min(num,s.count('#') - ssp[-1])
print(num)


### FIXED CODE ###

n = int(input())
s = input()
cnt = 0
narabi = []
befores = '#'
for S in s:
    if S == befores:
        cnt += 1
    else:
        narabi.append(cnt)
        befores = S
        cnt = 1
narabi.append(cnt)
if s[-1] == '#':
    narabi.append(0)
hennkann = s.count('.')
saishou = s.count('.')
hashu = 0
dot = 1
for i in range(int(len(narabi) / 2)):
    hennkann = hennkann - narabi[dot] + narabi[hashu]
    saishou = min(saishou,hennkann)
    dot += 2
    hashu += 2
print(saishou)
from collections import deque
import math

n,m,p = map(int, input().split())
dist  = []
edge1 = [[] for _ in range(n)]
edge2 = [[] for _ in range(n)]  # rev_edge
for _ in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    dist.append((u,v,(c-p)*-1))
    edge1[u].append(v)
    edge2[v].append(u)
    
def dfs(edges, s):
    stack = deque([s])
    used  = {s}
    while stack:
        x = stack.pop()
        for y in edges[x]:
            if y not in used:
                used.add(y)
                stack.append(y)
    return used


def bfs(edges, s):
    queue = deque([s])
    used  = {s}
    while queue:
        x = queue.popleft()
        for y in edges[x]:
            if y in used:
                continue
            used.add(y)
            queue.append(y)
    return used
    

def bellman(dist):  #負辺があるケースでの、スタートからゴールへの最短路を求めるアルゴ。
    cost = [math.inf] * n
    cost[0] = 0
    for _ in range(n): #頂点の個数の分だけ回る
        updated = False
        for u,v,c in dist: #辺の個数の分だけ回る
            if cost[u] + c < cost[v]:
                cost[v] = cost[u] + c
                updated = True                
    #収束しない場合は負閉路があるため無限に小さくできる。
    if updated==True:
        return -1
    else:
        return max(0, cost[n-1]*-1)    
        

    
    
use = dfs(edge1, 0) & dfs(edge2, n-1)
dist2 = [(a,b,c) for a,b,c in dist if a in use and b in use]
print(bellman(dist2))

### FIXED CODE ###

from collections import deque
import math
    
def dfs(edges, s):
    stack = deque([s])
    used  = {s}
    while stack:
        x = stack.pop()
        for y in edges[x]:
            if y not in used:
                used.add(y)
                stack.append(y)
    return used


def bfs(edges, s):
    queue = deque([s])
    used  = {s}
    while queue:
        x = queue.popleft()
        for y in edges[x]:
            if y in used:
                continue
            used.add(y)
            queue.append(y)
    return used
    

def bellman(dist):  #負辺があるケースでの、スタートからゴールへの最短路を求めるアルゴ。
    cost = [float("inf")] * n
    cost[0] = 0
    for _ in range(n): #頂点の個数の分だけ回る
        updated = False
        for u,v,c in dist: #辺の個数の分だけ回る
            if cost[u] + c < cost[v]:
                cost[v] = cost[u] + c
                updated = True                
    #収束しない場合は負閉路があるため無限に小さくできる。
    if updated==True:
        return -1
    else:
        return max(0, cost[n-1]*-1)    
        

n,m,p = map(int, input().split())
dist  = []
edge1 = [[] for _ in range(n)]
edge2 = [[] for _ in range(n)]  # rev_edge
for _ in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    dist.append((u,v,(c-p)*-1))
    edge1[u].append(v)
    edge2[v].append(u)    
    
use = dfs(edge1, 0) & dfs(edge2, n-1)
dist2 = [(a,b,c) for a,b,c in dist if a in use and b in use]
print(bellman(dist2))
print(input().count())

### FIXED CODE ###

print(input().count("2"))
N = int(input()) 
for i in range(N) :
   p = list(map(int,input().split()))
   p.sort()
   if p[0]*p[0] + p[1]*p[1] == p[2]*p[2]:
     print("YES")
   else
     print("NO")


### FIXED CODE ###

n=int(input())
for i in range(n):
    a,b,c = input().split()
    x = int(a)
    y = int(b)
    z = int(c)
    p = [x,y,z]
    p.sort()
    if pow(p[0],2) + pow(p[1],2) == pow(p[2],2):
        print('YES')
    else:
        print('NO')
n = int(input())

x = [int(i) for i in range(n)]
y = [int(i) for i in range(n)]
h = [int(i) for i in range(n)]

for i in range(n):
  x[i], y[i], h[i] = [int(i) for i in input().split()]
  
for i in range(101):
  for j in range(101):
    H = abs(i - x[0]) + abs(j - y[0]) + h[0] 
    for k in range(n):
      if  H != abs(i - x[k]) + abs(j - y[k]) + h[k]:
        break
    else:
      ansx = i
      ansy = j
      ansH = H
      
print(ansx, ansy, ansH)
      

### FIXED CODE ###

n = int(input())

x = [int(i) for i in range(n)]
y = [int(i) for i in range(n)]
h = [int(i) for i in range(n)]
for i in range(n):
  x[i], y[i], h[i] = [int(i) for i in input().split()]
for i in range(101):
  for j in range(101):
    for k in range(n):
      if h[k] != 0:
        H = abs(i - x[k]) + abs(j - y[k]) + h[k] 
    for k in range(n):
      if H - abs(i - x[k]) - abs(j - y[k]) <=0:
        if h[k] != 0:
          break
      elif  H != abs(i - x[k]) + abs(j - y[k]) + h[k]:
        break
    else:
      ansx = i
      ansy = j
      ansH = H
      
print(ansx, ansy, ansH)
a,b,c = map(int,input())

if a*b*c == 0 :
  print("No")
elif:a*b*c%7 == 0 :
  print("Yes")
else: print("No")

### FIXED CODE ###

a,b,c = map(int,input())

if a*b*c == 0 :
  print("No")
elif a*b*c%7 == 0 :
  print("Yes")
else: print("No")
def gcd(a, b):
  x = max(a, b)
  y = min(a, b)
  if x%y == 0:
    return y
  else:
    while x%y!=0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m, n):
  return int(m * n/gcd(m, n))

m = int(input())
n = int(input())

print(lcm(m,n))

### FIXED CODE ###

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

a =  (input().split())
b = [1, 1]
b[0] = int(a[0])
b[1] = int(a[1])
print(lcm(b))
#! /usr/bin/env python
#-*- coding: utf-8 -*-

''' ?????????????????? '''

# ?¨???????O(n^2)


def bubble_sort(A, N):
    swap_num = 0  # ?????????????????°

    for i in range(N - 1):
        for j in range(N - 1, i, -1):
            if A[j] < A[j - 1]:
                # swap
                temp = A[j]
                A[j] = A[j - 1]
                A[j - 1] = temp
                swap_num += 1

    return (A, swap_num)


if __name__ == "__main__":
    N = input()
    A = map(int, raw_input().split())
    # A = [5, 2, 4, 6, 1, 3]
    # N = len(A)
    array_sorted, swap_num = bubble_sort(A, N)
    print(' '.join(map(str, array_sorted)))
    print(swap_num)

### FIXED CODE ###

#! /usr/bin/env python
#-*- coding: utf-8 -*-

''' ?????????????????? '''

# O(n^2)


def bubble_sort(A, N):
    swap_num = 0  # ?????????????????°

    for i in range(N - 1):
        for j in range(N - 1, i, -1):
            if A[j] < A[j - 1]:
                # swap
                temp = A[j]
                A[j] = A[j - 1]
                A[j - 1] = temp
                swap_num += 1

    return (A, swap_num)


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    # A = [5, 2, 4, 6, 1, 3]
    # N = len(A)
    array_sorted, swap_num = bubble_sort(A, N)
    print(' '.join(map(str, array_sorted)))
    print(swap_num)
def main():
    n,m,k = input().split()
    n=int(n)
    m=int(m)
    k=int(k)

    n_list = list(map(int,input().split()))
    m_list = list(map(int,input().split()))
    a, b =[0],[0]
    for i in range(n):
        a.append(a[i]+n_list[i])
    for j in range(m):
        b.append(b[j]+m_list[j])
    
    j=m
    ans = 0
    for i in range(n+1):
        if a[i]>k:
            break
        while b[j]+a[i]>k:
            j -= 1
        ans = max(ans,i+j)
    print(ans)
main()

### FIXED CODE ###

def main():
    a = int(input())
    print(a+a**2+a**3)

main()
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n,m = (int(x) for x in input().split())
a = list(map(int, input().split()))

lc = lcm_list(a) / 2
if lc > m: print(0)
else: print(int((m / lc) // 2 + 1))

### FIXED CODE ###

import math
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n,m = (int(x) for x in input().split())
a = list(map(int, input().split()))

lc = int(lcm_list(a) // 2)

tmp = 0
bol = 0
num = a[0]
while num % 2 == 0:
        num = num // 2
        tmp += 1
cnt = 0
for num in a:
    cnt = 0
    while num % 2 == 0:
        num = num // 2
        cnt += 1
    if cnt != tmp:
        bol = 1

if lc > m: print(0)
elif bol == 1: print(0)
else: print(int(((m / lc) + 1) // 2))
N=int(input())
A=[int(input()) for i range(N)]

x=sorted(A)

for i in range(N):
  if A[i] == x[N-1]:
    print(x[N-2])
  else:
    print(x[N-1])

### FIXED CODE ###

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

x = sorted(A)

for i in range(N):
  if A[i] == x[N-1]:
    print(x[N-2])
  else:
    print(x[N-1])
from math import gcd

N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

l = A[0]
for i in range(N-1):
    l = l*A[i+1]//gcd(l,A[i+1])

ans = 0
for i in range(N):
    ans = (ans + l//A[i]) % mod

print(ans)

### FIXED CODE ###

def main():
    from math import sqrt
    from fractions import gcd
    from collections import defaultdict
    from copy import deepcopy

    N = int(input())
    A = list(map(int, input().split()))
    mod = 10 ** 9 + 7

    p = [1] * (1001)
    P = []  # 1000までの素数表
    p[0] = p[1] = 0
    for x in range(2, int(sqrt(1000000)) + 1):
        if p[x]:
            P.append(x)
            for y in range(x * x, 1001, x):
                p[y] = 0

    B = [defaultdict(int) for i in range(N)]  # N個の数を素因数分解したもの
    lcm = defaultdict(int)  # N個の数のlcmを素因数分解したもの

    for i in range(N):
        for j in P:
            if A[i] % j == 0:
                while A[i] % j == 0:
                    A[i] //= j
                    B[i][j] += 1
            lcm[j] = max(lcm[j], B[i][j])
        if A[i] != 1:
            B[i][A[i]] = 1
            lcm[A[i]] = 1

    l = 1  # N個の数のlcm
    for i in lcm.keys():
        l = (l * pow(i, lcm[i], mod)) % mod

    ans = 0
    # l/A[i]の和を求めていく
    for i in range(N):
        r = l
        for j in list(B[i].keys()):
            r = (r * pow(j, mod - B[i][j] - 1, mod)) % mod
        ans = (ans + r) % mod

    print(ans)

if __name__ == '__main__':
    main()