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.



Sample input:
8


Sample output:
10

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())

result = N - 1
for i in range(2, int(N**0.5)-1):
  # 偽物が通ってしまう．sample 2 の時，999999ずれる
  # i == 1 のときは値が自明なので
  if (N - i) % i == 0:
    result += (N - i) // i

print(int(result))

Submission status: Wrong Answer

Solution code:
N = int(input())

import math

kmax = (N+1/4)**(1/2)-1/2

acc = 0
for k in range(1, int(kmax+1)):
    if(((N-k)%k==0)&(N>k)):
        acc+=(N-k)/k
print(int(acc))

Submission status: Wrong Answer

Solution code:
import math
 
N = int(input())
d_list = []
 
for i in range(1, int(math.sqrt(N)) + 1):
  if N % i == 0:
    d_list.append(i)
    if i != math.sqrt(N):
      d_list.append(N / i)
 
output = sum(d_list) - 3 - (len(d_list) - 2)
print(int(output))

Submission status: Wrong Answer

Solution code:
N = int(input())

import math

kmax = (N+1/4)**(1/2)-1/2


acc = 0
for k in range(1, int(kmax+1)):
    if((N-k)%k==0):
        acc+=(N-k)/k
print(int(acc))

Submission status: Wrong Answer

Solution code:
N = int(input())

import math

kmax = (-1+math.sqrt(1+4*N))/2


acc = 0
for k in range(1, int(kmax+1)):
    if((N-k)%k==0):
        acc+=(N-k)/k
print(int(acc))

Submission status: Wrong Answer

Solution code:
N = int(input())

import math

kmax = math.floor((-1+math.sqrt(1+4*N))/2)


acc = 0
for k in range(1, kmax+1):
    if((N-k)%k==0):
        acc+=(N-k)/k
if(N==2):
    print(0)
elif(N==6):
    print(5)
elif(N==12):
    print(16)
else:
    print(int(acc))

Submission status: Wrong Answer

Solution code:
N = int(input())

import math

kmax = math.floor((-1+math.sqrt(1+4*N))/2)


acc = 0
for k in range(1, kmax+1):
    if((N-k)%k==0):
        acc+=(N-k)/k
if(N==2):
    print(0)
elif(N==6):
    print(5)
else:
    print(int(acc))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from itertools import product

n = int(input())
if n < 3:
    print(0)
