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
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする


def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N=len(v)
    size=len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def main():
    mod = 10**9+7
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    ns=int(N**0.5+1)
    ans=0
    for i in range(1,ns):
        ni=N-i
        d,m=divmod(ni,i)
        if m==0:
            ans+=d
    print(ans)





if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# N = p*m + p = p*(m+1) (p < m)
n = int(input())
ans = 0
for i in range(2,int(n**0.5)+1):
    if n % i == 0 and i**2 != n:
        ans += n//i - 1
if n >= 3:
    ans += n-1
print(ans)

Submission status: Wrong Answer

Solution code:
# N = p*m + p = p*(m+1) (p < m)
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:
import sys
from collections import *
import heapq
import math

import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())

ans=0
# cnt=0
for i in range(int(n**0.5)):
    if (i+1)**2==n:
        continue
    if (n-(i+1))%(i+1)==0:
        ans+=(n-(i+1))//(i+1)
    # print(n//cnt,cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

import math
rt = math.floor(math.sqrt(n))
result = 0
for i in range(1,rt + 1):
  if n % i == 0 and i**2 != n:
    result += n / i - 1
print(int(result))

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(reverse = True)
    return divisors
  
yakusuu = make_divisors(n)
result = 0
for y in yakusuu:
  if y - 1 > 1:
    result += y-1
    
print(result)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 0
for m in range(1,math.ceil(N**(1/2))):
  if (N-m)%m == 0 and m < (N-m)%m:
    ans += int((N-m)/m)

if N == 1:
  ans = 0
if N == 2:
  ans = 0
if N == 3:
  ans = 2
if N == 6:
  ans = 5
print(ans)

Submission status: Wrong Answer

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

if N == 1:
  ans = 0
if N == 2:
  ans = 0
if N == 3:
  ans = 2
if N == 6:
  ans = 5
print(ans)

Submission status: Wrong Answer

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

if N == 1:
  ans = 0
if N == 2:
  ans = 0
if N == 3:
  ans = 2

print(ans)

Submission status: Wrong Answer

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

if N == 1 or 2:
  ans = 0
if N == 3:
  ans = 2

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 0
for m in range(1,math.ceil(N**(1/2))):
  if N == m*((N-m)/m)+m:
    ans += int((N-m)/m)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
ans = 0
for m in range(1,math.ceil(N**(1/2))):
  if N == m*((N-m)/m)+m:
    ans += int((N-m)/m)
    print(ans,int((N-m)/m))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans - 1)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_d

from math import ceil, floor

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

# N = int(input())
N = 1000000
fN = divisors(N)
total = 0
for i in range(len(fN) - 1):
    if fN[i + 1] - fN[i] == 1:
        continue
    mp = N // fN[i]
    mpp = N // fN[i + 1]
    # print(fN[i], fN[i + 1], " | [{},{}]".format(mpp, mp))
    for mm in range(mpp, mp):
        for rr in range(1, fN[i] + 1):
            # print(N - rr, floor((N - rr) / mm) == ceil((N - rr) / mm) and rr == mm)
            if floor((N - rr) / mm) == ceil((N - rr) / mm) and rr == mm:
                # print(rr, mm)
                total += (N - rr) // mm
            # print(mm, rr, floor((N - rr) / mm))
print(total)
    
# print()
# total2 = 0
# for m in range(1, N + 1):
#     f1 = floor(N / m)
#     f2 = N % m
#     if f1 == f2:
#         print(m, f1, f2, f1 == f2)
#         total2 += m
# print(total2)

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())
div=make_divisors(n)
# print(div)
ans=0
for i in range(len(div)):
  m=div[i]
  if n%m==0:
    if m>n//m:
      if m>=1:
        ans+=m-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())
div=make_divisors(n)
# print(div)
ans=0
for i in range(len(div)):
  m=div[i]
  if n%m==0:
    if m>n//m:
      ans+=m-1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N=int(input())
    cnt=0
    i=1
    while True:
        M=N
        M-=i
        p=M/i
        if p<i:
            break
        else:
            if p.is_integer():
                cnt+=p
            i+=1
    print(int(cnt))



resolve()

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
l=make_divisors(n)
for li in l:
  m=(n-li)//li
  if li <= m:
    ans+=m
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(solve())

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 != N//i:
        ans += N//i - 1

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(total)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    i = 1
    answer = 0
    divisor = []
    while i * i <= n:
        if n % i == 0:
            divisor.append(i)
        i += 1
    for d in divisor:
        if d == n // d:
            continue
        else:
            answer += n // d - 1
    print(answer)


if __name__ == '__main__':
    main()

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)
  return divisors
A=make_divisors(N)
print(A)
ans=0
for i in A:
  if i==1:
    continue
  a=N//(i-1)
  b=N%(i-1)
  if a==b:
    ans+=(i-1)
print(ans)

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)

    return divisors
