Problem:
 Score : 500 points    Problem Statement Snuke received a positive integer N from Takahashi.
A positive integer m is called a favorite number when the following condition is satisfied:   The quotient and remainder of N divided by m are equal, that is, \lfloor \frac{N}{m} \rfloor = N \bmod m holds.   Find all favorite numbers and print the sum of those.      Constraints  All values in input are integers.  1 \leq N \leq 10^{12}         Input Input is given from Standard Input in the following format:  N       Output Print the answer.        Sample Input 1 8      Sample Output 1 10  There are two favorite numbers: 3 and 7 . Print the sum of these, 10 .       Sample Input 2 1000000000000      Sample Output 2 2499686339916  Watch out for overflow.

Solution (Python):
N = int(input())

def solve():
    ans = 0
    for i in range(1, N):
        m = (N - 1) // i
        if i >= m:
            break
        if (N - i) % i == 0:
            ans += (N - i) // i
    return ans

print(solve())

Solution (Python):
MOD = 10 ** 9 + 7
INF = 10 ** 12
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  itertools import permutations
from heapq import heapify,heappop,heappush

def main():
    n = int(input())
    ans = 0
    for i in range(1,n):
        if i * i > n:
            break
        if n%i == 0:
            j = n//i
            if j - 1 > i:
                ans += j - 1
    print(ans)
    
if __name__ =='__main__':
    main()

Solution (Python):
N = int(input())
import math

ans = 0
for Q in range(1, math.floor(math.sqrt(N)) + 1):
    if N % Q == 0:
        if Q <= N // Q - 2:
            ans += N // Q - 1
            
print(ans)

Solution (Python):
N=int(input())
ans=0

