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 itertools
n=int(input())
ans=0
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
y=factorize(n)
AA=[]
for i in range(2,len(y)+1):
    l=list(itertools.combinations(y, i))
    l=set(l)


    for j in l:
        A=1
        for I in j:
            A*=I
        
        if n//(A-1)==n%(A-1) and not A-1 in AA:
            ans+=A-1
            AA+=[A-1]
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
n=int(input())
ans=0
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
y=factorize(n)
AA=[]
for i in range(2,len(y)+1):
    l=list(itertools.combinations(y, i))
    l=set(l)


    for j in l:
        A=1
        for I in j:
            A*=I
        
        if n//(A-1)==n%(A-1) and not A in AA:
            ans+=A-1
            AA+=[A-1]
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
n=int(input())
ans=0
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
y=factorize(n)
for i in range(2,len(y)+1):
    l=list(itertools.combinations(y, i))
    l=set(l)

    for j in l:
        A=1
        for I in j:
            A*=I
        if n//(A-1)==n%(A-1):


            ans+=A-1
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
n=int(input())
ans=0
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
y=factorize(n)
for i in range(2,len(y)+1):
    l=list(itertools.combinations(y, i))
    l=set(l)

    for j in l:
        A=1
        for I in j:
            A*=I
        if n//(A-1)==n%(A-1):
            print(A)

            ans+=A-1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(raw_input())

sq = int(N**0.5)
if sq*sq != N:
    sq += 1
s = 0
for i in xrange(1, sq):
    if N % i == 0:
        s += (N/i) - 1
        
print s

Submission status: Wrong Answer

