Harryxun/stf_run huggingface dataset:
from collections import deque

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

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

start = -1
for v in range(n):
    if len(g[v]) == 0:
        continue
    start = v
    break

memo = [0] * n
memo[start] = 1
count = 0
q1 = []
q2 = []
for v in g[start]:
    if memo[v] == 1:
        continue
    memo[v] = 1
    count += 1
    if count > 2:
        break
    if count == 1:
        q1.append(v)
    elif count == 2:
        q2.append(v)

ans1 = [start]
while q1:
    node = q1.pop()
    ans1.append(node)
    flag = 0
    for nv in g[node]:
        if memo[nv] == 1:
            continue
        memo[nv] = 1
        q1.append(nv)
        flag = 1
        break
    if flag == 0:
        break

ans2 = []
while q2:
    node = q2.pop()
    ans2.append(node)
    flag = 0
    for nv in g[node]:
        if memo[nv] == 1:
            continue
        memo[nv] = 1
        q1.append(nv)
        flag = 1
        break
    if flag == 0:
        break

ans1 = ans1[::-1]

ans = []
for i in ans1:
    ans.append(i+1)
for i in ans2:
    ans.append(i+1)
print(len(ans))
print(*ans)


### FIXED CODE ###

from collections import deque

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

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

start = -1
for v in range(n):
    if len(g[v]) == 0:
        continue
    start = v
    break

memo = [0] * n
memo[start] = 1
count = 0
q1 = deque([])
q2 = deque([])
for v in g[start]:
    if memo[v] == 1:
        continue
    count += 1
    if count > 2:
        break
    memo[v] = 1
    if count == 1:
        q1.append(v)
    elif count == 2:
        q2.append(v)

ans1 = [start]
while q1:
    node = q1.popleft()
    ans1.append(node)
    flag = 0
    for nv in g[node]:
        if memo[nv] == 1:
            continue
        memo[nv] = 1
        q1.append(nv)
        flag = 1
        break
    if flag == 0:
        break

ans2 = []
while q2:
    node = q2.popleft()
    ans2.append(node)
    flag = 0
    for nv in g[node]:
        if memo[nv] == 1:
            continue
        memo[nv] = 1
        q2.append(nv)
        flag = 1
        break
    if flag == 0:
        break

ans1 = ans1[::-1]


ans = []
for i in ans1:
    ans.append(i+1)
for i in ans2:
    ans.append(i+1)
print(len(ans))
print(*ans)
import sys
input = sys.stdin.readline
X, Y = map(int, input().split())
mod = 10 ** 9 + 7
for t in range(X + Y + 1):
  if t == X + Y:
    print(0)
    exit(0)
  if X + Y - 2 * t == t:
    X -= t
    Y -= t
    break
class Factorial:
  def __init__(self, n, mod):
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i):
    return self.f[i]
  def ifactorial(self, i):
    return self.i[i]
  def combi(self, n, k):
    return self.f[n] * self.i[n - k] % mod * self.i[k] % mod
f = Factorial(X + Y, mod)
#print(X, Y)
print(f.combi(X + Y, X))

### FIXED CODE ###

import sys
input = sys.stdin.readline
X, Y = map(int, input().split())
mod = 10 ** 9 + 7
for t in range(X + Y + 1):
  if t == X + Y:
    print(0)
    exit(0)
  if X + Y - 2 * t == t:
    X -= t
    Y -= t
    break
if X < 0 or (Y < 0):
  print(0)
  exit(0)
class Factorial:
  def __init__(self, n, mod):
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i):
    return self.f[i]
  def ifactorial(self, i):
    return self.i[i]
  def combi(self, n, k):
    return self.f[n] * self.i[n - k] % mod * self.i[k] % mod
f = Factorial(X + Y, mod)
#print(X, Y)
print(f.combi(X + Y, X))
P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]
n=int(input())
A=[1]*n

for i in range(n):
	s=input()
	for j in range(10):
		A[i] *= P[ord(s[j])]

res=0
for i in range(n):
	for j in range(i+1,n):
		if A[i]==A[j]:
			res += 1
print(res)

### FIXED CODE ###

P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]
n=int(input())
A=[1]*n

for i in range(n):
	s=input()
	for j in range(10):
		A[i] *= P[ord(s[j])-97]

res=0
A.sort()
cnt=0

for i in range(n-1):
		if A[i]==A[i+1]:
			cnt += 1
		else:
			res += cnt*(cnt+1)//2
			cnt=0
