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 sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	return maa(n)
	#b , c = tin()
	#s = input()
	for i in range(1,100000000):
		if maa(i)!=mab(i):
			pa(maa(i), mab(i))
			return i
	
def maa(n):
	ret = 0
	rr=[]
	for i in range(1, n+1):
		if n//i <= i:
			break
			
		if (n-i) % i == 0:
			#pa(i, (n-i)//i)
			ret += (n-i)//i
			#rr.append((n-i)//i)
			
	return ret
	
def mab(n):
	ret = 0
	for i in range(1, n+1):
		if n // i == n%i:
			ret += i
	return ret
	
	
#+++++
isTest=False

def pa(*vl):
	if not isTest:
		return
	print(*vl)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

t1=2
comb=set()
while t1*t1<=n:
    if n%t1==0:
        t2=n//t1

        m=t1-1
        if t2==n%m:
            comb.add(m)
        m=t2-1
        if t1==n%m:
            comb.add(m)
    t1+=1

print(sum(comb)+n-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# In[41]:


N = int(input())


# In[42]:


def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


# In[43]:


mylist = make_divisors(N)
idx = -(-len(mylist)//2)
print(sum(mylist[idx:])-(len(mylist)-idx))


# In[ ]:

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

# total=0
# i=1
# while i*i<=n:
#     if i*i==n:
#         break

#     if n%i==0:
#         total+=(n//i)-1

    
#     i+=1

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

arr = make_divisors(n)
d={}
for i in arr:
    d[i]=0
total=0

for j in range(len(arr)):
    t = arr[j]

    if t**2 == n:
        d[t]=1
        continue
    if d[t]==0:
        total+=(n//t)-1
        d[t]=1
        d[n//t]=1

print(total)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
for i in range(1,n+1):
  a,b=divmod(n,i)
  if a==b:
    k=i
    break

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

Submission status: Wrong Answer

Solution code:
# D - DivRem Number  diverta 2019 programming contest
from itertools import combinations
from functools import reduce
from operator import mul
N = int(input())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr


A = factorization(N)
l = []
for a in A:
    l += [a[0]] * a[1]

ans = 0
for i in range(1, len(l)+1):
    for s in set(combinations(l, i)):
        r = reduce(mul, s)
        ans += r - 1 if r > 2 else 0

print(ans)

Submission status: Wrong Answer

Solution code:
import math
def soinsu_bunkai(n):
    ls = []
    i = 2
    while i <= math.floor(n**0.5):
        if n%i == 0:
            ls.append(i)
            n //= i
        else:
            i += 1
    if n > 1:
        ls.append(n)
    return ls
N = int(input())
ls1 = soinsu_bunkai(N)
print(ls1)
ans = 0
for i in range(len(ls1)):
    if N> (ls1[i]*ls1[i] + ls1[i]):
        ans += (N-ls1[i])//ls1[i]
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

total=0
i=1
while i*i<=n:
    if i*i==n:
        break

    if n%i==0:
        total+=(n//i)-1

    
    i+=1

# def make_divisors(n):
#     lower_divisors , upper_divisors = [], []
#     i = 1
#     while i*i <= n:
#         if n % i == 0:
#             lower_divisors.append(i)
#             if i != n // i:
#                 upper_divisors.append(n//i)
#         i += 1
#     return lower_divisors + upper_divisors[::-1]

# arr = make_divisors(n)
# d={}
# for i in arr:
#     d[i]=0
# total=0

# for j in range(len(arr)):
#     t = arr[j]

#     if t**2 == n:
#         d[t]=1
#         continue
#     if d[t]==0:
#         total+=(n//t)-1
#         d[t]=1
#         d[n//t]=1

print(total)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

arr = make_divisors(n)
d={}
for i in arr:
    d[i]=0
total=0

for j in range(len(arr)):
    t = arr[j]

    if t**2 == n:
        d[t]=1
        continue
    if d[t]==0:
        total+=(n//t)-1
        d[t]=1
        d[n//t]=1

print(total)

Submission status: Wrong Answer

Solution code:
n=int(input())

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

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

arr = make_divisors(n)
d={}
for i in arr:
    d[i]=0
total=0

sq = int(n**0.5)
d[sq]=1
for j in range(len(arr)):
    t = arr[j]
    if d[t]==0:
        total+=(n//t)-1
        d[t]=1
        d[n//t]=1

print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 0
for i in range(1,math.ceil(N**0.5)):
    a = N - i
    if a % i == 0 and a/i >0:
        ans += a/i
print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 0
for i in range(1,math.ceil(N**0.5)):
    a = N - i
    if a % i == 0:
        ans += a/i
print(int(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:
        if n == i * i:
            continue
        k = (n // i) - 1
        ans += k
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
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

divs = make_divisors(n)
# print(divs)
for div in divs[::-1]:
    if div**2 > n:
        ans += div - 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
for i in range(1,int(n**.5+1)):
  if n%i==0:ans+=(n-i)//i
if n==4:print(3)
elif n==2:print(0)
else:print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
def make_divisors(n):
    divisors = []
    # 試し割りで、かつ積でnを作るときの相方も同時に追加してる
    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
divisors = make_divisors(n)
ans = 0
for div in divisors:
    #print(div)
    target = div - 1
    if target != 0 and n % target != 0:
        ans += target
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
def make_divisors(n):
    divisors = []
    # 試し割りで、かつ積でnを作るときの相方も同時に追加してる
    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
divisors = make_divisors(n)
ans = 0
for div in divisors:
    print(div)
    target = div - 1
    if target != 0 and n % target != 0:
        ans += target
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

# t = []
# for i in range(1, N+1):
#     if N // i == N % i:
#         print("→ :", i)
#         t.append(i)
#     else:
#         print("  :", i)

# print("G:", sum(t))

ans = (N-1) if N != 2 else 0
cur = 2
while (N-cur)//cur >= cur:
    if (N-cur)%cur == 0 and N % cur != 0:
        ans += (N-cur)//cur
        # print("::", (N-cur)//cur, cur)
    cur += 1
    # print(ans)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

# t = []
# for i in range(1, N+1):
#     if N // i == N % i:
#         print("→ :", i)
#         t.append(i)
#     else:
#         print("  :", i)

# print("G:", sum(t))

ans = (N-1) if N != 2 else 0
cur = 2
while (N-cur)//cur >= cur:
    # print("::", (N-cur)//cur)
    if (N-cur)%cur == 0:
        ans += (N-cur)//cur
    cur += 1
    # print(ans)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

# t = []
# for i in range(1, N+1):
#     if N // i == N % i:
#         print("→ :", i)
#         t.append(i)
#     else:
#         print("  :", i)

# print("G:", sum(t))

ans = (N-1)
cur = 2
while (N-cur)//cur >= cur:
    # print("::", (N-cur)//cur)
    if (N-cur)%cur == 0:
        ans += (N-cur)//cur
    cur += 1
    # print(ans)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

# t = []
# for i in range(1, N+1):
#     if N // i == N % i:
#         print("→ :", i)
#         t.append(i)
#     else:
#         print("  :", i)
ans = (N-1)
cur = 2
while (N-cur)//cur >= cur:
    # print("::", (N-cur)//cur)
    ans += (N-cur)//cur
    cur += 1
    # print(ans)

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())

def isSQ(x):
  for i in range(1,10**6+1):
    if i**2==x:
      return i
    elif i**2>x:
      return -1
  else:
    return -1

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

print(answer)

Submission status: Wrong Answer

Solution code:
N=int(input())

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

print(answer)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
if n==1 or n==2:
    print(0)
    exit()
for i in range(1,int(n**0.5)+1):
    if n%i==0 and i!=n//i:
        l.append(n//i)

print(sum(l)-len(l))

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
if n==1 or n==2:
    print(0)
    exit()
for i in range(1,int(n**0.5)+1):
    if n%i==0 and i!=n//i:
        l.append(n//i)
print(l)
print(sum(l)-len(l))

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[]
if n==1:
    print(0)
    exit()
for i in range(1,int(n**0.5)+1):
    if n%i==0 and i!=n//i:
        l.append(n//i)
print(sum(l)-len(l))

Submission status: Wrong Answer

Solution code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

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




    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

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




    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# mのとりうる範囲を考える 最小値はまあ2だろう 最大値はN-1になる（modなので）

# こんがらがったので小さい数で考える
# N = 65
# まずN-1は商1余り1を達成できる 64
# 商2の範囲 21 < x <= 32 （N//3 < x <= N//2)
# 32では余り1, 31では余り3になり、以降xを少なくしてもあまりが増えるだけなので達成できない
# 商3の範囲 16 < x <= 21
# 21では余り2, 20では余り5 達成できない
# 商4 13 <= x <16
# 16では余り1, 15では5 達成できない
# 商5の範囲 10 < x <= 13
# 13では余り0, 12では5 達成できる 64+12 = 76
# 商6の範囲 9 < x <= 10
# 10では余り5, 9は無理
# 商7はどうなる？ いちおう8 < x<= 9
# 9では余り2 達成できない
# 商8 7< x <= 8
# 8では余り1で達成できない
# 商9 6 < x <= 7だが、商>余りの最大値 になってしまい、コレ以上は無意味
# 答えは76

# N = 329
# で考える まずはN-1で 328
# 商2 109 < x <= 164
# 164では1 163では3 達成できない
# 商3 82 < x <= 109
# 109では2 108では5 達成できない
# 商4 65 < x <= 82
# 82では1 81では5 達成できない
# 商5 54 < x <= 65
# 65では4 64では9 達成できない
# 商6 47 < x <= 54
# 54では5 53では11 達成できない
# 商7 41 < x <= 47
# 47では0 46で7になり、達成できる 328+46 = 374
# 商8 36 < x <= 41
# 41では1 40では9 達成できない
# 商9 32 < x <= 36
# 36では5 35では14 達成できない
# 商10 29 < x <= 32
# 32では9 31では19 達成できない
# 商11 27 < x <= 29
# 29では10 28では21 達成できない
# 商12 25 < x <= 27
# 27では5 27では17 達成できない
# 商13 23 < x <= 25
# 25では4 25では17 達成できない
# 商14 21 < x <= 23
# 23では7 22では21 達成できない
# 商15 20 < x <= 21
# 21では14 達成できない
# 商16 19 < x <= 20
# 20では9 達成できない
# 商17 18 < x <= 19
# 19では6 達成できない
# 商18 17 < x <= 18
# 18では5 達成できない8
# これ以降は無意味
# 答えは374

# というのを愚直に実装してみる...
N = int(input())
ans = N - 1
div = 2
limit = N // div
while div <= limit:
    tmp = limit
    # ここ明らかに無駄っぽい気がするんだよなー
    while True:
        if N % tmp > div or tmp <= N // (div + 1):
            break
        if N % tmp == div:
            ans += tmp
            break
        tmp -= 1
    div += 1
    limit = N // div
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
x=10**12
i=1
c=0
while x>i:
  x=(n-i)//i
  if (n-i)%i==0 and n-i!=i:c+=x
  i+=1
print(c)

Submission status: Wrong Answer

Solution code:
n=int(input())
x=10**12
i=1
c=0
while x>i:
  x=(n-i)//i
  if (n-i)%i==0:c+=x
  i+=1
print(c)

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    ret = []
    d = 1
    while d * d <= n:
        if n % d == 0:
            ret.append(d)
            if d != n // d:
                ret.append(n // d)
        d += 1
    return ret

n = int(input())
d = make_divisors(n)
# print("d =", d)
ans = 0
for i in d:
    m = i - 1
    if 2 < m < n:
        ans += m
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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:
def make_divisors(n):
    lw, up = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lw.append(i)
        if i * i != n:
            up.append(n//i)
        i += 1
    return lw + up[::-1]

N = int(input())
ans = 0
li = make_divisors(N)
if N == 1 or N==2:
    print(0)
    exit()

for x in li:
    if x * (x+1) > N:
        break
    ans += N//x - 1
print(ans)

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    lw, up = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lw.append(i)
        if i * i != n:
            up.append(n//i)
        i += 1
    return lw + up[::-1]

N = int(input())
ans = 0
li = make_divisors(N)

for x in li:
    if x * x > N:
        break
    ans += N//x - 1
print(ans)

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    lw, up = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lw.append(i)
        if i * i != n:
            up.append(n//i)
        i += 1
    return lw + up[::-1]

N = int(input())
ans = 0
li = make_divisors(N)

for x in li:
    if x * (x+1) > N:
        break
    ans += N//x - 1
print(ans)

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    lw, up = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lw.append(i)
        if i * i != n:
            up.append(n//i)
        i += 1
    return lw + up[::-1]

N = int(input())
li = make_divisors(N)
ans = 0
for x in li:
    m = N//x - 1
    if m > 1:
        ans += m
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
i = 1
ans = 0
while i*i<N:
    temp = N//i-1
    if  N == i*temp+i and (N-i)//i >= i:
        ans += temp
    i+=1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))+1
ans = 0
for i in range(1,n):
    temp = N//i-1
    if  N == i*temp+i:
        ans += temp
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  and i ** 2 != n:
        ans += n // i - 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())


ans = 0

for i in range(1, 1000000):
    if N <= i:
        break
    if (N-i) == i:
        break

    if (N - i) % i == 0:
        ans += (N-i) // i
        #print(i, (N-i) // i)

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
from math import gcd
r = n//2
cou = 0
for i in range(1,int(r**0.5)+1):
  if n%i==0:
    b = n//i-1 
    cou += b

    if i>2:
      c = i-1
      cou += c

print(cou)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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(reverse = True)
    return divisors

n = inp()
if n == 2:
    print(0)
    quit()
g = make_divisors(n)
ln = len(g)//2
print(sum(g[:ln]) - ln)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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(reverse = True)
    return divisors

n = inp()
if n == 2:
    print(0)
g = make_divisors(n)
ln = len(g)//2
print(sum(g[:ln]) - ln)

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    N = in_n()
    yaku = make_divisors(N)

    ans = 0
    for n in yaku:
        if n < N // n:
            ans += N // n - 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def cal_divisors(N):
    divisors = []
    i = 1
    while i*i < N:
        if N % i == 0:
            divisors.append(i)
        i += 1
    divisors.sort()
    return divisors

def main():
    N = int(input())
    l = cal_divisors(N)
    ans = 0
    for i in l:
        ans += N//i - 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = set()

for i in range(1,int(n**0.5)+2):
    if n//i == n%i:
        s.add(i)
    if ((n-i)/i)%1 == 0:
        s.add((n-i)//i)
print(sum(list(s)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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 and (n//i-1) >= i:
        ans += n//i-1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    N = II()
    ans = 0
    for m in range(int(N**0.5)):
        if N % (m+1) == 0:
            x = N // (m+1)
            if m+1 == x:
                continue
            if m < x:
                m = x - 1
            dbg(m)
            ans += m
    print(ans)
    # assert(ans != 2499686339916)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    N = II()
    ans = 0
    i = 0
    while i+1 < N**0.5:
        if N % (i+1) == 0:
            x = N // (i+1)
            if i < x:
                d = x - 1
            else:
                d = i
            ans += d
        i += 1
    print(ans)
    # assert(ans != 2499686339916)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    N = II()
    ans = 0
    for m in range(int(N**0.5)-1):
        if N % (m+1) == 0:
            x = N // (m+1)
            if m < x:
                m = x - 1
            dbg(m)
            ans += m
    print(ans)
    # assert(ans != 2499686339916)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def divG(n) -> list:
    if n == 0:
        return [0]
    i = 1
    table = set()
    while i * i <= n:
        if n % i == 0:
            table |= {(n // i - 1) * (i < n // i)}
        i += 1
    return table
print(sum(divG(int(input()))))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
for i in range(1,int(n**0.5)):
    m,r = divmod(n-i,i)
    if r == 0: ans += m
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

divisors = set()
for i in range(1, int(n**.5)+1):
    if n % i == 0:
        if i == n//i:
            continue
        divisors |= {n//i}

print(sum(map(lambda x: x-1, divisors)))

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

n = int(input())
ans = 0
i = 1
x = n
while 1:
    if (n-i)%i==0:
        x = (n-i)//i
        if x<i:break
        ans += x
    i += 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:
N = int(input())

ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
for i in range(1, N):
    a = N - i
    if a % i == 0:
        ans += a // i
    if a // i <= i:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

div = []
i = 1

while i * i < N:
    if N % i == 0:
        div.append(N // i)
    i += 1
if N == 2: print(0)
else: print(sum(div) - len(div))