Solution code:
def divisor(n):
    A = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            if n//i == i:
                A.append(i)
            else:
                A.append(i)
                A.append(n//i)
    A = [a-1 for a in A if a > 2]
    return A

n = int(input())
ans = sum(divisor(n))
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

sqrt_n = int(math.ceil(math.sqrt(N)))

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
val = []
max_len = [2,4]
def comb(val, max_len, depth=0):
    if depth==len(max_len):
        yield val
        return 

    for i in range(max_len[depth]+1):
        yield from comb(val+[i], max_len, depth+1)
# for it in comb(val, max_len):
# #     print('a')
#     print(it)


import math
def primeFactor(num):
    prime = {}
    x = 2
    MAX =  math.sqrt(num)+1
    while x <MAX:
        if num%x==0:
            if x in prime:
                prime[x] += 1
            else:
                prime[x]=1
            num //= x
        else:
            x += 1
    if num != 1:
        prime[x]=1
    return prime

divisor = primeFactor(N)


ans = 0
val = []
for it in comb(val, list(divisor.values())):
    total = 1
    for i, j in zip(list(divisor.keys()), it):
    #     print(i, j)
        total *= i**j
#     print(total)
    
    m = total - 1
    if m < 1:
        continue
    if N%m==N//m:
#         print('{0} mod {1} = {2}, {0}/{1} = {3}'.format(N, m, N%m, N//m))
        ans += m
        
print(ans)

Submission status: Wrong Answer

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


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

  if n <= 2:
    print(0)
    return

  for i in range(1, n):
    if i * (i + 1) >= n:
      break
    elif n % i != 0:
      continue
    else:
      total += n // i - 1

  print(total + n - 1)


if __name__ == '__main__':
  main()

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:
        i2 = N//i
        if i2 > i:
            ans += i2-1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

# 約数を列挙
def calc_divisors(x):
	ans = []
	for i in range(1, x//2 + 1):
		if x % i ==0: ans.append(i)
	return ans

ans = 0
divisors = calc_divisors(n)
for x in divisors:
    tmp = x-1
    if tmp>0 and n//tmp == n%tmp:
        ans += tmp
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
p_max=int((-1+(1+4*N)**0.5)/2)
ans=0

for p in range(1,p_max+1):
    if (N-p)%p ==0 and (N-p)//p >= 1:
        ans += (N-p)//p

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
k = int(1)
ans =  int(0)

while N>k**2 :
    if N%k==0:
        m = int(N//k-1)
        ans +=m
    k +=1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
k = int(1)
ans =  int(0)

while N>=k**2 :
    if N%k==0:
        m = int(N//k-1)
        ans +=m
    k +=1

print(ans)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
if n==1:
    print(0)
else:
    while(su<n):
        n_ = math.ceil(n*(stage-1)/stage)
        if n_ == su:
            nums.append(1)
            nums.append(n-su-1)
            break
        nums.append(n_-su)
        su+=n_-su
        if su>=ch:
            nums.append(n-su)
            break
        stage += 1
    ans=[]
    next_div_num = 0
    k=len(nums)
    for i in range(k):
        next_div_num += nums[k-1-i]
        if nums[k-1-i] == 1:
            continue
        sho = n//next_div_num
        d = next_div_num-1
        if d==0 or sho>d:
            continue
        if sho == n%d:
            ans.append(d)
        elif sho>n%d:
            d-=1
            if d==0 or sho>d:
               continue
            if sho == n%d:
                ans.append(d)
    print(sum(ans))

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
if n==1:
    print(0)
else:
    while(su<n):
        n_ = math.ceil(n*(stage-1)/stage)
        if n_ == su:
            nums.append(1)
            nums.append(n-su-1)
            break
        nums.append(n_-su)
        su+=n_-su
        if su>=ch:
            nums.append(n-su)
            break
        stage += 1
    ans=[]
    next_div_num = 0
    k=len(nums)
    for i in range(k):
        next_div_num += nums[k-1-i]
        if nums[k-1-i] == 1:
            continue
        sho = n//next_div_num
        d = next_div_num-1
        if d==0 or sho>d:
            continue
        if sho == n%d:
            ans.append(d)
    print(sum(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def prime_factors(n):
    i = 2
    factors = {}
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            if i in factors.keys():
                factors[i] += 1
            else:
                factors[i] = 1
    if n > 1:
        if n in factors.keys():
            factors[n] += 1
        else:
            factors[n] = 1
    return factors

i  = lambda: int(input())

N = i()

pfd = prime_factors(N)

check_num = []

for pf in pfd.keys():
    tmp_num = []
    for i in range(1, pfd[pf] + 1):
        tmp_num.append(pf ** i)
        for n in check_num:
            tmp_num.append(n * (pf ** i))
    check_num += tmp_num

count = 0
for n in check_num:
    if N / n < n  and N != n:
        count += n-1

print(count)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def prime_factors(n):
    i = 2
    factors = {}
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            if i in factors.keys():
                factors[i] += 1
            else:
                factors[i] = 1
    if n > 1:
        if n in factors.keys():
            factors[n] += 1
        else:
            factors[n] = 1
    return factors

i  = lambda: int(input())

N = i()

pfd = prime_factors(N)

check_num = []

for pf in pfd.keys():
    tmp_num = []
    for i in range(1, pfd[pf] + 1):
        tmp_num.append(pf ** i)
        for n in check_num:
            tmp_num.append(n * (pf ** i))
    check_num += tmp_num

count = 0
for n in check_num:
    if N / n < n:
        count += n-1

print(count)

Submission status: Wrong Answer

Solution code:
import math

N=int(input())
result=0

for i in range(1,int(math.sqrt(N))+1):
    if N%i==0 and i!=N//i:
        result+=N//i-1
print(result)
"""N=int(input())
A=[i-1 for i in range(3,N+1) if N%i==0]
print(sum(A))"""

"""
sum_m=0

for a in range(1,int(N/2)):
    if (N-a)%a==0:
        sum_m+=int((N-a)/a)
print(sum_m)
"""

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

total = 0

if N == 1:
    print(total)
    exit()
    
for i in range(1,int(math.sqrt(N)+1)):
    amari = i
    if N % amari == 0:
        total += N//amari - 1
        #print(amari)

print(total)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

total = 0

if N != 1:
    print(total)
    exit()
    
for i in range(1,int(math.sqrt(N)+1)):
    amari = i
    if N % amari == 0:
        total += N//amari - 1
        #print(amari)

print(total)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

total = 0


for i in range(1,int(math.sqrt(N)+1)):
    amari = i
    if N % amari == 0:
        total += N//amari - 1
        #print(amari)

print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0
x = 1

t = int(n ** 0.5)

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

if t * t == n:
    ans -= t - 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0
x = 1

s = n ** 0.5
t = int(s)
if s > t:
    t += 1

while x < t:
    if n % x == 0:
        ans += n // x - 1
    x += 1

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

def all_divisor(n):
  small = [1]
  large = [n]
  for i in range(2, int(math.sqrt(n))):
    if n % i == 0:
      small.append(i)
      large.append(n//i)
  large.reverse()
  divisor = small + large
  return divisor


n = int(input())
n_divisor = all_divisor(n)
ans = 0
for i in n_divisor:
  mini_ans = (n - i) // i
  if i >= mini_ans:
    break
  ans += mini_ans 
print(ans)

Submission status: Wrong Answer

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

ans = 0
u = 2
sosu_f = True

tamesi = int(math.sqrt(N))
# print(tamesi)

yakusu = []
for i in range(1,tamesi+1)[::-1]:
    if N%i == 0:
        yakusu.append(i)


# for i in range(1,u+1):
#     if N%i == 0:
#         ans += (N//i-1)
#         print(ans)

#print(yakusu)

for i in yakusu:
    ans += N//i - 1


print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    ans = 0
    for m in range(1, N+1):
        if N % (m + 1) != 0:
            pass
        else:
            ans += m
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math as m
# m.floor m.ceil

n = int(input())
ans = 0
for i in range(1,m.ceil(m.sqrt(n))):
    if n%i==0: ans += n//i -1

if n in [1,2]: ans = 0

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
ans = N-1
num = np.arange(2, np.sqrt(N), dtype=int)
mask = (N%num==0)
check = np.array(N/num[mask], dtype=int)
num = np.concatenate([num, check])
mask2 = N%(num-1) == N//(num-1)
ans += int(np.sum(num[mask2])-np.sum(mask2))
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
ans = N-1
num = np.arange(2, np.sqrt(N), dtype=int)
mask = (N%num==0)
check = np.array(N/num[mask], dtype=int)
num = np.concatenate([num, check])
mask2 = N%(num-1) == N//(num-1)
ans += int(np.sum(num[mask2])-np.sum(mask2))
if int(np.sqrt(N))**2==N:
    ans+=int(np.sqrt(N))-1
print(ans)

Submission status: Wrong Answer

Solution code:
def searchDivisors(n):
    lstDivisors = []
    t = int(n ** .5)
    for a in range(1, t + 1):
        if n % a == 0:
            lstDivisors.append(a)
            b = n // a
            if b != a:
                lstDivisors.append(b)
    lstDivisors.sort()

    return lstDivisors


N = int(input())
ans = 0
lstDivisors = searchDivisors(N)


for k in lstDivisors:
    m = N // k - 1
    # if k == m:
    #     continue
    if k > m:
        break
    ans += m


print(ans)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

ans = 0

for i in range(math.floor((math.sqrt(N)))-1):
    if N % (i+1) == 0:
        if  ( N / (i+1) ) -1 > (i+1):
            ans = ans + ( N / (i+1) ) -1
            #break
        #print( N / (i+1)-1)
        
        
print(int(ans))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

ans = 0

for i in range(math.floor((math.sqrt(N)))-1):
    if N % (i+1) == 0:
        if  ( N / (i+1) ) -1 < (i+1):
            break
        #print( N / (i+1)-1)
        ans = ans + ( N / (i+1) ) -1
        
print(int(ans))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

ans = 0

for i in range(math.floor((math.sqrt(N)))-1):
    if N % (i+1) == 0:
        if (N / (i+1)) - 1 < 0:
            break
        #print( N / (i+1)-1)
        ans = ans + ( N / (i+1) ) -1
        
print(int(ans))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

ans = 0

for i in range(math.floor((math.sqrt(N)))-1):
    if N % (i+1) == 0:
        if N / (i+1) < 0:
            break
        #print( N / (i+1)-1)
        ans = ans + ( N / (i+1) ) -1
        
print(int(ans))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

ans = 0

for i in range(int(math.sqrt(N))-1):
    if N % (i+1) == 0:
        if N / (i+1) < 0:
            break
        #print( N / (i+1)-1)
        ans = ans + ( N / (i+1) ) -1
        
print(int(ans))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

ans = 0

for i in range(int(math.sqrt(N))):
    if N % (i+1) == 0:
        #print( N / (i+1)-1)
        ans = ans + ( N / (i+1) ) -1
        
print(int(ans))

Submission status: Wrong Answer

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

divisor_lst = []
for i in range(1, int(np.sqrt(N))+1):
    if N % i == 0:
        divisor_lst.append(i)
        divisor_lst.append(N//i)
        print(i)

arr = np.array(divisor_lst)
print(arr)
arr -= 1
print(int(np.sum(arr)) - 1)



#   約数を全て求めるアルゴリズム

Submission status: Wrong Answer

Solution code:
# 入力
N = int(input())

# sqrt(N) + 1 より大きい N の約数dについて、 d - 1 がお気に入りの数か
# 判定し、お気に入りの数であるものの和を解とする
ans = sum(
    N // d - 1
    for d in range(1, int(N**0.5))
    if N % d == 0 and (N // (N // d - 1)) == (N % (N // d - 1))
)

# 出力
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 13:16:22 2019

@author: Yamazaki Kenichi
"""
import math

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

Submission status: Wrong Answer

Solution code:
N = int(input())

from math import sqrt
ans = 0
if N != 1:
    for k in range(2,int(sqrt(N)+1)):
        if N%k == 0:
            m = N//k-1
            if k == N%m: ans += m

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 13:16:22 2019

@author: Yamazaki Kenichi
"""

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 13:16:22 2019

@author: Yamazaki Kenichi
"""

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 13:16:22 2019

@author: Yamazaki Kenichi
"""

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 12 13:16:22 2019

@author: Yamazaki Kenichi
"""

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
a = []
for m in range(3,N+1):
    if N%m == 0:
        ans += m
        a.append(m)
print(ans-len(a))

Submission status: Wrong Answer

Solution code:
# from sys import exit
# A,B,C = [int(n) for n in input().split()]
N = int(input())
# a = [int(input()) for _ in range(N)]
# S = str(input())
# L = len(S)
# T = str(input())
# exit()
ans = 0
for i in range(1, int(N**0.5)):
    if N % i == 0:
        m = N // i - 1
        if m and N // m == N % m:
            ans += m
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
k=1
while (n//k)-k>0:
    if n%k==0:
        ans+=(n//k)-k
    k+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
c = 1
if N == 2:
  print(0)
  exit(0)
while c * c < N:
  if (N - c) % c == 0:
    ans += (N - c) // c
  c += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
c = 1
while c * c < N:
  if (N - c) % c == 0:
    ans += (N - c) // c
  c += 1
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import math


def kari():
    map(int, input().split())
    list(map(int, input().split()))
    math.ceil()

def main():
    num = int(input())
    ans = 0

    for i in range(1, num):
        kari_num = num
        kari_num -= i
        kari_waru = kari_num // i

        if i ** 2 + i > num:
            break

        # print(num, kari_num, kari_waru)
        if kari_waru == 0 or kari_waru == 1:
            continue

        if kari_num % kari_waru == 0:
            # print(kari_waru)
            ans += kari_waru

    print(ans)



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

# coding: utf-8

# In[5]:

import sys
#import math
#input = sys.stdin.readline
N = int(input())


# In[9]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
#print(int(N**0.5))
rn = N**0.5
if rn%1 == 0:
    rn -= 1
for i in range(1, int(rn)+1):
    if N%i == 0:
        #print(i)
        #print(N/i-1)
        sum_ += N/i-1
print(int(sum_))


# In[ ]:

Submission status: Wrong Answer

Solution code:

# coding: utf-8

# In[1]:

import sys
import math
#input = sys.stdin.readline
N = int(input())


# In[5]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
for i in range(1, int(math.sqrt(N+0.5))+1):
    if N%i == 0:
        #print(i)
        #print(N/i-1)
        sum_ += N/i-1
print(int(sum_))


# In[ ]:

Submission status: Wrong Answer

Solution code:

# coding: utf-8

# In[1]:

import sys
import math
input = sys.stdin.readline
N = int(input())


# In[10]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
for i in range(1, int(math.sqrt(N))+2):
    if N%i == 0:
        #print(i)
        sum_ += N/i-1
print(int(sum_))


# In[ ]:

Submission status: Wrong Answer

Solution code:

# coding: utf-8

# In[1]:

import sys
import math
input = sys.stdin.readline
N = int(input())


# In[10]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
for i in range(1, int(math.sqrt(N))+1):
    if N%i == 0:
        #print(i)
        sum_ += N/i-1
print(int(sum_))


# In[ ]:

Submission status: Wrong Answer

Solution code:

# coding: utf-8

# In[1]:

import sys
import math
input = sys.stdin.readline
N = int(input())


# In[9]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
for i in range(1, int(math.sqrt(N))+1):
    if N%i == 0:
        #print(i)
        sum_ += N/i-1
print(sum_)


# In[ ]:

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) % i == 0:
        cnt += (n-i) // i

print(cnt)

Submission status: Wrong Answer

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

print(cnt)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import numpy as np
# import math
# import random
# import fractions
# import sys
# sys.setrecursionlimit(100000)
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]

N = int(stdin.readline().rstrip().split()[0])

sqrtN = int(np.sqrt(N-1))
ans = 0
for i in range(1,sqrtN+1):
  if N%i == 0:
    ans += N//i -1
    
print(ans)

Submission status: Wrong Answer

Solution code:
from math import ceil
n = int(input())
res = 0
for i in range(1,ceil(n**0.5)):
    if n%i == 0:
        res += n//i -1
print(res)

Submission status: Wrong Answer

Solution code:
from math import ceil
n = int(input())
if n == 1 or n == 2:
    print(0)
    exit()
res = 0
for i in range(1,int(ceil(n**0.5))):
    if n%i == 0:
        res += n//i -1
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

import numpy as np

sum = 0

for n in range(1, int(np.sqrt(N))+1):
    x = (N - n ) // n
    if ((N - n) % n == 0) and (n**2 < N):
        sum += x

print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())

import numpy as np

sum = 0

for n in range(1, int(np.sqrt(N))+1):
    x = (N -n ) / n
    if (N - n) % n == 0 and n**2 < N:
        sum += x

print(int(sum))

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:
        if i < (N//i)-1:
            cnt += (N//i)-1
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input());print(sum(n//i-1for i in range(1,int(n**.5))if n%i<1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

ans += N - 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>int(sqrt(n)):
            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())
ans = 0

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

ans += N - 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
total = 0
for m in range(1,n):
    x = n//m
    y = n%m
    if x == y:
        print(m)
        total = total + m
print(total)

Submission status: Wrong Answer

Solution code:
from math import sqrt
n=int(input())
s=0
for i in range(int(sqrt(n))):
    d,m=divmod(n,i+1)
    if m == 0:
        s += d-1
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 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()
    divisors.reverse()
    return divisors

div = make_divisors(n)
for _ in range(len(div)//2):
    count += div[_]-1

print(count)

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 and i != 0 and i != N ** 0.5:
        ans += (N - i) // i
    # print((N - i) // i, i, i)
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 and i != N ** 0.5:
        ans += (N - i) // i
    # print((N - i) // i, i, i)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

a = int(n ** (1 / 2))
sum = 0
for i in range(1, a):
    if (n % i == 0):
        j = n // i
        sum += j - 1

print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())

result = 0
for i in range(1, int(((1+4*N)**0.5-1)/2)):
  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)-int(N**0.25)):
  if (N - i) % i == 0:
    #print(i, N, (N - i) // i)
    result += (N - i) // i
      
print(int(result))

Submission status: Wrong Answer

Solution code:
n=int(input())
cnt=0
k=1
while 1:
    x=(n-k)/k
    y=int(x)
    if x!=y:break
    cnt+=y
    k+=1
print(int(cnt))

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 and N != i ** 2 + i:
    #print(i, N, (N - i) // i)
    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):
  if (N - i) % i == 0 and i**2 < N-1:
    #print(i, N, (N - i) // i)
    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):
  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):
  if (N - i) % i == 0 and i < N/i:
    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):
  if (N - i) % i == 0 and i < (N//i):
    result += (N - i) // i
      
print(int(result))

Submission status: Wrong Answer

Solution code:
N,ans,p=int(input()),0,1
while p*p<N:
    if N%p==0:ans+=int(N/p)-1
    p+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

result = 0
end = int(N**0.5)
end = end+1 if end < 1000000 else end
for i in range(1, end):
  # 偽物が通ってしまう．sample 2 の時，999999ずれる
  if (N - i) % i == 0:
    result += (N - i) // i

print(int(result))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(int(result))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(int(result))