if cnt != 0:
	res += cnt*(cnt+1)//2
print(res)
N = input()
height = list(map(int, input().split(" ")))
dp = [0]*N
dp[1] = 

for i in range(1,N):
  if i <= 2:
    dp[i] = abs(height[i]-height[0])
  if dp[i-1] < dp[i-2]:
    dp[i] = dp[i-1] + abs(height[i]-height[i-1])
  else:
    dp[i] = dp[i-2] + abs(height[i]-height[i-2])

print(dp[N-1])

### FIXED CODE ###

N = int(input())
height = list(map(int, input().split(" ")))
dp = [0]*N
 
for i in range(1,N):
  if i <= 2:
    dp[i] = abs(height[i]-height[0])
  else:
    dp[i] = min(dp[i-1] + abs(height[i]-height[i-1]), dp[i-2] + abs(height[i]-height[i-2]))

print(dp[N-1])
import numpy as np
h, w, k = map(int, input().split())
num = 0
cakes = []
for _ in range(h):
    row = input()
    a_row = []
    for r in row:
        if r=='.':
            a_row.append(r)
        elif r=='#':
            num+=1
            a_row.append(num)
    cakes.append(a_row)

cakes = np.array(cakes)

for x in range(h):
    for y in range(w):
        if cakes[x, y] == '.':
            continue
        else:
            val = cakes[x, y]
            nx = x-1
            while(nx>=0)and(cakes[nx, y] == '.') :
                cakes[nx, y] = val
                nx -= 1
            nx = x+1
            while (nx<=h-1)and(cakes[nx, y] == '.'):
                cakes[nx, y] = val
                nx += 1

for x in range(h):
    for y in range(w):
        if cakes[x, y] == '.':
            continue
        else:
            val = cakes[x, y]
            ny = y-1
            while (ny>=0)and(cakes[x, ny]=='.'):
                cakes[x, ny] = val
                ny -= 1
            ny = y+1
            while(ny<=w-1)and(cakes[x, ny] == '.'):
                cakes[x, ny] = val
                ny += 1

for c in cakes:
    for s in c:
        print(str(s) + ' ', end='')
    print('')


### FIXED CODE ###

h, w, k = map(int, input().split())
num = 0
cakes = []
for _ in range(h):
    row = input()
    a_row = []
    for r in row:
        if r=='.':
            a_row.append(r)
        elif r=='#':
            num+=1
            a_row.append(num)
    cakes.append(a_row)

for x in range(h):
    for y in range(w):
        if cakes[x][y] == '.':
            continue
        else:
            val = cakes[x][y]
            nx = x-1
            while(nx>=0)and(cakes[nx][y] == '.') :
                cakes[nx][y] = val
                nx -= 1
            nx = x+1
            while (nx<=h-1)and(cakes[nx][y] == '.'):
                cakes[nx][y] = val
                nx += 1

for x in range(h):
    for y in range(w):
        if cakes[x][y] == '.':
            continue
        else:
            val = cakes[x][y]
            ny = y-1
            while (ny>=0)and(cakes[x][ny]=='.'):
                cakes[x][ny] = val
                ny -= 1
            ny = y+1
            while(ny<=w-1)and(cakes[x][ny] == '.'):
                cakes[x][ny] = val
                ny += 1

for c in cakes:
    for s in c:
        print(str(s) + ' ', end='')
    print('')
from math import factorial
def comb(n, r):
    return int(factorial(n) / factorial(r) / factorial(n - r))

n, k = map(int, input().split())
a = sorted(map(int, input().split()))

s = 0
d = 10**9+7
for i in range(len(a)):
  for j in range(k - 1, len(a) - i):
    s += (a[i+j] - a[i]) * comb(j-1, k-2) % d
    s %= d
print(s)

### FIXED CODE ###

from math import factorial
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n, k = map(int, input().split())
a = sorted(map(int, input().split()))


mod = 10**9+7
def main():
  s = 0
  l = len(a)
  for i in range(l):
    s += a[i] * cmb(i, k - 1, mod)
    s -= a[i] * cmb(l - i -1 , k - 1, mod)

    s %= mod
  print(s)
main()
from sys import stdin
input = stdin.readline

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

if b > n :
    for i in range(n+1):
        tmp = int((a * i) / b)  - a * int(i/b) 
        maxpoint = max(tmp,maxpoint)
        print(0)
        