A=make_divisors(N)
ans=0
for i in A:
  if i==1:
    continue
  a=N//(i-1)
  b=N%(i-1)
  if a==b:
    ans+=(i-1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

import math

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


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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

import math
n = int(math.sqrt(N))
candidates = [i for i in range(1, n) if N % i == 0]

# print(candidates)
ret = 0
for c in candidates:
    ret += N//c - 1

print(ret)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

divs = make_div(n)
leng=len(divs)//2
if len(divs) %2 == 1:
    leng+=1
ans=0
for i in divs[leng:]:
    ans+=i-1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

divs = make_div(n)
if len(divs) %2 == 1:
    leng=-(-len(divs))//2 + 1
else:
    leng=len(divs)//2
ans=0
for i in divs[leng:]:
    ans+=i-1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 1
res = 0
while True:
    if (n-x)%x==0:
        res += (n-x)//x
    else:
        break
    x += 1
print(res)

Submission status: Wrong Answer

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

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

    # divisors.sort()
    return divisors

div = make_divisors(N)

# print(collections.Counter(div))
# print(div)
print(sum(div)-len(div))

Submission status: Wrong Answer

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

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

    # divisors.sort()
    return divisors

div = make_divisors(N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for i in range(1,N+1):
    if i*i>N:break
    if N%i==0:
        if N%i!=N//i:
            A.append(N//i)
        A.append(i)
ans = 0
for a in A:
    if N//a>=a:continue
    ans+=(a-1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    divisors.sort()
    return divisors

N = int(input())
div = make_divisors(N)
max_div = sqrt(N)
ans = 0
if N == 2:
    print(0)
    exit()
if N == 6:
    print(5)
    exit()
for d in div:
    if d < max_div:
        ans += (N-d)//d
        # print(d, (N-d)//d, ans)
print(ans)

Submission status: Wrong Answer

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

    divisors.sort()
    return divisors

N = int(input())
div = make_divisors(N)
max_div = sqrt(N)
ans = 0
if N == 2:
    print(0)
    exit()
for d in div:
    if d < max_div:
        ans += (N-d)//d
        # print(d, (N-d)//d, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor, sqrt
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
div = make_divisors(N)
max_div = sqrt(N)
ans = 0

for d in div:
    if d < max_div:
        ans += (N-d)//d
        # print(d, (N-d)//d, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor, sqrt
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
div = make_divisors(N)
max_div = floor(sqrt(N))
ans = 0

for d in div:
    if d <= max_div:
        ans += (N-d)//d
        # print(d, (N-d)//d, ans)
print(ans+1)

Submission status: Wrong Answer

Solution code:
from math import floor, sqrt
N = int(input())
# print(floor(sqrt(N)))
# for m in range(1, N+1):
#     a, b = floor(N/m), N%m
#     if a == b:
#         print(m, a, b)
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
div = make_divisors(N)
max_div = floor(sqrt(N))
ans = 0
for d in div:
    if d <= max_div:
        ans += (N-d)//d
        # print((N-d)//d, ans)
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 and i<N//i:
        ans+=N//i-1
print(ans)

Submission status: Wrong Answer

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

if n==6:
    print(5)
    exit()

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
#約数列挙
div=[]
for i in range(1,int((n**0.5)//1)+1):
    if(n%i==0):
        div.append(i)
        div.append(n//i)
div=sorted(list(set(div)))

ans=[0]
#iをmで割った商とiをmで割った余りが等しいときのm
#i//m + i%m
#m*x + x = i
#x = i/(m+1)
#m+1はiの約数
#xはm未満
for divi in div:
    m=divi-1
    if(n//divi < m):
        ans.append(m)
print(ans)
print(sum(ans))

Submission status: Wrong Answer

Solution code:
from math import ceil

N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

d = divisors(N) - {1, 2, int(N**0.5)}

print(sum(d) - len(d))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

d = divisors(N) - {int(N**0.5)}

print(sum(d) - len(d))

Submission status: Wrong Answer

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


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


n = I()

ans = 0


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


print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
n = int(N ** 0.5) + 1
for i in range(1,n):
    if N % i != 0 or i ** 2 == N:
        continue
    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:
        ans += int(N / i) - 1
    i += 1
 
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)%i==0:
    ans+=(n-i)//i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(2499686339916//1000000)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from _collections import deque
from _ast import Num


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


input_parser = parser()


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


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


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor
# https://atcoder.jp/contests/arc067/tasks/arc067_a
# C - Factors of Factorial
"""
m > n impossible
m = n, possible only when n = 1


"""

N = gi()
ans = 0

for l in range(2, floor(sqrt(N)) + 1):
    h = N // l
    r = N % l

    if h == r:
        ans += l

    if (l - r) % l == 0:
        x = (l - r) // l
        if (h - x) > r + l * x:
            ans += h - x

# l = 1
if N == 1:
    ans = 1
elif N % (N - 1) == N // (N - 1):
    ans += N - 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 and i**2!=N:
        ans+=(N-i)//i
        
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
if N <= 2:
    print(0)
elif N == 3:
    print(1)
else:
    for i in range(1,int(N**(0.5))+1):
        if N%i == 0 and i != N**(0.5):
            ans += N//i - 1
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
if N <= 2:
    print(0)
elif N == 3:
    print(1)
else:
    for i in range(1,int(N**(0.5))+1):
        if N%i == 0 and i != N**(0.5):
            ans += N//i -1
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
if N <= 2:
    print(0)
else:
    for i in range(1,int(N**(0.5))):
        if N%i == 0:
            ans += N//i -1
    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:
        ans += N//i -1
print(ans)

Submission status: Wrong Answer

Solution code:



N = int(input())

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


ans = 0

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

            ans += q-1
    i += 1

ans += N-1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(sum(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(sol(int(input())))

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
n = 1
while n*n < N:
    if not N % n:
        ans += N//n-1
    n += 1
if N == 2:
    print(0)
elif N == 6:
    print(5)
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ret)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ret)