Problem p02629 (python)

Fixed submission:
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    name_roop = []

    level = 1

    ans = ""
    while N > 0:
        N -= 1
        n = N % 26
        ans += ascii_lowercase[n]
        N //= 26
    print(ans[::-1])
    # for i in range(level, 1, -1):
    #     count = 0
    #     a = 26**(i-1)
    #     for j in range(26):
    #         if N-a > 26**(i-2):
    #             N -= a
    #             count += 1
    #     name_roop.append(count)

    # name_roop.append(N)
    # for i in name_roop:
    #     ans += ascii_lowercase[i-1]
    # print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    name_roop = []

    level = 1

    ans = ""
    n = 26
    for i in range(100):
        if N > n:
            n += 26**(i+2)
            level += 1
        else:
            break

    for i in range(level, 1, -1):
        count = 0
        a = 26**(i-1)
        for j in range(26):
            if N-a > 26**(i-2):
                N -= a
                count += 1

        name_roop.append(count)

    name_roop.append(N)
    for i in name_roop:
        ans += ascii_lowercase[i-1]
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    name_roop = []

    level = 1

    ans = ""
    n = 26
    for i in range(30):
        if N > n:
            n += 26**(i+2)
            level += 1
        else:
            break

    for i in range(level, 1, -1):
        count = 0
        a = 26**(i-1)
        for _ in range(27):
            if N-a > 0:
                N -= a
                count += 1
            if N <= a:
                name_roop.append(count)
                break

    for i in name_roop:
        ans += ascii_lowercase[i-1]
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    name_roop = []

    level = 1

    ans = ""
    n = 26
    for i in range(20):
        if N > n:
            n += 26**(i+2)
            level += 1
        else:
            break

    for i in range(level, 1, -1):
        count = 0
        a = 26**(i-1)
        for i in range(26):
            N -= a
            count += 1
            if N <= a:
                name_roop.append(count)
                break

    name_roop.append(N)
    for i in name_roop:
        ans += ascii_lowercase[i-1]

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    name_roop = []

    level = 1

    ans = ""
    n = 26
    for i in range(10):
        if N > n:
            n += 26**(i+2)
            level += 1
        else:
            break

    for i in range(level, 1, -1):
        count = 0
        a = 26**(i-1)
        for i in range(26):
            N -= a
            count += 1
            if N <= a:
                name_roop.append(count)
                break

    name_roop.append(N)
    for i in name_roop:
        ans += ascii_lowercase[i-1]

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    name_roop = []

    level = 1

    ans = ""
    n = 26
    for i in range(10):
        if N > n:
            n += 26**(i+2)
        else:
            break

    for i in range(level, 1, -1):
        count = 0
        a = 26**(i-1)
        for i in range(26):
            if N <= a:
                name_roop.append(count)
                break
            N -= a
            count += 1

    name_roop.append(N)

    for i in name_roop:
        ans += ascii_lowercase[i-1]

    print(ans)


if __name__ == '__main__':
    main()