else:
    for i in reversed(range(n+1)):
        c += 1
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print(0)
            exit()
        maxpoint = max(tmp,maxpoint)

print(maxpoint)



### FIXED CODE ###

from sys import stdin
input = stdin.readline
 
a,b,n = map(int,input().split())
maxpoint = 0
 
if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
else:
    k = int(n/b)*b -1
    maxpoint =  int((a * k) / b)  - a * int(k/b) 
    if b == 1:
        maxpoint = 0
 
print(maxpoint)
m = map(int, (input().split()))
a = {int(input()) for i in range(m)}
mod = 10 ** 9 + 7
 
x = 1 if 1 not in a else 0
dp = [1, x] + [0] * (n - 1)
 
for i in range(2, n + 1):
    if i in a:
        continue
    dp[i] = (dp[i - 1] + dp[i - 2])
 
print(dp[-1] % mod)

### FIXED CODE ###

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

ai=0
n1,n2=0,1
for i in range(1,n+1):
      if ai<m and i==A[ai]:
            ai+=1
            n1=n2
            n2=0
      else:
            tmp=n2
            n2=(n1+n2)%1000000007
            n1=tmp
print(n2)
N=list(map(int,input(),split()))
if sorted(N)==[5,7,7]:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

N=list(map(int,input().split()))
if sorted(N)==[5,5,7]:
    print("YES")
else:
    print("NO")
N = int(input())
D = list(map(int, input().split()))

