Buggy python submission (verdict: Runtime Error):
import math


def main():
    n = int(input())
    a = []
    for i in range(1, (int)(math.sqrt(n)) + 1):
        if n % i == 0:
            if i != 1:
                a.append(i - 1)
            a.append((n // i) - 1)
    a.sort()
    ans = 0
    if len(a) == 0:
        ans = 0
    else:
        for i in a:
            if i != 1 and (n // i == n % i):
                ans += i
    print(ans)


main()


Fixed submission:
import math


def main():
    n = int(input())
    a = []
    for i in range(1, (int)(math.sqrt(n)) + 1):
        if n % i == 0:
            if i != 1:
                a.append(i - 1)
            if n // i - 1 != 0:
                a.append((n // i) - 1)
    ans = 0
    for i in range(len(a)):
        if a[i] != 1 and (n // a[i] == n % a[i]):
            ans += a[i]
    print(ans)


main()

Buggy python submission (verdict: Runtime Error):
import math
def main():
    n = int(input())
    a = []
    for i in range(1,(int)(math.sqrt(n)) + 1):
        if n % i == 0:
            if i != 1:
                a.append(i - 1)
            a.append((n // i) - 1)
    a.sort()
    ans = 0
    for i in a:
        if i != 1 and (n // i == n % i):
            ans += i
    print(ans)
main()


Fixed submission:
import math


def main():
    n = int(input())
    a = []
    for i in range(1, (int)(math.sqrt(n)) + 1):
        if n % i == 0:
            if i != 1:
                a.append(i - 1)
            if n // i - 1 != 0:
                a.append((n // i) - 1)
    ans = 0
    for i in range(len(a)):
        if a[i] != 1 and (n // a[i] == n % a[i]):
            ans += a[i]
    print(ans)


main()

Buggy python submission (verdict: Runtime Error):
import math
def main():
    n = int(input())
    a = []
    for i in range(1,(int)(math.sqrt(n)) + 1):
        if n % i == 0:
            if i != 1:
                a.append(i - 1)
            a.append(n // i - 1)
    a.sort()
    print(a)
    ans = 0
    for i in a:
        if i != 1 and n // i == n % i:
            ans += i
    print(ans)
main()


Fixed submission:
import math


def main():
    n = int(input())
    a = []
    for i in range(1, (int)(math.sqrt(n)) + 1):
        if n % i == 0:
            if i != 1:
                a.append(i - 1)
            if n // i - 1 != 0:
                a.append((n // i) - 1)
    ans = 0
    for i in range(len(a)):
        if a[i] != 1 and (n // a[i] == n % a[i]):
            ans += a[i]
    print(ans)


main()

Buggy python submission (verdict: Runtime Error):
import math
def main():
    n = int(input())
    a = []
    for i in range(1,(int)(math.sqrt(n)) + 1):
        if n % i == 0:
            if i != 1:
                a.append(i - 1)
            a.append(n // i - 1)
    a.sort()
    print(a)
    ans = 0
    for i in a:
        if i != 1 and n // i == n % i:
            ans += i
    print(ans)
main()


Fixed submission:
import math


def main():
    n = int(input())
    a = []
    for i in range(1, (int)(math.sqrt(n)) + 1):
        if n % i == 0:
            if i != 1:
                a.append(i - 1)
            if n // i - 1 != 0:
                a.append((n // i) - 1)
    ans = 0
    for i in range(len(a)):
        if a[i] != 1 and (n // a[i] == n % a[i]):
            ans += a[i]
    print(ans)


main()