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:
n = int(input())
c = 0
for i in range(1, int(n**0.5)+1):
    if n % i == 0 and n / i >= i:
        c += int(n / i) - 1
print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = int()

for i in range(1, int((N + 1) ** 0.5) - 1):

    if N % i == 0:

        ans += int(N / i) - 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import sqrt
N = int(input())
kMax = int(sqrt(N+1/4) - 1/2)
ans = 0
for k in range(1,kMax+1):
    if N % k == 0:
        ans += N//k - 1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

readline = sys.stdin.readline

N = int(readline())

sqrtN = int(N ** 0.5)

i = 1
total = 0
while i * (i + 2) <= N:
    if N % i == 0:
        if i < (N / i) - 1:
            total += N / i - 1
        else:
            break
    i += 1

print(total)

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
cnt = 0
for i in range(1, int(np.ceil(round(np.sqrt(N),1)))):
    cnt += (N-i)//i
print(cnt)

Submission status: Wrong Answer

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

max_m = math.floor(math.sqrt(N) - 1)

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

Submission status: Wrong Answer

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

print(result)

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())
a = make_divisors(N)
if len(a)%2 == 0:
    print(sum(a[len(a)//2:]) - len(a)//2)
else:
    print(sum(a[len(a)//2 + 1:]) - len(a)//2)

Submission status: Wrong Answer

Solution code:
# for i in range(1,1001):
#   for j in range(1,i):
#     a=i//j
#     b=i%j
#     if a==b:
#       print(str(i)+'を'+str(j)+'で割った商は'+str(a)+'、余りは'+str(b))

n=int(input())
c=0
for i in range(1,n):
  x=(n-i)%i
  y=(n-i)//i
  if y<i:
    break
  if x==0:
    c+=y
print(c)

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())
c = 0
for i in range(1, int(n**0.5)+1):
    if n % i == 0 and n / i - 1 >= i:
        c += int(n / i) - 1
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

import math

n = ni()
a = 0
b = math.ceil(math.sqrt(n))

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

print(a)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
n_root=math.ceil(n**(0.5))

sum=0
for i in range(1, n_root+1):
    if n%i==0 and i<int(n/i):
        sum=sum+int(n/i)-1
print(int(sum))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

divs = get_divs(N)

ans = 0
for d in divs:
    if d > N//d and d-1>0:
        ans += (d-1)

print(ans)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

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

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())
a = make_divisors(N)
print(sum(a[len(a)//2:]) - len(a)//2)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
val = int(input())
res = 0
current = 1
while True:
    rest = val - current
    plus = math.floor(rest / current)
        
    if rest % current == 0:
        if plus * current + current == val:
            res += plus
    if current * current + current >= val:
        break
    current += 1
print(str(res))

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

import math

n = ni()
a = 0
b = math.ceil(math.sqrt(n))

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

print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

div = make_divisor(n)
print(sum([s - 1 for s in div if s ** 2 > n]))

Submission status: Wrong Answer

Solution code:


def main():
    n = input()
    if n <= 2:
        print 0
        return
    s = 0
    i = 1
    used = set()
    while i * (i + 1) <= n:
        if (n - i) % i == 0:
            a = (n - i) // i
            if a not in used:
                s += a
                used.add(a)
        i += 1
    print s


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())

def divisor(n): #約数
    f=[]
    d=[1]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    for i in range(len(f)):
        t=[]
        for j in range(1,f[i][1]+1):
            t.append(f[i][0]**j)
        for j in range(len(d)):
            for k in range(len(t)):
                d.append(d[j]*t[k])
    return sorted(d)

n=I()
div=divisor(n)
if len(div)%2==1:
    ddiv=div[len(div)//2+1:]
    ans=sum(ddiv)-len(ddiv)
else:
    if div[len(div)//2-1]+1==div[len(div)//2]:
        ans=max(len(div)//2-1,0)
    else:
        ddiv=div[len(div)//2:]
        ans=sum(ddiv)-len(ddiv)
if n==3:
    ans=1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    ans=0
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            if i>2:
                ans+=i-1
            if i!=n//i:
                ans+=n//i-1
    return ans

n=int(input())
print(make_divisors(n))

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())
a = make_divisors(N)
sum(a[len(a)//2:]) - len(a)//2

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque
from heapq import heappush,heappop
import re
def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

N = int_raw()



def main():
    ans = 0 
    for idx in range(1,N+1):
        if(idx*idx)>=N:
            break
        if (N-idx)%idx == 0:
            ans += (N-idx)//idx
    return ans


print(main())

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
mn = int(math.sqrt(N) + 1)

res = 0

for i in range(1, mn):
    if (N - i) % i == 0:
        val = (N - i) // i
        if i <= val:
            res += val

print(res)

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)
    return divisors

N=int(input())
A=sorted(make_divisors(N))
for i in range(len(A)):
    A[i]-=1
    if A[i]==1:
        A[i]=0
    else:
        pass
print(sum(A))

Submission status: Wrong Answer

Solution code:
from math import sqrt
import numpy as np

def simple(N):
    c = 0
    for x in range(1, int(np.ceil(sqrt(N)))):
        if N % x == 0:
            r = N // x - 1
            c += r
    print(c)
    
simple(int(input()))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    # divisors.sort()
    return divisors


n = int(input())
# N = some * fav + some
# 1 ... n-1
# 2 ... n/2 - 1　整数の場合
# 3 ... n/3 - 1　整数の場合

sum_val = 0
divisor_list = make_divisors(n)

for divisor in divisor_list:
    diff = n // divisor - 1
    if diff != 1:
        sum_val = sum_val + diff
print(sum_val)

Submission status: Wrong Answer

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


def solve(n):
  ret = 0
  divs = []
  for i in range(1,int(math.sqrt(n))+1):
    if n%i == 0 and i**2!=n:
      ret += n//i-1
  return ret


if __name__ == "__main__":
  N = int(input())
  print(solve(N))

Submission status: Wrong Answer

Solution code:
words = lambda t : list(map(t, input().split()))
n = int(input())

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

print(total)

Submission status: Wrong Answer

Solution code:


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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = 0
tmp = math.sqrt(1 + 4 * N)
if tmp * tmp == 4 * N + 1:
    tmp -= 1
mina = int((-1 + tmp) / 2) + 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

m = int(input())


s = []
for i in range(math.floor(math.sqrt(m))+3):
	if m%(i+1)==0:
		if (i+1) not in s:
			s.append(i+1)
		if m//(i+1) not in s:
			s.append(m//(i+1))
s.sort()
x =0
if len(s)%2 == 1:
    for i in range(len(s)//2+1):
        x += m//s[i]-1

    print(x)
else:
    for i in range(len(s)//2):

        x += m//s[i]-1

    print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())

def divisor(n): #約数
    f=[]
    d=[1]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    for i in range(len(f)):
        t=[]
        for j in range(1,f[i][1]+1):
            t.append(f[i][0]**j)
        for j in range(len(d)):
            for k in range(len(t)):
                d.append(d[j]*t[k])
    return sorted(d)

n=I()
div=divisor(n)
if len(div)%2==1:
    ddiv=div[len(div)//2+1:]
    ans=sum(ddiv)-len(ddiv)
else:
    if div[len(div)//2-1]+1==div[len(div)//2]:
        ans=max(len(div)//2-1,0)
    else:
        ddiv=div[len(div)//2:]
        ans=sum(ddiv)-len(ddiv)
print(ans)

Submission status: Wrong Answer

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

a = math.ceil(N**0.5)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder D
"""

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = int(input()) for _ in range(N) # 1 row N column

# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']

def main():
    # A, B = list(map(int,input().split()))
    N = int(input())
    tmp=0
    i=1
    o=min(N,20000000)
    for i in range(1,o):
        mod=(N-i)%i
        if mod==0:
            if (i>(N-i)/i):
                break
            tmp+=int((N-i)/i)
        i+=1
    print(int(tmp))
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#商をxとすると、(m+1)*x=N
#つまり、約数のうち、商よりも大きいもの−１の和を求める
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:

from itertools import product

N = int(input())

sqrt = int(N ** 0.5)

factorize_result = {}
n = N
for i in range(2, sqrt + 1):
    if n % i == 0:
        factorize_result[i] = 1
        n = n // i
        while n % i == 0:
            factorize_result[i] += 1
            n = n // i
if n > 1:
    factorize_result[n] = 1

ans = 0
vs = [list(range(v+1)) for v in factorize_result.values()]
for indices in product(*vs, repeat=1):

    tmp = 1
    for i, (k, v) in enumerate(factorize_result.items()):
       tmp *= k ** indices[i]

    if tmp > sqrt:
        ans += tmp - 1

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(sum)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
def divisor(n):
	divs=[]
	for i in range(1,int(n**0.5)+1):
		if n%i==0:
			divs.append(i)
			if i!=n//i:
				divs.append(n//i)
	divs.sort()
	return divs
d=divisor(N)
s=0
for i in range(1,len(d)):
	if d[i-1]+1!=d[i]:
		s=s+d[i]-1
print(s)

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder D
"""

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = int(input()) for _ in range(N) # 1 row N column

# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']

def main():
    # A, B = list(map(int,input().split()))
    N = int(input())
    tmp=0
    i=1
    for i in range(1,N):
        mod=(N-i)%i
        if mod==0:
            if (i>(N-i)/i):
                break
            tmp+=int((N-i)/i)
        i+=1
    print(int(tmp))
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())

answer=0
import math
for m in range(1,math.floor(math.sqrt(N))):
    if N%m==0:
        answer+=N/m-1
print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
n = int((N ** 0.5) // 1)

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0


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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = math.sqrt(float(N))

exception = []
sum = 0
for i in range(int(n), int(N)):
  if( i in exception):
    break
  else:
    res = N % i
    if(res == 0):
      for j in range(1, int(N/i)):
        exception.append(i * j)
    else:
      div = int(N/i)
      if(div == res):
        sum = sum + i
  
print(sum)

Submission status: Wrong Answer

Solution code:
N=int(input())

sqrt_N = N**0.5

list_D=[]
list_A=[]

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

for d in list_D:
    list_A.append(N//d-1)

print(sum(list_A))

Submission status: Wrong Answer

Solution code:
n=int(input())
def count(n):
    c=n-1
    for i in range(1,n//2):
        if n%i==n//i:
            c+=i
    return c
print(count(n))

Submission status: Wrong Answer

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

ans = 0
mina = int((-1 + math.sqrt(1 + 4 * N)) / 2) + 1

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

Submission status: Wrong Answer

Solution code:
import math
s=raw_input().split()
n=int(s[0])

ar=[]
an=n-1
x=int(math.sqrt(n))
for i in range(2,x+1):
	if n%i==0:
		j=(n//i);
		k=i-1
		if (n//k)==(n%k):
			an+=(k)
		if i!=j:
			k=j-1
			if (n//k)==(n%k):
				an+=(k)
print(an)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
i=1
a=[]
while i*i<n:
    if n%i ==0 and not i==n//i:
        a.append(n//i)
    i+=1
print(sum(a)-len(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

answer=0
import math
for m in range(1,math.ceil(math.sqrt(N))):
    if N%m==0:
        answer+=N/m-1
print(int(answer))

Submission status: Wrong Answer

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

a = math.ceil(N**0.5)

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

Submission status: Wrong Answer

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

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

lists = make_divisors(N)
print(sum(lists)-len(lists))

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

Submission status: Wrong Answer

Solution code:
def f(n):
    x = 1
    ans = 0
    while x ** 2 - x < n:
        if n % x == 0:
            ans += n // x - 1
        x += 1
    print(ans)

n = int(input())
f(n)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
x = 0
for i in range(1,n+1):
  if (n-i)%i == 0:
    x += (n-i)//i
  if (n-i)/i<i:
    break
print(int(x))

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0


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

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder D
"""

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = int(input()) for _ in range(N) # 1 row N column

# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']

def main():
    # A, B = list(map(int,input().split()))
    N = int(input())
    tmp=0
    i=1
    N2=min(N,8000000)
    # while i<N2:
    for i in range(1,N2):
        # print(i,(N-i))
        mod=(N-i)%i
        if mod==0:
            tmp+=int((N-i)/i)
        i+=1
    print(int(tmp))
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from math import sqrt
def inpl(): return list(map(int, input().split()))

N = int(input())
yaku = []
ans = 0
S = int(sqrt(N))

for d in range(1, S+(S*S!=N)):
    a, b = divmod(N-d, d)
    if b == 0 and a > 0:
        ans += a
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) % i == 0:
        ans += (n - i) // i
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

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(stdin.readline().rstrip())
ds = make_divisors(n)

#print(ds)

sum = 0
for x in ds:
   if x==n:
     continue
   m = int(n/x-1)
#   print(x,m)
   sum += m

print(sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n<3:
    print(0) 
else:
    i=1
    a=[]
    while i*i<n:
        if n%i ==0:
            a.append(n//i)
        i+=1
    print(sum(a)-len(a))

Submission status: Wrong Answer

Solution code:
import collections as c
ip = lambda : map(int, input().split())

##############

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

import math, itertools, operator
from math import *
from math import factorial as fact
from itertools import permutations, combinations
from functools import reduce
from statistics import mean, median, median_low, median_high, mode
# Before Python 3.5
from fractions import gcd

#import numpy
#import scipy, scipy.special
#from sympy import isprime, nextprime
#from sympy.ntheory import factorint
#from sympy import divisors

inf = float('inf')

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(inp = input, sep = ' ', conv = int):
    return map(conv, inp().split(sep = sep))

################################################################################


def is_prime(n):
    if n == 1:
        return False
    if n % 2 == 0:
        return False
    i = 3
    while i * i <= n:
        if n % i == 0:
            return False
        i += 2
    return True


def prime_factors(n):
    prime_factor_list = []
    while not n % 2:
        prime_factor_list.append(2)
        n //= 2
    while not n % 3:
        prime_factor_list.append(3)
        n //= 3
    i = 5
    while n != 1:
        if is_prime(i):
            while not n % i:
                prime_factor_list.append(i)
                n //= i
        i += 2

    return prime_factor_list

def divisors2(factors) :
    """
    Generates all divisors, unordered, from the prime factorization.
    """
    ps = sorted(set(factors))
    omega = len(ps)

    def rec_gen(n = 0) :
        if n == omega :
            yield 1
        else :
            pows = [1]
        for j in range(factors.count(ps[n])) :
            pows += [pows[-1] * ps[n]]
        for q in rec_gen(n + 1) :
            for p in pows :
                yield p * q

    for p in rec_gen() :
        yield p

def divisors(N):
    l = []
    for i in range(1,int(sqrt(N))+1):
        if N % i == 0:
            l.append(i)
    return l

N = int(input())

cnt = 0
#for p in divisors(prime_factors(N)):
for p in divisors(N):
    m = N // p
    if not p < m:
        break
    #print(m-1)
    cnt += m-1

print(cnt)

Submission status: Wrong Answer

Solution code:

def main():
    buf = input()
    N = int(buf)
    # N / m = i % i
    # m * i + i = N
    total = 0
    i = 1
    while i * i < N:
        if N % i == 0:
            div = N // i - 1
            total += div
        i += 1
    print(total)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#D問題
#D問題
import math
N=int(input())
n=int(math.sqrt(N))
plist=[]
for i in range(1,n+1):
    if N%i == 0:
        plist.append(i)
        if i != int(N/i):
            plist.append(int(N/i))
ans=0
for x in plist:
    kari=int(N/x)-1
    if kari not in plist:
        ans+=kari
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

import numpy as np

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

    divisors.sort()
    return divisors

N = int(input())
N_divisors = make_divisors(N)

N_length = len(N_divisors)
N_length_half = N_length // 2
N_length_mod = N_length % 2

N_length_half_temp = 0

if N_length_mod == 1:
    N_length_half_temp = N_length_half + 1
else:
    N_length_half_temp = N_length_half

print(sum(N_divisors[N_length_half_temp:]) - (N_length - N_length_half_temp))

Submission status: Wrong Answer

Solution code:
import math


def main():
    N = int(input())
    if N <= 2:
        print(0)
        return
    sqrt = math.ceil(math.sqrt(N))
    ans = 0
    for x in range(1, sqrt):
        if N % x == 0:
            y = N // x - 1
            ans += y
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#D問題
#D問題
import math
N=int(input())
n=int(math.sqrt(N))
plist=[]
for i in range(1,n+1):
    if N%i == 0:
        plist.append(i)
        if i != int(N/i):
            plist.append(int(N/i))
ans=0
for x in plist:
    if x<int(N/2):
        kari=int(N/x)-1
        ans+=kari
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

def divisor(num):
    if num < 0:
        return 0
    if num == 1:
        return [1, ]

    divisor_list = [1, ]
    divisor_list_r = [num, ]

    i = 2
    while i * i < num:
        if num % i == 0:
            divisor_list.append(i)
        i += 1

    return divisor_list

N = int(input())
divisor_list = divisor(N)
ans = 0
for i in divisor_list:
    ans += (N - i) // i

print(ans)