D = sorted(D)
left = D[N//2]
right = D[N//2+1]

print(right-left)


### FIXED CODE ###

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

D = sorted(D)
left = D[N//2-1]
right = D[N//2]
# print("left: {}, right: {}".format(left, right))
print(right-left)
S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if S[i] % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break
        
      
    

### FIXED CODE ###

S = input()
for i in range(len(S)+1):
  if i == len(S):
    print('Yes')
    break
  if S[i] =='U' or S[i] =='D':
    pass
  else:
    if i % 2 ==0:
      if S[i] == 'R':
        pass
      else:
        print('No')
        break
    else:
      if S[i]== 'L':
        pass
      else:
        print('No')
        break
import numpy as np
a, b, c = map(int, input().split())

A = a+b-c+2*np.sqrt(np.around(a*b, 10))
if A < 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

from decimal import *

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

A = Decimal(str(a)).sqrt()+Decimal(str(b)).sqrt()-Decimal(str(c)).sqrt()
if A < 0:
    print('Yes')
else:
    print('No')
a.b = map(int.input().split())
c = a/2/b
d = round(c)
print(d)

### FIXED CODE ###

a,b = map(int,input().split())
c = b*2+1
if a%c ==0:
    print(int(a//c))
else:
    print(int(a//c)+1)
forecast = raw_input().strip()
real = raw_input().strip()
assert len(forecast) == len(real)
print sum([1 for i in xrange(len(forecast)) if forecast[i] == real[i] else 0])

### FIXED CODE ###

forecast = raw_input().strip()
real = raw_input().strip()
assert len(forecast) == len(real)
print sum([1 for i in xrange(len(forecast)) if forecast[i] == real[i]])
5 4 4
1 2 2
2 3 2
3 4 3
4 5 2
20
2 1
3 1
4 1
5 1
1 2
3 2
4 2
5 2
1 3
2 3
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5

### FIXED CODE ###

import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    N, M, L = geta(int)
    INF = 10**10

    d = [[INF] * (N + 1) for _ in range(N + 1)]

    for i in range(1, N + 1):
        d[i][i] = 0

    for _ in range(M):
        a, b, c = geta(int)
        d[a][b] = c
        d[b][a] = c

    def warshall_froyd(_d):
        for k in range(1, N + 1):
            for i in range(1, N + 1):
                for j in range(1, N + 1):
                    l = _d[i][k] + _d[k][j]
                    if _d[i][j] > l:
                        _d[i][j] = l

    warshall_froyd(d)

    f = [[INF] * (N + 1) for _ in range(N + 1)]
    for i in range(N + 1):
        f[i][i] = 0
        for j in range(N + 1):
            if d[i][j] <= L:
                f[i][j] = 1

    warshall_froyd(f)

    for _ in range(gete(int)):
        s, t = geta(int)
        ret = f[s][t]
        print(ret - 1 if ret != INF else -1)


if __name__ == "__main__":
    main()
a=input.split()
print(int(a[0])*int(a[1])+" "+2*(int(a[0])+int(a[1])))

### FIXED CODE ###

a=input().split()
b=int(a[0])*int(a[1])
c=(int(a[0])+int(a[1]))*2
print(b,end="")
print(" ",end="")
print(c)
# coding: utf-8
# Your code here!
import math
from functools import reduce

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

if max(l)<K:
    print("IMPOSSIBLE")
else:
    if K%reduce(math.gcd, l)==0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

### FIXED CODE ###

# coding: utf-8
# Your code here!
from fractions import gcd
from functools import reduce

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

if max(l)<K:
    print("IMPOSSIBLE")
else:
    if K%reduce(gcd, l)==0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
import fractions
a,b = map(int,input().split())
print(a * b // fractions.gcd(a,b))

### FIXED CODE ###

a = int(input())
b = int(input())

myset = ([1,2,3]) 

myset.remove(a)
myset.remove(b)

l = list(myset)
print(l[0])
S =[i+1 for i in xrange(13)]
H =[i+1 for i in xrange(13)]
C =[i+1 for i in xrange(13)]
D =[i+1 for i in xrange(13)]
#[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

n = input()
for i in xrange(n):
    c, a = raw_input().split()
    if c == "S":
        del S[int(a)-1]
    elif c == "H":
        del H[int(a)-1]        
    elif c == "C":
        del C[int(a)-1]        
    elif c == "D":
        del D[int(a)-1]

for i in xrange(len(S)):
    print "S " + str(S[i])
    
for i in xrange(len(H)):
    print "H " + str(H[i])    
    
for i in xrange(len(C)):
    print "C " + str(C[i])    
    
for i in xrange(len(D)):
    print "D " + str(D[i])    
    

### FIXED CODE ###

S =[i+1 for i in xrange(13)]
H =[i+1 for i in xrange(13)]
C =[i+1 for i in xrange(13)]
D =[i+1 for i in xrange(13)]
#[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

n = input()
for i in xrange(n):
    c, a = raw_input().split()
    if c == "S":
        for j in xrange(len(S)): 
            if S[j-1] == int(a):
             del S[j-1]
    elif c == "H":
        for j in xrange(len(H)): 
            if H[j-1] == int(a):
             del H[j-1]      
    elif c == "C":
        for j in xrange(len(C)): 
            if C[j-1] == int(a):
             del C[j-1]      
    elif c == "D":
        for j in xrange(len(D)): 
            if D[j-1] == int(a):
             del D[j-1]

for i in xrange(len(S)):
    print "S " + str(S[i])
    
for i in xrange(len(H)):
    print "H " + str(H[i])    
    
for i in xrange(len(C)):
    print "C " + str(C[i])    
    
for i in xrange(len(D)):
    print "D " + str(D[i])
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [W, H, x, y] = [long(input_raw[0]), long(input_raw[1]), long(input_raw[2]), long(input_raw[3])]
    if (H /2 == y) and  (H % 2 == 0)  and (W/2 == x) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0

    if(W * y == H * x or y * W ==  (-H * x) + W * H):
        print "%20.15f %d" % (float(H)/2.0 * W , ans2)
        return

    if (H /2 == y) and  (H % 2 == 0)  and (W/2 == x) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0
    throw()
    ans = max(min(H - y, y) * W, min(W - x, x) * H)
    print "%20.15f %d" % (float(ans), ans2)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [W, H, x, y] = [long(input_raw[0]), long(input_raw[1]), long(input_raw[2]), long(input_raw[3])]
    if (H /2 == y) and  (H % 2 == 0)  and (W/2 == x) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0

    #if(W * y == H * x or y * W ==  (-H * x) + W * H):
    print "%20.15f %d" % (float(H)/2.0 * W , ans2)
    return

    if (H /2 == y) and  (H % 2 == 0)  and (W/2 == x) and (W % 2 == 0):
        ans2 = 1
    else:
        ans2 = 0

    ans = max(min(H - y, y) * W, min(W - x, x) * H)
    print "%20.15f %d" % (float(ans), ans2)

if __name__ == '__main__':
    main()
#!/usr/bin/env python3
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from collections import deque
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
def solve():
    n=int(input())
    data=[list(map(int,list(input()))) for i in range(n)]
    fordfs=[[] for i in range(n)]
    for i in range(n):
        for j in range(n):
            if data[i][j]==1:
                fordfs[i].append(j)

    def dfs():
        V=[-1]*n
        V[0]=0
        que=deque()
        que.append(0)
        while que:
            now=que.popleft()
            nowv=V[now]
            for ne in fordfs[now]:
                if nowv==V[ne]:
                    print(-1)
                    exit()
                elif V[ne]==-1:
                    V[ne]=(nowv+1)%2
                    que.append(ne)
    
    dfs()
    # print(data)
    G=csgraph_from_dense(data)
    d = floyd_warshall(G)
    d.tolist()
    M=0
    for i in d:
        M=max(M,max(i))
    M=int(M)
    print(M+1)
    return



def main():

    solve()
    return
if __name__ == '__main__':
    main()



### FIXED CODE ###

#!/usr/bin/env python3
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from collections import deque
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
def solve():
    n=int(input())
    data=[list(map(int,list(input()))) for i in range(n)]
    fordfs=[[] for i in range(n)]
    for i in range(n):
        for j in range(n):
            if data[i][j]==1:
                fordfs[i].append(j)

    def dfs():
        V=[-1]*n
        V[0]=0
        que=deque()
        que.append(0)
        while que:
            now=que.popleft()
            nowv=V[now]
            for ne in fordfs[now]:
                if nowv==V[ne]:
                    print(-1)
                    exit()
                elif V[ne]==-1:
                    V[ne]=(nowv+1)%2
                    que.append(ne)
    
    dfs()
    # print(data)
    G=csgraph_from_dense(data)
    d = floyd_warshall(G)
    d.tolist()
    M=0
    for i in d:
        M=max(M,max(i))
    M=int(M)
    print(M+1)
    return



def main():

    solve()
    return
if __name__ == '__main__':
    main()
N = int(input())
list1 = map(int,input().split())
list2 = map(int,input().split())
x = 0
for i in range(N):
    x = list1[i] - list2[i]
    if x >> 0:
         y += x
print(y)

### FIXED CODE ###

N = int(input())
list1 = input().split()
list2 = input().split()
x = 0
y = 0
for i in range(N):
    x = int(list1[i]) - int(list2[i])
    if x > 0:
         y += x
print(y)
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0]*n
ans = n
for i in range(m):
  b, c = map(int, input().split())
  b -= 1
  c -= 1
  a[b] += 1
  a[c] += 1
  if h[b] == h[c]:
    if a[b] == 1 and a[c] == 1:
      ans -= 2
    elif a[b] == 1 and a[c] != 1:
      ans -= 1
    elif a[b] != 1 and a[c] == 1:
      ans -= 1
  if h[b] > h[c]:
    a[b] -= 1
    if a[c] == 1:
      ans -= 1
  if h[b] < h[c]:
    a[c] -= 1
    if a[b] == 1:
      ans -= 1
print(ans)

### FIXED CODE ###

x = int(input())
a = []
for i in range(-200, 200):
  for j in range(-200, 200):
    if i**5 - j**5 == x:
      a.append([i, j])
      break
      
print(*a[0])
import math
def prime_divisor(n):
    ls = []
    i = 2
    while i <= math.floor(n**0.5):
        if n%i == 0:
            ls.append(i)
            ls.append(n//i)
            i += 1
        else:
            i += 1
    if n > 1:
        ls.append(n)
    return ls
N = int(input())
ls1 = prime_divisor(N)
ls2 = [x-1 for x in list(set(ls1)) if x >= 2]
ls2.sort()
ls2.reverse()
ans = 0
for i in range(len(ls1)):
    if N // ls2[i] == N % ls2[i]:
        ans += ls2[i]
print(ans)


### FIXED CODE ###

import math
def prime_divisor(n):
    ls = []
    i = 2
    while i <= math.floor(n**0.5):
        if n%i == 0:
            ls.append(i)
            ls.append(n//i)
            i += 1
        else:
            i += 1
    if n > 1:
        ls.append(n)
    return ls
N = int(input())
ls1 = prime_divisor(N)
ls2 = [x-1 for x in list(set(ls1)) if x >= 2]
ls2.sort()
ls2.reverse()
ans = 0
for i in range(len(ls2)):
    if N // ls2[i] == N % ls2[i]:
        ans += ls2[i]
print(ans)
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, n
while g >= 1:
    g //= 2
    gap.append(g)
m = len(gap)
for i in range(m):
    gi = gap[i]
    for idx in range(gap[i], n):
        j = idx - gap[i]
        while j >= 0 and data[j] > data[j+gi]:
            data[j+gi], data[j] = data[j], data[j+gi]
            j -= gi
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



### FIXED CODE ###

import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])