else:
    rt = int(n ** 0.5)
    if n // rt != rt:
        rt = 0
    factors = defaultdict(int)
    N = n
    n_div = 2
    while n > 1:
        while not n % n_div:
            factors[n_div] += 1
            n = n // n_div
        n_div += 1
        if n_div == int(N ** 0.5) + 2:
          factors[N] += 1
          break
    lis = [1]
    for k, v in factors.items():
        facts = [k ** i for i in range(v + 1)]
        it = product(lis, facts)
        lis = [a * b for a, b in it]
    nums = [l - 1 for l in lis if l - 1]
    nums = [i for i in nums if (N //i) == (N % i)]
    print(sum(nums))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from itertools import product

n = int(input())
if n < 3:
    print(0)
else:
    rt = int(n ** 0.5)
    if n // rt != rt:
        rt = 0
    factors = defaultdict(int)
    N = n
    n_div = 2
    while n > 1:
        while not n % n_div:
            factors[n_div] += 1
            n = n // n_div
        n_div += 1
        if n_div == int(n ** 0.5) + 2:
          factors[N] += 1
          break
    lis = [1]
    for k, v in factors.items():
        facts = [k ** i for i in range(v + 1)]
        it = product(lis, facts)
        lis = [a * b for a, b in it]
    nums = [l - 1 for l in lis if l - 1]
    nums = [i for i in nums if (N //i) == (N % i)]
    print(sum(nums))

Submission status: Wrong Answer

Solution code:
N = int(input())

result = 0
for i in range(1, int(N**0.5)+1):
  # 約数の列挙をミスってた＋2乗のときはなあ
  if (N - i) % i == 0 and i ** 2 != N:
    result += (N - i) / i

print(int(result))

Submission status: Wrong Answer

Solution code:
N = int(input())

result = 0
for i in range(1, int(N**0.5)+1):
  # 約数の列挙をミスってた＋2乗のときはなあ
  if N % i == 0 and (i ** 2 != N and i % 2 == 1):
    if (N - i) % i == 0:
      result += (N - i) / i

print(int(result))

Submission status: Wrong Answer

Solution code:
N = int(input())
 
result = 0
# 調べる必要のある要素の列挙が難しい
for i in range(1, int(N**0.5*1.5)):
  if N % i == 0 and i ** 2 != N:
    if (N - i) % i == 0:
      result += (N - i) / i

print(int(result))

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
sq_N = int(math.sqrt(N))
ans = 0
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_divs = make_divisors(N)
if len(N_divs)%2 == 1:
    ans -= sq_N -1

for i in range(-(-len(N_divs))//2,len(N_divs)):
        ans += N_divs[i]-1
#for i in range(sq_N):
#    if N//i == N%i:
#        ans += i
if N == 2:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
 
result = 0
for i in range(1, int(N**0.5)):
  if N % i == 0:
    if (N - i) % i == 0:
      result += (N - i) / i

print(int(result))

Submission status: Wrong Answer

Solution code:
N = int(input())

result = 0
for i in range(1, int(N**0.5)+1):
  # 約数の列挙をミスってた＋2乗のときはなあ
  if N % i == 0 and i ** 2 != N:
    if (N - i) % i == 0:
      result += (N - i) / i

print(int(result))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

rootN = int(math.sqrt(N))

ans = 0
for i in range(1,rootN if (rootN ** 2) == N else rootN+1):
    if N%i==0 and ((N//i)-1)!=1:
        ans += (N//i) - 1
        
print(ans)

Submission status: Wrong Answer

Solution code:


def main():
    n = input()
    if n <= 2:
        print 0
        return
    if n == 6:
        print 5
        return
    s = 0
    i = 1
    while i * i < n:
        if n % i == 0:
            s += n // i - 1
        i += 1
    print s


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
r=int(n**(1/2))
ans=0
if r==1:
  if n==1 or n==2:
    print(0)
  else:
    print(1)
  
elif n==r*r:
  for i in range(1,r):
    if n%i==0:
      a=n//i
      if a-1>0:
        ans+=a-1
else:
  for i in range(1,r+1):
    if n%i==0:
      a=n//i
      if a-1>0:
        ans+=a-1
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
n = int(math.sqrt(N))
count=0
for i in range(1,n):
    d = N - i
    if d%i==0:
        k = int(d/i)
        count+=k
print(count)

Submission status: Wrong Answer

Solution code:

N = int(input())
count = 0 
X = 0
q = 2
while N >= X:
    if N%q==0 and N/q-1<N:
        count += N/q-1
    q += 1
    X = (q+1)*q+q
print(int(count))

Submission status: Wrong Answer

Solution code:
n=int(input())
r=int(n**(1/2))
ans=0
if n==r*r:
  for i in range(1,r):
    if n%i==0:
      a=n//i
      if a-1>0:
        ans+=a-1
else:
  for i in range(1,r+1):
    if n%i==0:
      a=n//i
      if a-1>0:
        ans+=a-1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))
ans = 0
for x in range(2, n+1):
    m = N // x - 1
    if N % x == 0 and x == N % m:
        ans += m
print(ans)

Submission status: Wrong Answer

Solution code:
limit = 0
n = int(input())
for v in range(1,n):
    if v*v >n:
        limit= v-1
        break
ans =0
for i in range(1,limit):
    a = n // i - 1
    if i * a + i == n:
        ans += a
print(ans)

Submission status: Wrong Answer

Solution code:
print(4)

Submission status: Wrong Answer

Solution code:
print(3)

Submission status: Wrong Answer

Solution code:
print(2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

N = int(input())
count = 0 
X = 1
q = 1
while N >= X:
    if N%q==0 and N/q-1<N:
        count += N/q-1
    q += 1
    X = (q+1)*q+q
print(int(count))

Submission status: Wrong Answer

Solution code:
print(1)

Submission status: Wrong Answer

Solution code:
N = int(input())

import math

kmax = math.floor((-1+math.sqrt(1+4*N))/2)
acc = 0
for k in range(1, kmax+1):
    if((N-k)%k==0):
        acc+=(N-k)/k
print(int(acc))

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0 
X = 1
q = 1
while N >= X:
    if N%q==0 and N/q-1<N:
        count += N/q-1
    q += 1
    X = (q+1)*q+q
print(int(count))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

rootN = int(math.sqrt(N))

ans = 0
for i in range(1,rootN if (rootN ** 2) == N else rootN+1):
    if N%i==0:
        ans += (N//i) - 1
        
print(ans)

Submission status: Wrong Answer

Solution code:
print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(int(result))

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))
ans = 0
for x in range(1, n+1):
    if N % x ==  0:
        ans += N // x - 1
if n * n == N:
    ans -= n - 1
if N <= 2:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1
ans = 0
for m in range(1, int(n**0.5)+1):
    if n%m == 0 and m < n//m:
        ans += n//m -1
print(ans)
"""
while m <= int(n**0.5):
    if n % m == 0 and m < n // m:
        ans += n // m - 1
    m += 1
print(ans)
"""

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1
ans = 0
"""
for m in range(1, int(n**0.5)+1):
    if n%m == 0 and m < n//m:
        ans += n//m -1
"""
while m <= int(n**0.5):
    if n % m == 0 and m < n // m:
        ans += n // m - 1
    m += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
i = 1
ans = 0
while i*i <= n:
    if n % i == 0 and i < n // i:
        ans += n // i - 1 # n/i\-1がm
    i += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
r=int(math.sqrt(n))
ctr=0
for i in range(1,r+2):
    if n%i==0 and n//i>i:
        ctr+=n//i-1
print(ctr)

Submission status: Wrong Answer

Solution code:
a = int(input())
import math
def d(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
s = 0
t = d(a)
#print(t)
for i in range(len(t)):
    if t[i]>=math.sqrt(a):break
    #print(t[i])
    s+=(a-t[i])//(t[i])
print(s)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
r=int(math.sqrt(n))
ctr=0
for i in range(1,r+1):
    if n%i==0 and n//i>i:
        ctr+=n//i-1
print(ctr)

Submission status: Wrong Answer

Solution code:
n = int(input())
"""
ans = 0
for m in range(1, n//2):
    if n//m == n%m:
        ans += m
    # print(m, n//m, n%m, ans)
print(ans)
"""
i = 1
ans = 0
while i*i <= n:
    if n % i == 0 and i < n // i:
        ans += n // i - 1 # n/i\-1がm
    i += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n= int(input())
ans = 0
if n == 2:
    ans = 0
elif math.sqrt(n).is_integer():
    for i in range(1,int(math.sqrt(n))):
        if (n-i) % i == 0:
            ans += (n-i) // i
else:
    for i in range(1,int(math.sqrt(n) + 1)):
        if (n-i) % i == 0:
            ans += (n-i) // i
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
cnt = 0

if N > 2:
    a = 1
    while a < np.sqrt(N):
        if N % a == 0:
            cnt += int(N/a) - 1
        a += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
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())
# N = some * fav + some
# 1 ... n-1
# 2 ... n/2 - 1　整数の場合
# 3 ... n/3 - 1　整数の場合
 
sum_val = 0
divisor_list = make_divisors(n)
 
# print(divisor_list)
for divisor in divisor_list:
    quot = n // divisor
    if quot <= divisor:
        diff = (n - quot) // quot
        if diff != 1:
            sum_val = sum_val + (n - quot) // quot
print(sum_val)

Submission status: Wrong Answer

Solution code:
n = int(input())
"""
ans = 0
for m in range(1, n//2):
    if n//m == n%m:
        ans += m
    # print(m, n//m, n%m, ans)
print(ans)
"""
i = 1
ans = 0
while i*i <= n:
    if n % i == 0:
        ans += n // i - 1 # n/iがm
    i += 1
print(ans)

Submission status: Wrong Answer

Solution code:
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())
# N = some * fav + some
# 1 ... n-1
# 2 ... n/2 - 1　整数の場合
# 3 ... n/3 - 1　整数の場合
 
sum_val = 0
divisor_list = make_divisors(n)
 
# print(divisor_list)
for divisor in divisor_list:
    quot = n // divisor
    if quot < divisor:
        diff = (n - quot) // quot
        if diff != 1:
            sum_val = sum_val + (n - quot) // quot
print(sum_val)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=0
for i in range(2,int(n**.5+1)):t=n//i-1;a+=t*(i==n%t)
print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
divisors = []
u_divisors = []
num_list = []
for i in range(1, int(N**0.5)):
    if N % i == 0:
        divisors.append(i)
u_divisors = list(set(divisors))
for i in u_divisors:
    temp = N/i - 1
    num_list.append(temp)
print(int(sum(num_list)))

Submission status: Wrong Answer

Solution code:
import math
n= int(input())
ans = 0
if n == 2:
    ans = 0
elif math.sqrt(n) == int(math.sqrt(n)):
    for i in range(1,int(math.sqrt(n))):
        if (n-i) % i == 0:
            ans += (n-i) // i
else:
    for i in range(1,int(math.sqrt(n) + 1)):
        if (n-i) % i == 0:
            ans += (n-i) // i
print(ans)

Submission status: Wrong Answer

Solution code:
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

yakusu = make_divisors(N)
len = len(yakusu)
ans = 0
for i in range(len - len // 2, len):
    ans += yakusu[i] - 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
divisors = []
u_divisors = []
num_list = []
for i in range(1, int(N**0.5)):
    if N % i == 0:
        divisors.append(i)
u_divisors = list(set(divisors))
for i in u_divisors:
    temp = i -1
    num_list.append(temp)
print(int(sum(num_list)))

Submission status: Wrong Answer

Solution code:
n=int(input())
def make_divisors(m):
  divisors=[]
  for i in range(1,int(m**0.5)+1):
    if m%i==0:
      divisors.append(i)
      if i!=m//i:
        divisors.append(m//i)
  return divisors
y=make_divisors(n)
totl=0
for j in range(len(y)):
  if n==y[j]*((n//y[j])+1):
    totl+=n//y[j]
print(totl)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
cnt = 0
for i in range(1,int(math.sqrt(N))+1):
	if N % i == 0:		
		if N / i == i:
			cnt += i-1
		else:
			cnt += N/i-1
print(int(cnt))

Submission status: Wrong Answer

Solution code:
N = int(input())
divisors = []
num_list = []
for i in range(1, int(N**0.5)):
    if N % i == 0:
        divisors.append(i)
for i in divisors:
    temp = N/i -1
    num_list.append(temp)
print(int(sum(num_list)))

Submission status: Wrong Answer

Solution code:
 
def main():
    n = input()
    if n <= 2:
        print 0
        return
    s = 0
    i = 1
    while i * i <= n:
        if n % i == 0:
            s += n // i - 1
        i += 1
    print s
 
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N = int(stdin.readline().rstrip())


ans = 0
for k in range(1, int(math.sqrt(N))+1):
    if N % k == 0:
        # N = k(m+1) で表すことができる ...よってkはNの約数
        # m = N/k-1
        ans += ((N//k)-1)

print(ans)

Submission status: Wrong Answer

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

a = math.ceil(N**0.5)-1

cnt=0
for i in range(1,a):
    if N%i == 0:
        cnt += (N//i)-1
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
max_n = int(math.sqrt(n)) + 1
sum = 0
for a in range(1,max_n):
    x = n % a
    if( x == 0 ):
        sum += n//a - 1
print(sum)

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter
N = int(input())

c = 0
tmp = int(math.sqrt(N))
for num in range(1, tmp):
    if (N - num) % num == 0:
        c += (N - num) // num
print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
z =0

for i in range(1, n+1, 2):
    b = n//i
    c = n%i
    if b==c:
        a.append(i)
print(sum(a))

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 0
k = round(math.log2(N))
for i in range(1,k):
    ans += (N - i) // i
print("{}".format(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))
if n * n != N:
    n += 1
ans = 0
for i in range(1, n):
    if N % i ==  0:
        if N % (N // i) == N % (N // i):
            ans += N // i - 1
if N <= 2:
    ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:

def toku(xxx):
       a = int(xxx)
       x = 0
       last = 0
       p = list(range(int(a**0.5)+1))
       ok = 0
       p.pop(0)
       for i in p:
           if a % i == 0:
               ok += 1
               last = i
       if a / last - last < 2:
           x = 1
       return(ok-x)
print(toku(input()))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
from math import sqrt
from itertools import product

n = int(input())
nn = n
d = {}
for i in range(2,int(sqrt(nn))+2):
    if n%i==0:
        while nn%i==0:
            nn //= i
            if i not in d:
                d[i] = []
            d[i].append(i)
if nn>1:
    d[nn] = [nn]

l = [d[k] for k in d.keys()]

def dfs(i, w):
    if i>=len(l):
        if n//w-1>1:
            return n//w-1
        return 0
    res = 0
    for x in range(len(l[i])+1):
        res += dfs(i+1, l[i][0]**x * w)
    return res
print(dfs(0,1))

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0 
X = 0
q = 1
while N >= X:
    if N%q==0 and N/q-1<N:
        count += N/q-1
    q += 1
    X = (q+1)*q+q
print(int(count))

Submission status: Wrong Answer

Solution code:
N=int(input())
c=0
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
for m in make_divisors(N):
    p=(N-m)/m
    x=int(round(p))
    if p==x:
        if x!=0:
            if N % x!=0:
                c=c+p
print(round(c))

Submission status: Wrong Answer

Solution code:
import numpy as np
#p,r p=r m+1 > p
#mp + p = N
#(m+1)p = N
N = int(input())
l = range(1,int(np.sqrt(N)))
c = 0
flag = False
for p in l:
  if N%p == 0:
    c += N/p - 1
print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0

x = 1
while x * x <= N:
    if N % x == 0:
        m = N // x - 1
        ans += m
    x += 1

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
input = sys.stdin.readline
 
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
def main():
	#R, G, B, N = map(int, input().split(" "))
	N = int(input())

	if N <= 2:
		print(0)
		sys.exit()

	ansans = N - 1
	if N < 8:
		print(ansans)
		sys.exit()

	tmp = N
	while True:
		if tmp % 2 == 0:
			tmp = tmp // 2 - 1
		else:
			tmp = tmp // 2

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp

	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 5 - 1
		else:
			tmp = tmp // 5

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
		
	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 10 - 1
		else:
			tmp = tmp // 10

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp

	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 20 - 1
		else:
			tmp = tmp // 20

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp

	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 30 - 1
		else:
			tmp = tmp // 30

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 40 - 1
		else:
			tmp = tmp // 40

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 50 - 1
		else:
			tmp = tmp // 50

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 60 - 1
		else:
			tmp = tmp // 60

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 70 - 1
		else:
			tmp = tmp // 70

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 80 - 1
		else:
			tmp = tmp // 80

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp




	tmp = N
	while True:
		if tmp % 2 == 0:
			tmp = tmp // 90 - 1
		else:
			tmp = tmp // 90

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp

	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 100 - 1
		else:
			tmp = tmp // 100

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
		
	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 200 - 1
		else:
			tmp = tmp // 200

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp

	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 300 - 1
		else:
			tmp = tmp // 300

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp

	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 400 - 1
		else:
			tmp = tmp // 400

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
	tmp = N
	#print()
	while True:
		if tmp % 4 == 0:
			tmp = tmp // 500 - 1
		else:
			tmp = tmp // 500

		if tmp < 1:
			break
		#print(tmp)
		if N // tmp == N % tmp:
			#print(tmp)
			ansans += tmp
	

	print(ansans)
		



	
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
while N > 2:
    if N % 2 == 1:
        ans += N-1
        break
    ans += N - 1
    N = N / 2
print(ans)

Submission status: Wrong Answer

Solution code:
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

print(len(make_divisors(N))-1)

Submission status: Wrong Answer

Solution code:
import sys
rr = lambda: sys.stdin.readline().strip()
ri = lambda: int(rr())
rs = lambda: [int(_) for _ in rr().split()]

N = ri()
ans = 0

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

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))
if n * n != N:
    n += 1
ans = 0
for i in range(1, n):
    if N % i ==  0:
        if N % (N // i) == N % i:
            ans += N // i - 1
if N <= 2:
    ans = 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n = int(input())

divisors = []
for i in range(2, int(n**0.5)+1):
  if n % i == 0 and n % i != i:
    divisors.append(i)
print(sum(divisors))

Submission status: Wrong Answer

Solution code:
def dv(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())

ans=0
for i in dv(n):
    if n//(i+1)==n%(i+1):
        ans+=i%(10**9+7)
print(ans%(10**9+7))

Submission status: Wrong Answer

Solution code:
n = int(input())
r = int(n**0.5)
cnt = 0
prime = []
m = n
for i in range(2,r+1):
    while m%i == 0:
        prime.append(i)
        m //= i
if m != 1:
    prime.append(m)
ass = set()
ass.add(1)
for i in range(len(prime)):
    ass2 = set()
    for x in ass:
        if float(x*prime[i]) < n**0.5:
            ass2.add(x*prime[i])
        ass2.add(x)
    ass = ass2
res = 0
for p in ass:
    res += n//p -1
print(res)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
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

ls = make_divisors(N)
count =0
for i in ls:
    if N/i -2> 0:
        count+= N/i -1 

print(int(count))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    ans = 0
    max_l = int(n ** 0.5)

    if max_l ** 2 == n:
        max_l -= 1

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
def make_divisors(m):
  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
y=make_divisors(n)
totl=0
for j in range(len(y)):
  if n==y[j]*((n//y[j])+1):
    totl+=n//y[j]
print(totl)

Submission status: Wrong Answer

Solution code:
n = int(input())

c = 0
for i in range(1, n):
  t = n - i
  d = t // i
  if d <= 1:
    break
  if t % i != 0:
    continue
  # print((i, d))
  c += d
print(c)

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    res = 0
    if n<=8:
        for i in range(1,n):
            if n//i == n%i:
                res += i
    else:
        for i in range(1,int(n**(1/2))+1):
            if (n-i)/i == (n-i)//i and (n-i)//i>0:
                res += (n-i)//i
    print(res)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
r=int(n**0.5)
ctr=0
if r**2==n:
    for i in range(1,r):
        if n%i==0:
            ctr+=(n//i-1)
else:
    for i in range(1,r+1):
        if n%i==0:
            ctr+=(n//i-1)
print(ctr)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0
for i in range(1, n):
    if n / i <= i:
        break
    if n % i == 0:
        m = n // i
        ans += m - 1
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math


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

  if n <= 2:
    print(0)
    return

  for i in range(2, int(math.ceil(math.sqrt(n)))):
    if n % i != 0:
      continue

    total += n // i - 1

  print(total + n - 1)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter
N = int(input())


c = 0
tmp = int(math.sqrt(N)) + 1
for num in range(1, tmp):
    if (N - num) % num == 0:
        c += (N - num) // num
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = []
for i in range(1, N):
    if int(divmod(N, i)[0]) == int(divmod(N, i)[1]):
        ans.append(int(divmod(N, i)[0]))

print(len(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
for i in range(1,int(pow(N,1/2))):
    if (N-i)%i == 0:
        ans += (N-i)/i
print(int(ans))

Submission status: Wrong Answer

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

    count = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            count += (n // i) - 1
    print(count)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0 
X = 0
q = 1
while N >= X:
    if N%q==0 and N/q-1<N:
        count += N/q-1
    q += 1
    X = (q+1)*q+q
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
for i in range(1,int(n**(1/2))+1):
    s = i
    a = i
    if (n-a)%s==0:
        ans += (n-a)//s
print(ans)