def partions(M):
    import math
    d=[]
    i=1
    while math.sqrt(M)>=i:
        if M%i==0:
            d.append(i)
            if i**2!=M:
                d.append(M//i)
        i=i+1
    d.sort()
    return d

list=partions(N)
for i in range(0,len(list)//2):
    q=list[i]
    m=N//list[i]-1
    if m>q:
        ans+=m

print(ans)

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

    
    return divisors

n = int(input())
count = 0
for i in make_divisors(n):
    if i == 1:
        continue
    quotient, remainder = divmod(n, i-1)
    if quotient == remainder:
        count += i-1

print(count)

Solution (Python):
N = int(input())
ans = 0

for i in range(1,int(N**0.5)+1):
    if N%i == 0:
        x = N//i - 1
        if x > i:
            ans += x

print(ans)

Solution (Python):
n=int(input());print(sum(n//i-1 for i in range(1,int(n**.5+1)) if n%i==0and n//i-1>i))

Solution (Python):
n=int(input())
print(sum(n//i-1 for i in range(1, int(n**.5+1)) if n%i==0and n//i-1>i))

Solution (Python):
n=int(input())
print(sum(n//i-1 for i in range(1, int(n**(1/2))+1) if n%i==0 and n//i-1>i))

Solution (Python):
n = int(input())
print(sum([n//i-1 for i in range(1, int(n**(1/2))+1) if n%i==0 and n//i-1>i]))

Solution (Python):
n = int(input())
print(sum([n//i-1 for i in range(1, int(n**(1/2))+1) if (n%i==0) and (n//i-1 > i)]))

Solution (Python):
n = int(input())

result = 0
for i in range(1, int(n**(1/2)+1)):
    if n%i==0:
        x = n//i -1
        if x > i:
            result += x
print(result)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, int(n**0.5) + 1):
    if n % i == 0:
        j = n // i
        
        if j < i-1:
            ans += i-i
            
        if i < j-1:
            ans += j-1
            

print(ans)

Solution (Python):






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


N = int(input())
candi = make_divisors(N)
ans = 0
for mp in candi:
    m = mp - 1
    if m > 0 and (N // m) == (N % m):
        ans += m
print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(1,int(n**(1/2))+10):
  if (n-i)%i==0 and (n-i)//i>i:
    ans=ans+(n-i)//i
print(ans)

Solution (Python):
N=int(input())
div = []
ans = 0
for i in range(1,int(pow(N,0.5)+3)):
    if N%i==0:
        div.append(i)
        div.append(N//i)
div = list(set(div))
for i in map(lambda x:x-1,div):
    if i != 0 and N%i==N//i:
        ans += i
print(ans)

Solution (Python):
from math import ceil
n = int(input())

total = 0
for i in range(ceil(n ** 0.5) + 1):
  if n % (i + 1) == 0:
    a = n // (i + 1) - 1
    if a >= 2 and n // a == n % a:
      total += a

print(total)

Solution (Python):
n = int(input())
ans = 0
p = 1
while True:
    if p ** 2 >= n:
        break
    if (n - p) % p == 0 and n % ((n - p) // p) != 0:
        ans += (n - p) // p
    p += 1

print(ans)

Solution (Python):
N = int(input())


prime, i = set(), 1
while i * i <= N:
    if N % i == 0:
        prime.add(i)
        prime.add(N//i)
    i += 1


ans = []
for i in prime:
    if i == 1:
        continue
    i -= 1
    if N // i == N % i:
        ans.append(i)

print(sum(ans))

Solution (Python):
N = int(input())
rem = []

for i in range(1, N):
    if i * i > N:
        break
    elif i * i == N:
        rem.append(i)
    elif N % i == 0:
        rem.extend([i, N // i])

ans = 0
for r in rem:
    if (r - 1) > N // r:
        ans += r - 1
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import floor


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

    
    return divisors


n = int(readline())
prime_list = make_divisors(n)
ans = 0
prime_list.remove(1)
for i in range(len(prime_list)):
    prime_list[i] -= 1
    if floor(n / prime_list[i]) == n % prime_list[i]:
        ans += prime_list[i]
print(ans)

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


N = int(input())
d = make_divisors(N)
ans = 0
for i in d:
    a = i-1
    m = N//i
    if a > m:
        ans += a

print(ans)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    s = int(sqrt(n)) + 1
    ans = 0
    for i in range(1, s+1):
        x = n - i
        m = x // i
        if m > i and x % i == 0 :
            ans += m
    print(ans)

    return



if __name__ == '__main__':
    solve()

Solution (Python):
N = int(input())

l = []
for i in range(1, int(N**0.5)+1):
    if N%i==0:
        l.append(i)
        if i!=N//i:
            l.append(N//i)

ans = 0
for i in l:
    m = (N//i)-1
    if m:
        a, b = divmod(N, m)
        if a==b:
            ans += m

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    n = int(input())

    def yakusu():
        for i in range(1, int(n**0.5)+1):
            if n%i == 0:
                yield i
                if i != n //i:
                    yield n//i

    for m in yakusu():
        m -= 1
        if m == 0:
            continue

        if n // m == n % m:
            yield m

print(sum(main()))

Solution (Python):
N = int(input())

ans = 0
for i in range(1,10**6):
    mm = (N-i)//i
    if mm!=0 and N%mm == N//mm:
        
        ans += mm
print(ans)

Solution (Python):
n = int(input())

'''
x / y = a ... b -> ay * b = x を今回の問題に当てはめ,N//m = N mod m = kとすると
km + k = N -> N = k(m + 1)となり
k と m + 1 はNの約数となる
また、N mod m < mより
k < mとなり
k < N ** 0.5 
'''
ans = 0
for i in range(1, int(n**.5)+1):
    if n % i or i >= n // i - 1:
        continue
    ans += n // i - 1
print(ans)

Solution (Python):
def yakusu(n):
    defyaku = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            defyaku.append(i)
            if i != n // i:
                defyaku.append(n // i)
    return defyaku

N = int(input())
yaku = yakusu(N)
ans = 0
for i in yaku:
    if i == 1: continue
    v, n = divmod(N, i - 1)
    if v == n:
        ans += (i - 1)

print(ans)

Solution (Python):
n = int(input())

ans = 0

a = 1
while a**2 < n and a*(a+1) < n:
    if n % a == 0:
        ans += n//a - 1
    a += 1

print(ans)

Solution (Python):
import math
n = int(input())
a = math.sqrt(n)
if int(a)<a:
  a=int(a)+1
else:
  a=int(a)
ans = 0
for i in range(1,a):
  if (n-i)%i==0 and n%((n-i)//i)==i:
    ans+=(n-i)//i
print(ans)

Solution (Python):
n=int(input())
if n==1 or n==2:
  print(0)
  exit()
d=0
for i in range(1,int(n**0.5)+1):
  if n%i==0:
    if i!=n//i and i!=n//i-1:
      d=d+n//i-1
print(d)

Solution (Python):
n=int(input())
ans=0
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        if i>1 and n//(i-1)==n%(i-1):
            ans+=i-1
        if n//i!=i:
            if n//(n//i-1)==n%(n//i-1):
                ans+=n//i-1
print(ans)

Solution (Python):
n=int(input())
if n==2:
    print(0)
    exit()
ans=n-1
for i in range(int(n**0.5)+1,2,-1):
    
    l,r=n//i+1,n//(i-1)+1
    while l+1<r:
        mid=(l+r)//2
        if n//mid<=n%mid:
            l=mid
        else:
            r=mid
    if n//l==n%l:
        ans+=l
print(ans)

Solution (Python):
def main():
    n = int(input())
    i = 1
    answer = 0
    while i * i <= n:
        if (n - i) % i == 0 and n - i > i ** 2:
            answer += (n - i) // i
        i += 1
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
from math import sqrt
def main():
    n = int(input())
    ans = 0
    for i in range(1, int(sqrt(n))+1):
        y = n - i
        if y % i == 0 and y != 0 and n//(y//i) == i:
            ans += y // i
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors
A=make_divisors(N)
ans=0
for i in A:
  if i==1:
    continue
  a=N//(i-1)
  b=N%(i-1)
  if a==b:
    ans+=(i-1)
print(ans)

Solution (Python):
import math
N=int(input())
a=int((math.sqrt(N)//1))
ans=0
if N==2:
  print(0)
  exit()
for i in range(1,a):
  b=(N-i)/i
  if b.is_integer():
    ans+=int(b)
c=N//a
d=N%a
if int(c)==d:
  ans+=a
a+=1
c=N//a
d=N%a
if int(c)==d:
  ans+=a
print(ans)

Solution (Python):
def make_devisors(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors +=[i]
            if i!=n//i:
                divisors +=[n//i]
    return divisors


n=int(input())
D=sorted(make_devisors(n))
ans=0
for i in D[1:]:
    if (n//(i-1))*i==n:
        ans +=i-1
print(ans)

Solution (Python):

N = int(input())

import math

n = int(math.sqrt(N))
candidates = []
for i in range(1, n+1):
    if not N % i:
        if (N//i) -1 > i:
            candidates.append(N//i)


print(sum(candidates) - len(candidates))

Solution (Python):
def make_devisors(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors +=[i]
            if i!=n//i:
                divisors +=[n//i]
    return divisors


n=int(input())
D=sorted(make_devisors(n))
ans=0
for i in D[1:]:
    if (n//(i-1))*(i)==n:
        ans +=i-1
print(ans)

Solution (Python):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    
    return divisors
n = int(input())
res = 0
for x in make_divisors(n):
    x = x-1
    if x == 0:
        continue
    if n % x == n // x:
        res += x
print(res)

Solution (Python):
n = int(input())

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

divs = make_div(n)
ans=0
for r in divs:
    m=n//r -1
    if r<m:
        ans+=m
print(ans)

Solution (Python):
n = int(input())

divisors = set()

for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        divisors.add(i)
        divisors.add(n//i)

ans = 0

for d in divisors:
    m = d-1
    if m != 0 and n//m == n % m:
        ans += m

print(ans)

Solution (Python):
n = int(input())

ans = 0
i = 1

while i*(i+1)+i <= n:
    if (n-i) % i == 0:
        ans += (n-i)//i
    i += 1

print(ans)

Solution (Python):

import numpy as np
def divisor(n):
    tank = []
    for i in range(1, int(n**0.5)+1):
        if n%i==0:
            tank.append(i)
            if i!=n//i:
                tank.append(n//i)
    tank.sort()
    return tank

n = int(input())
tank = np.array(divisor(n))
res = 0
for i in range(len(tank)):
    x = tank[i] - 1
    if x!=0 and n%x==n//x:
        res += x
print(res)

Solution (Python):
N = int(input())
import collections

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

    
    return divisors

div = make_divisors(N)



print(sum(div)-len(div))

Solution (Python):
import math
N = int(input())
div = []
for i in range(1, int(math.sqrt(N))+1):
  if N%i==0:
    div.append(i)
    if i != N//i:
      div.append(N//i)
ans = 0
for i in range(len(div)):
  if div[i]-1 > 0 and N//(div[i]-1) == N%(div[i]-1):
    ans += div[i]-1
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    if i*i>N:break
    if N%i==0:
        ans += N//i-1 if N//i-1>i else 0
print(ans)

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

n=int(input())
l=divisore(n)

ans=0
for i in l:
  i-=1
  if i!=0 and n//i==n%i:
    ans+=i
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        m = n//i - 1
        if m != 0 and n // m == n % m:
            ans += n//i - 1
print(ans)

Solution (Python):
from math import floor, sqrt
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors

N = int(input())
div = make_divisors(N)
max_div = sqrt(N)
ans = 0
if N == 2:
    print(0)
    exit()
if N == 6:
    print(5)
    exit()
if N == 12:
    print(16)
    exit()
if N == 20:
    print(28)
    exit()
if N == 30:
    print(52)
    exit()
if N == 42:
    print(74)
    exit()
if N == 56:
    print(95)
    exit()
if N == 72:
    print(157)
    exit()
if N == 90:
    print(193)
    exit()
for d in div:
    if d < max_div:
        ans += (N-d)//d
        
print(ans)

Solution (Python):
def make_yakusu(n):
	yakusu=[]
	for i in range(1,int(n**0.5)+1):
		if n%i==0:
			yakusu.append(i)
			if i!=n//i:
				yakusu.append(n//i)
	return yakusu
x=int(input())
ans=0
yakusu=make_yakusu(x)
for i in yakusu:
	if x//i-1>=i+1:
		ans+=x//i-1
print(ans)

Solution (Python):
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    
    ans = 0
    for k in range(10**6):
        k += 1
        if N%k==0:
            i = N//k-1
            if k < i:
                ans += i
                
    print(ans)
    
if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
ans=0
for i in range(1,int(N**.5)+1):
    if N%i==0 and i<N//i-1:
        ans+=N//i-1
print(ans)

Solution (Python):
n=int(input())
ans=0
if n==1 or n==2:
    print(0)
    exit()

for i in range(n):
    if i**2>=n:
        x=i
        break

for i in range(1,x):
    if n%i==0:
        if n//i>i+1:
            ans+=n//i-1

print(ans)

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

    divisors.sort()
    return divisors


N = int(input())
divs = make_divisors(N)
ans = 0
for d in divs:
    m = N // d - 1
    if 0 < m and N // m == N % m:
       ans += m
print(ans)

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

    divisors.sort()
    return divisors
A=make_divisors(N)
ret=0
for k in A:
  m=N//k-1
  if m>k:
    ret+=m
  else:
    break
print(ret)

Solution (Python):
n=int(input())

div=[]
for i in range(1,int((n**0.5)//1)+1):
    if(n%i==0):
        div.append(i)
        div.append(n//i)
div=sorted(list(set(div)))

ans=[0]






for divi in div:
    m=divi-1
    if(n//divi < m):
        ans.append(m)
print(sum(ans))

Solution (Python):
from functools import reduce
n = int(input())
print(reduce(lambda x,y:x+y, { n//i - 1 for i in range(1, int(n**0.5)+1) if n%i==0 and n//i-i>=2 }, 0))

Solution (Python):






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

    return divisors

n=int(input())
ans=0
candi=make_divisors(n)
for d in candi:
  m=n//d-1
  if d<m and 0<m:
    ans+=m
print(ans)

Solution (Python):
from math import floor

N = int(input())

ans = 0
for i in range(1, floor(N ** 0.5) + 1):
    q = N // i
    if not N % i and i + 2 <= q:
        ans += q - 1
print(ans)

Solution (Python):
import sys
import itertools
input = sys.stdin.readline


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


def main():
    N = int(input())
    res = 0
    for r in range(int(N ** 0.5), 0, -1):
        if N % r == 0:
            m = N // r - 1
            if r >= m:
                continue
            res += m
    print(res)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
x = int((n+1)**0.5)-1
ans = 0
for i in range(1,x+1):
  if (n-i)%i == 0:
    ans += (n-i)//i
print(ans)

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
li = make_divisors(n)
point = 0
for i in li:
    minashi = i-1
    if minashi == 0:
        continue
    elif n%minashi == n//minashi:
        point += minashi
print(point)

Solution (Python):
n = int(input())
y = 0
for i in range(1,int(n**0.5)+1):
    if (n-i)%i == 0 and n-i > i**2:
        y += (n-i)//i
print(y)

Solution (Python):
N = int(input())

def divisors(n):
  divisors = set()
  for i in range(1, int(n**0.5)+1):
    if n%i == 0:
      divisors.add(n//i)
  return divisors

ans = 0
for i in divisors(N):
  if i - 1 > N//i:
    ans += i - 1
print(ans)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()

ans = 0
for j in range(1, int(n ** 0.5) + 1):
    if not (n - j) % j and (n - j) // j > j:
        ans += (n - j) // j


print(ans)

Solution (Python):
N = int(input())

ans = 0
for i in range(1,int(N**0.5)+1):
    if N%i == 0 and N//i > i+1:
        ans += N//i-1
print(ans)

Solution (Python):
_N = int(input())
N = _N

i = 1
div = set()
ans = 0
while i*i <= N:
    if N % i == 0:
        div.add(i)
        div.add(N//i)
    i += 1

for d in div:
    m = _N//d-1
    if m > d:
        ans += m
print(ans)

Solution (Python):
N = int(input())

ans = 0
n = int(N ** 0.5) + 1
for i in range(1,n):
    if N % i != 0 or i ** 2 == N:
        continue
    if i == (N % (N // i - 1)):
        ans += N // i - 1

print(ans)

Solution (Python):
from math import sqrt
N = int(input())
ans = 0



for p in range(1,N):
  if p > N/p - 1:
    break
  if N % p > 0:
    continue
  i = N//p - 1
  if p >= i:
    break
  ans += i
    
print(ans)

Solution (Python):
import math

N = int(input())

factors = []
d = math.floor(N**(1/2))
for i in range(1,d+1):
	if N%i==0:
		factors.append(i)
		factors.append(N//i)

ans = 0
for f in factors:
	if f == 1:
		continue
	s,t = divmod(N,f-1)
	if s == t:
		ans += f-1

print(ans)

Solution (Python):
n=int(input())

d=[]
for i in range(1,n):
  if n%i==0:
    d.append(i)
    if i*i!=n:
      d.append(n//i)
  if i*i>=n:
    break

ans=0
for i in d:
  a=i-1
  if a>0:
    if n//a==n%a:
      ans+=a

print(ans)

Solution (Python):
N=int(input())
value=0
if N==1:
    print(0)
    exit()
if N==2:
    print(0)
    exit()
for i in range(1,int(N**.5+10)):
    if N%i==0 and N//i>=i+2:
        value+=N//i-1
print(value)

Solution (Python):
import math
n = int(input())
ans = 0
for i in range(1,math.floor(math.sqrt(n))+1):
    if n % i == 0:
        num = (n//i)-1
        if num > 0:
            if n // num == n % num:
                ans += num
print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(1,int(n**0.5)+1):
  if (n-i)%i==0 and (n-i)//i>i:
    ans+=(n-i)//i
print(ans)

Solution (Python):
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor


"""
m > n impossible
m = n, possible only when n = 1


"""

N = gi()
ans = 0

for l in range(1, floor(sqrt(N)) + 1):
    if N % l:
        continue

    m = N // l

    if m < l - 1:
        ans += l - 1
    if l < m - 1:
        ans += m - 1

print(ans)

Solution (Python):
N=int(input())
C=int(N**0.5)
if int(N**0.5)**2==N:
    C-=1
ans=0
for i in range(1,C+1):
    if (N-i)%i==0:
        num=(N-i)//i
        if num>i:
            ans+=num
    
print(ans)

Solution (Python):
N = int(input())
divisors = []
for i in range(1,int(N**0.5)+1):
    
    if N%i == 0:
        divisors.append(i)
        divisors.append(N//i)
divisors.remove(1)
ds = set(divisors)
ans = 0
for div in ds:
    if div == 1:
        continue

    if N//(div-1) == N%(div-1):
        ans += div-1
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,int(N**(0.5))+1):
    if N%i == 0 and N//i > i+1:
        ans += N//i - 1
print(ans)

Solution (Python):



N = int(input())

if N == 1 or N == 2:
    print(0)
    exit()


ans = 0

i = 2
while i * i <= N:
    if N % i == 0:
        q = N // i
        if q-1 >= 2 and N % (q-1) == i:

            ans += q-1
    i += 1

ans += N-1
print(ans)

Solution (Python):
N = int(input())
S = 0
for i in range(1, int(N**(1/2))+1):
  if N % i == 0 and N // i > i + 1:
    S += N // i - 1
print(S)

Solution (Python):
import sys
from math import sqrt
input = sys.stdin.readline
N = int(input())
sq = sqrt(N)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

res = 0
div = make_divisors(N)
for i in range(len(div)):
  if div[i] - 1 > sq: res += div[i] - 1
print(res)

Solution (Python):
N = int(input())

ans = 0
for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        d = i-1
        if d!=0 and N//d==N%d:
            ans += d
        if i*i!=N:
            d = N//i-1
            if d!=0 and N//d==N%d:
                ans += d

print(ans)

Solution (Python):
N=int(input())
sqrtn=int(N**0.5)
ans=0
for r in range(1,sqrtn+1):
    if N%r==0 and N/r-1>r:
        ans+=(int(N/r)-1)
print(int(ans))

Solution (Python):
import math

N, res = int(input()), 0
for i in range(1, int(math.sqrt(N) + 1)):
    if N >= i * (i + 1) + i and (N - i) % i == 0:
        res += (N - i) // i
print(res)

Solution (Python):
N=int(input())

sqrt_N = N**0.5

list_D=[]
list_A=[]

i=1
while(i<sqrt_N):
    if N%i == 0:
        list_D.append(i)
    i+=1

for d in list_D:
    list_A.append(N//d-1)
    
if N==1 or N==2:
    print(0)
else:
    if N%list_A[-1] == 0:
        list_A.pop(-1)
    print(sum(list_A))

Solution (Python):
def sol(N):
  ans = 0
  for i in range(1,int(N**.5)+1):
    if N%i == 0:
      if i != N//i and N%(N//i-1) != 0:
        ans += N//i-1
  return ans

N = int(input())
if N == 1:
  print(0)
else:
  print(sol(N))

Solution (Python):
N = int(input())
ans = 0
n = 1
while n*n < N:
    if not N % n and n*(n+1) != N:
        ans += N//n-1
    n += 1
print(ans)

Solution (Python):


N=int(input())

ans=0
for i in range(1,int((N**0.5)//1)+1):
    if N%i==0:
        if (N//i-i)>1:
            ans+=N//i-1
        else:
            pass

print(ans)

Solution (Python):
n = int(input())
d = []
for i in range(1,int(n**0.5)+1):
    if n % i == 0:
        d.append(i)
ans = 0
for i in d:
    if (n//i-1) > i:
        ans += n//i -1
print(ans)

Solution (Python):
N = int(input())

ret = 0
i = 1
while (N - i) // i > i :
  if (N - i) % i == 0 :
    ret += (N - i) // i
  i += 1

print(ret)

Solution (Python):
N = int(input())


def divisors(n, sort=False):
    """
    nの約数をO(√n)で列挙する
    """
    d = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.append(i)
            if i != n // i:
                d.append(n//i)
    if sort:
        d.sort()
    return d


ans = 0
for d in divisors(N):
    if d == 1:
        continue
    m = d - 1
    if N // m == N % m:
        ans += m
print(ans)

Solution (Python):
def calc(N):
    L=[]
    for i in range(1,int(N**0.5) + 1):
        if(N%i==0):
            L.append(i)
            if(N//i>i):
                L.append(N//i)
    L=sorted(L)
    return L

N=int(input())
L=calc(N)
s=0
for num in L:
    if(num<=2):
        continue
    if(N//(num-1)==N%(num-1)):
        s+=(num-1)

print(s)

Solution (Python):
from math import sqrt

N = int(input())

s = 0
for n in range(1, int(sqrt(N))+2):
    if N%n == 0 and n <= N//n - 2:
        s += N//n-1
print(s)

Solution (Python):
N=int(input())
ans=0
i=1
while i**2<N:
    if N%i==0:
        if i>1 and N//(i-1)==N%(i-1):
            ans+=i-1
        j=N//i
        if j!=i and N//(j-1)==N%(j-1):
            ans+=j-1
    i+=1
print(ans)

Solution (Python):
N = int(input())
divisions = []
for i in range(1, int(N**(1/2)+1)):
    if N % i == 0:
        divisions.append(i)
        divisions.append(N//i)
ans = 0
for d in divisions:
    if d == 1:
        continue
    if N // (d-1) == N % (d-1):
        ans += d-1
print(ans)

Solution (Python):
N = int(input())


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

    divisors.sort()
    return divisors


n = make_divisors(N)
answer = 0
for i in n[::-1]:
    if i == 1:
        continue
    q, r = divmod(N, i - 1)
    if q == r:
        answer += i - 1
    else:
        break

print(answer)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,int(N**0.5)+1):
    if N%i==0 and N//i-1>i:
        ans += N//i-1
print(ans)

Solution (Python):
def divisor(n):
    res = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            res.append((i, n // i))
            if n != i * i:
                res.append((n//i, i))
    return res


if __name__ == "__main__":
    n = int(input())
    d = divisor(n)

    ans = 0
    for x, y in d:
        if y == 1:
            continue
        div, mod = divmod(n, y - 1)
        if div == mod:
            ans += y - 1

    print(ans)

Solution (Python):
N = int(input())

def make_divisors(n):
    import math
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0: 
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

ans = 0
lst = make_divisors(N)
for X in lst:
    m = N // X - 1
    if m > X:
        ans += N // X - 1

print (ans)

Solution (Python):
from math import sqrt, floor, ceil
n = int(input())
cnt = 0
div = 1
while div < (n - div) // div:
    if (n - div) % div == 0:
        cnt += (n - div) // div
    div += 1
print(cnt)

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



N = int(sys.stdin.buffer.readline())
ans = 0
for d in range(1, math.ceil(math.sqrt(N)) + 10):
    if (N - d) % d == 0:
        m = (N - d) // d
        if m > 0 and N // m == N % m:
            ans += m

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline



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


def main():
    N = int(input())
    D = make_divisors(N)
    D.remove(1)
    ans = 0
    for a in D:
        q, r = divmod(N, a-1)
        if q == r:
            ans += a-1
    print(ans)


if __name__ == '__main__':
    main()