Problem:


Score : 300 points

Problem Statement

1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:

the dogs numbered 1,2,\cdots,26 were respectively given the names a, b, ..., z;

the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names aa, ab, ac, ..., zy, zz;

the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names aaa, aab, aac, ..., zzy, zzz;

the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;

the dogs numbered 475255,475256,\cdots  were respectively given the names aaaaa, aaaab, ...;

and so on.

To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:

a, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...

Now, Roger asks you:

"What is the name for the dog numbered N?"

Constraints

N is an integer.

 1 \leq N \leq 1000000000000001

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer to Roger's question as a string consisting of lowercase English letters.

Sample Input 1

2

Sample Output 1

b

Sample Input 2

27

Sample Output 2

aa

Sample Input 3

123456789

Sample Output 3

jjddja



Sample input:
2


Sample output:
b

Submission status: Runtime Error

Solution code:
alphabet = "abcdefghijklmnopqrstrvwxyz"


n = int(input()) - 1

A = []
while n > 0:
    A.append(n % 26)
    n //= 26

m = len(A)

if m == 1:
    print(alphabet[A[0]])
    exit()

ANS = []
ANS.append(alphabet[A[0]])
for i in range(1, m - 1):
    if A[i] == 0:
        ANS.append("z")
        A[i + 1] -= 1
    else:
        ANS.append(alphabet[A[i] - 1])
if A[-1]:
    ANS.append(alphabet[A[-1] - 1])

print("".join(ANS[::-1]))

Submission status: Runtime Error

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

leng = int(math.log(n, 26))
org = leng
res = []
for i in reversed(range(leng)):
    leng = int(math.log(n, 26))
    num = n // 26**leng
    dum = n % 26**leng
    if dum == 0:
        res=('z'*org)
    else:
        res.append(chr(96+num))
    n -= 26**leng*num

if n%26 != 0:
    res.append(chr(96+n%26))

print(''.join(res))

Submission status: Runtime Error

Solution code:
n = int(input())
a = 0
r = 26
count = 1
result = ""
moji = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
while a == 0:
    if r <= n:
        n -= r
        r *= 26
        count += 1
    else:
        a = 1
zenbu = 26**count

def kaidan(zenbu,n):
    global moji
    for i in range(26):
        #print(i)
        if (zenbu/26)*i < n <= (zenbu/26)*(i+1):
            return(moji[i],i)

for l in range(count):
    kotae,s = kaidan(zenbu/(26**l),n)
    result += kotae
    n -= 26**(count-l-1)*s
print(result)

Submission status: Runtime Error

Solution code:
#-*-coding:utf-8-*-

import sys

def main2():
    name=""
    table_data="abcdefghijklmnopqrstuvwxyz"
    table=list(table_data)   
    n = int(input())
    
    while n>=27:
        d,r = divmod(n,26)
        n=d
        if r ==0:
            name_part=table[-1]
        else:
            name_part=table[r-1]
        name+=name_part
    
    if n<27 and r==0:
        name_part=table[n-2]
        name+=name_part
    else:
        name_part=table[n-1]
        name+=name_part       

    print(''.join(list(reversed(name))))

if __name__ == "__main__":
    main2()

Submission status: Runtime Error

Solution code:
alphabets = 'zabcdefghijklmnopqrstuvwxyz'

N = int(input())

for i in range(1,11):
    N = N - (26 ** i)
    if N <= 0:
        digit = i
        break

order = N + (26 ** i)

if order == 26 ** digit:
    print("z" * digit)
    exit()

ans = ""
ans = alphabets[order % 26]
order = order // 26

for i in range(digit - 1):
    ans = (alphabets[order % 26 + 1]) + ans
    order = order // 26
    
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    ans = ""

    while N > 26:
        tmp = N % 26
        txt = "z" if tmp == 0 else chr(tmp + 96)
        # if tmp == 0:
        #     ans += "z"
        # else:
        #     ans += chr(tmp + 96)
        ans += txt
        # print(f"{ans = }. {N = }")
        N //= 26
    else:
        txt = "z" if tmp == 0 else chr(tmp + 96)
        ans += txt

    print(ans[::-1])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
x = [chr(i) for i in range(ord("a"), ord("z"))]
ans = []
while n > 26:
    ans.append(x[n%26-1])
    n //= 26
ans.append(x[n-1])
print("".join(ans[::-1]))

Submission status: Runtime Error

Solution code:
N = int(input())
n = 0
saidai = 0
namae = ""
alpha = [chr(i) for i in range(97, 97+26)]


while 26*(26**(n+1)-1)/25 < N: #ここの＝はありかなしか
    n += 1
#print(str(n)+":n")

x = int(N - 26*((26**n)-1)/25) #これからxを２６進数で表す
while 26**(saidai+1) < x:  #ここの＝はありかなしか saidai:xが26の何条まであるか
    saidai += 1
#print(str(saidai)+":saidai")
#print(str(x)+":x初期値")

if saidai < n:
    for h in range(0,n-saidai):
        namae += "a"
for i in range(0,saidai+1):
    z = int(x // (26**(saidai-i)))
    x -= int(z*(26**(saidai-i)))
    if i == saidai:
        z -= 1
    #print(str(x)+":x")
    #print (str(z)+":z")
    namae += str(alpha[z])

print(namae)

"""
while x > 0:
    y = int(x // 26**saidai)
    x -= (26**saidai)*y
    saidai -= 1
    namae += str(alpha[y])
print(namae)
"""

Submission status: Runtime Error

Solution code:
from collections import defaultdict

N = int(input())
d = {1:"a", 2:"b", 3:"c", 4:"d", 5:"e", 6:"f", 7:"g", 8:"h", \
     9:"i", 10:"j", 11:"k", 12:"l", 13:"m", 14:"n", 15:"o", 16:"p", 17:"q", \
      18:"r", 19:"s", 20:"t", 21:"u", 22:"v", 23:"w", 24:"x", 25:"y", 26:"z"}

def Base_10_to_n(X, n):
    if(int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)+","
    return str(X%n)+","

a = Base_10_to_n(N, 26)
a = list(a.split(","))
ans = ""

for i in a:
    if(i == ""):
        continue
    ans += d[int(i)]        
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
i=0
x=""
while(N > 26**i):
    i +=1
while(i!=-1):
    if(N//26**i==1):
        x += "a"
    elif(N//26**i==2):
        x += "b"
    elif(N//26**i==3):
        x += "c"
    elif(N//26**i==4):
        x += "d"    
    elif(N//26**i==5):
        x += "e"
    elif(N//26**i==6):
        x += "f"
    elif(N//26**i==7):
        x += "g"
    elif(N//26**i==8):
        x += "h"
    elif(N//26**i==9):
        x += "i"
    elif(N//26**i==10):
        x += "j"
    elif(N//26**i==11):
        x += "k"
    elif(N//26**i==12):
        x += "l"
    elif(N//26**i==13):
        x += "m"
    elif(N//26**i==14):
        x += "n"    
    elif(N//26**i==15):
        x += "o"
    elif(N//26**i==16):
        x += "p"
    elif(N//26**i==17):
        x += "q"
    elif(N//26**i==18):
        x += "r"
    elif(N//26**i==19):
        x += "s"
    elif(N//26**i==20):
        x += "t"
    elif(N//26**i==21):
        x += "u"
    elif(N//26**i==22):
        x += "v"
    elif(N//26**i==23):
        x += "w"
    elif(N//26**i==24):
        x += "x"    
    elif(N//26**i==25):
        x += "y"
    elif(N//26**i==26):
        x += "z"
    else:

    N=N%(26**i)
    i -= 1
print(x)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 21 21:17:02 2020

@author: akinari
"""


N = int(input())

if N <= 26: #1
    ans = chr(N+96)
    
elif N <= 26 ** 2 + 26: #2
    N2 = int(N / 26)
    N1 = N % 26
    ans = chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26 ** 3 + 26 **2 +26: #3
    N3 = int(N / 26**2)
    N2 = int((N - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)

elif N <= 26**4 + 26**3 + 26**2 * 26: #4
    N4 = int(N / 26**3)
    N3 = int((N - 26**3*N4) / 26**2)
    N2 = int((N - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26**5 + 26**4 + 26**3 + 26**2 * 26:
    N5 = int(N / 26**4)
    N4 = int((N - 26**4*N5 )/ 26**3)
    N3 = int((N - 26**4*N5 - 26**3*N4) / 26**2)
    N2 = int((N - 26**4*N5 - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N5 + 96) + chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26**6 + 26**5 + 26**4 + 26**3 + 26**2 * 26:
    N6 = int(N /26**5)
    N5 = int((N - 26**5*N6)/ 26**4)
    N4 = int((N - 26**5*N6- 26**4*N5 )/ 26**3)
    N3 = int((N - 26**5*N6- 26**4*N5 - 26**3*N4) / 26**2)
    N2 = int((N - 26**5*N6- 26**4*N5 - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N6 + 96) + chr(N5 + 96) + chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26**7 + 26**6 + 26**5 + 26**4 + 26**3 + 26**2 * 26:
    N7 = int(N / 26**6)
    N6 = int((N - 26**6*N7) /26**5)
    N5 = int((N - 26**6*N7 - 26**5*N6) / 26**4)
    N4 = int((N - 26**6*N7 - 26**5*N6 - 26**4*N5 ) / 26**3)
    N3 = int((N - 26**6*N7 - 26**5*N6 - 26**4*N5 - 26**3*N4) / 26**2)
    N2 = int((N - 26**6*N7 - 26**5*N6 - 26**4*N5 - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N7 + 96) + chr(N6 + 96) + chr(N5 + 96) + chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26**8 + 26**7 + 26**6 + 26**5 + 26**4 + 26**3 + 26**2 * 26:
    N8 = int(N / 26**7)
    N7 = int((N - 26**7*N8) / 26**6)
    N6 = int((N - 26**7*N8 - 26**6*N7) /26**5)
    N5 = int((N - 26**7*N8 - 26**6*N7 - 26**5*N6) / 26**4)
    N4 = int((N - 26**7*N8 - 26**6*N7 - 26**5*N6 - 26**4*N5 ) / 26**3)
    N3 = int((N - 26**7*N8 - 26**6*N7 - 26**5*N6 - 26**4*N5 - 26**3*N4) / 26**2)
    N2 = int((N - 26**7*N8 - 26**6*N7 - 26**5*N6 - 26**4*N5 - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N8 + 96) + chr(N7 + 96) + chr(N6 + 96) + chr(N5 + 96) + chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26**9 + 26**8 + 26**7 + 26**6 + 26**5 + 26**4 + 26**3 + 26**2 * 26:
    N9 = int(N / 26**8)
    N8 = int((N - 26**8*N9) / 26**7)
    N7 = int((N - 26**8*N9 - 26**7*N8) / 26**6)
    N6 = int((N - 26**8*N9 - 26**7*N8 - 26**6*N7) /26**5)
    N5 = int((N - 26**8*N9 - 26**7*N8 - 26**6*N7 - 26**5*N6) / 26**4)
    N4 = int((N - 26**8*N9 - 26**7*N8 - 26**6*N7 - 26**5*N6 - 26**4*N5 ) / 26**3)
    N3 = int((N - 26**8*N9 - 26**7*N8 - 26**6*N7 - 26**5*N6 - 26**4*N5 - 26**3*N4) / 26**2)
    N2 = int((N - 26**8*N9 - 26**7*N8 - 26**6*N7 - 26**5*N6 - 26**4*N5 - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N9 + 96) + chr(N8 + 96) + chr(N7 + 96) + chr(N6 + 96) + chr(N5 + 96) + chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    ans = ""

    while N > 26:
        tmp = N % 26
        txt = "z" if tmp == 0 else chr(tmp + 96)
        ans += txt
        print(f"{ans = }. {N = }")
        N //= 26
    else:
        txt = "z" if tmp == 0 else chr(tmp + 96)
        ans += txt

    print(ans[::-1])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from itertools import product
from string import ascii_lowercase
import math
import sys
n=int(input())
i=0
alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
if n<=26:
    for combo in product(ascii_lowercase, repeat=1):
        if i==n-1:
            print(''.join(combo))
        i+=1
elif n<=702:
    for combo in product(ascii_lowercase, repeat=2):
        if i==n-26-1:
            print(''.join(combo))
        i+=1
elif n<=18278:
    for combo in product(ascii_lowercase, repeat=3):
        if i==n-702-1:
            print(''.join(combo))
        i+=1
elif n<=475254:
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-18278-1:
            print(''.join(combo))
        i+=1
elif n<= 12356630:
    if n==12356630:
        print("zzzzz")
        sys.exit()
    n=n-475254
    p=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+''.join(combo))
        i+=1
elif n<=321272406:
    if n==321272406:
        print("zzzzzz")
        sys.exit()
    n=n-12356630
    p=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[t]+''.join(combo))
        i+=1
elif n<=8353082582:
    if n==8353082582:
        print("zzzzzzz")
        sys.exit()
    n=n-321272406
    p=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=217180147158:
    if n==217180147158:
        print("zzzzzzzz")
        sys.exit()
    n=n-8353082582
    p=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=5646683826134:
    if n==5646683826134:
        print("zzzzzzzzz")
        sys.exit()
    n=n-217180147158
    p=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
elif n<=146813779479510:
    if n==146813779479510:
        print("zzzzzzzzzz")
        sys.exit()
    n=n-5646683826134
    p=math.floor(n/5429503678976)
    n=n%5429503678976
    if n==5646683826134:
        print(alphabets[p]+"zzzzzzzzz")
        sys.exit()
    l=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+alphabets[l]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[l]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1
else:
    n=n-146813779479510
    p=math.floor(n/141167095653376)
    n=n%141167095653376
    
    if n==146813779479510:
        print("zzzzzzzzzz")
        sys.exit()
    p=math.floor(n/141167095653376)
    n=n%141167095653376
    
    if n==5646683826134:
        print(alphabets[p]+alphabets[k]+"zzzzzzzzz")
        sys.exit()
    l=math.floor(n/208827064576)
    n=n%208827064576
    if n==217180147158:
        print(alphabets[p]+alphabets[k]+alphabets[l]+"zzzzzzzz")
        sys.exit()
    v=math.floor(n/8031810176)
    n=n%8031810176
    if n==8353082582:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+"zzzzzzz")
    n=n-321272406
    o=math.floor(n/308915776)
    n=n%308915776
    if n==321272406:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+"zzzzzz")
    u=math.floor(n/11881376)
    n=n%11881376
    if n==12356630:
        print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+"zzzzz")
    t=math.floor(n/456976)
    n=n%456976
    for combo in product(ascii_lowercase, repeat=4):
        if i==n-1:
            print(alphabets[p]+alphabets[k]+alphabets[l]+alphabets[v]+alphabets[o]+alphabets[u]+alphabets[t]+''.join(combo))
        i+=1

Submission status: Runtime Error

Solution code:
    #test()
    N = int(input())
    ans = resolver(N)

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
sakai=[]
k=0
for i in range(10):
  k+=26**(i+1)
  sakai.append(k)

if n<=26:
  n-=1
  u=1
elif n>sakai[9]:
  n-=sakai[9]+1
  u=11
for i in range(9):
  if (sakai[i]<n<=sakai[i+1]):
    n-=sakai[i]+1
    u=i+2

def base(n):
  ans=[]
  while(n>26):
    r=n%26
    n=(n-r)//26
    ans.append(r)
  ans.append(n)
  return ans


p=base(n)

if u-len(p)>0:
  ans_3='a'
  if u-len(p)>1:
    for j in range(u-len(p)-1):
      ans_3+='a'
    
for i in range(len(p)):
  if i==0:
    ans_2=al[p[len(p)-i-1]]
  else:
    ans_2=ans_2+al[p[len(p)-i-1]]
if u-len(p)>0:
  print(ans_3+ans_2)
else:
  print(ans_2)

Submission status: Runtime Error

Solution code:
#C
import bisect
alphabet = "abcdefghijklmnopqrstuvwxyz"
n = int(input())
cnt = 0
amari = []

#下処理
niroku = [1]
for i in range(1,15):
    a = niroku[-1]
    niroku.append(a + 26**i)

idx = bisect.bisect_left(niroku, n)

n = n - niroku[idx-1] + 1
z_cnt = idx-1
#print(n)
while n // 26 > 0:
    n_before = n
    amari.append(str(n%26))
    a = n % 26
    n = n // 26
    cnt += 1
#print(a)
#print(n)
#print(cnt)

if int("".join(amari)) != 0: 
    amari.append(str(n))
amari.reverse()
#print(amari)
result = []

for i in range(len(amari)):
    result.append(alphabet[int(amari[i])-1])

for i in range(z_cnt):
    result[i] = "z"

print("".join(result))

Submission status: Runtime Error

Solution code:


alpha = ['', 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

num = int(input())
dum = num
cnt = 1
a = 0

while 1:
    a += 26**cnt
    if a >= dum:
        # print('a',end = '')
        # print(a)
        break
    cnt += 1
# print(cnt)
cnt -= 1
num_list = []
for i in range(1, cnt+1):
    num_list.append(26**i)
# print(num_list)
num_list2 = []
for i in range(0, cnt):
    num_list2.append(sum(num_list[0:i+1]))
# print(num_list2)

while cnt > 0:
    
    ind = int(num/num_list2[cnt-1])
    # print(ind, num)
    if ind > 26:
        ind -= 1
    num = num - ind*num_list[cnt-1]
    # print(num)
    cnt -= 1
    print(alpha[ind], end='')
    # print(alpha[ind])
print(alpha[num])

Submission status: Runtime Error

Solution code:
n = int(input())
s=[]
alp = [chr(i) for i in range(97, 97+26)]
word = []
while n > 0:
    s.append(n % 26)
    n = n // 26
for m in s:
    if m == 0:
        word.append("z")
    else:
        word.append(alp[m - 1])
word.reverse()
if word[0] == "a" and word[1] == "z":
    word.pop(0)
print("".join(word))

Submission status: Runtime Error

Solution code:
import copy

dic2 = ["0", "1"]
dic16 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]
dic188 = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

def down(num, be):
    dq = []
    
    while True:
        dq.append(num % be)
        num = num // be
        if num == 0:
            break
    da = copy.deepcopy(dq)

    return dq,da
    
    
    
def c10_16(num):
    dq,da = down(num, 16)
    
    for i in range(len(dq)):
        dq[(i+1)*(-1)] = dic16[da[i]]
    print("".join(dq))


def c10_2(num):
    dq,da = down(num, 2)
    
    for i in range(len(dq)):
        dq[(i+1)*(-1)] = dic2[da[i]]
    print("".join(dq))
    
    
def c10_188(num):
    dq,da = down(num, 26)
    
    for i in range(len(dq)):
        dq[(i+1)*(-1)] = dic188[da[i]]
    print("".join(dq))
    


#while True:
    print("何をしますか?(10進数を16進数に変更->10_16)")
    kind = str(input())
    print("数値を入力してください、'f'で終了")
    """
    try:
        Q = input()
        
        if Q == "f":
            break
        
        if type(Q) == "float":
            print("少数は扱えません")
        elif Q == str(int(Q)):
            Q = int(Q)
        else:
            print("その数字は扱えません")
            continue
    except ValueError:
        print("文字列は扱えません!!")
        continue
    if kind == "10_16":
        c10_16(Q)
    elif kind == "10_2":
        c10_2(Q)
        """

c10_188(input())
    
"""
#追加用
while True:
    s = input()
    dic188.append(str(s))
    print(dic188)
"""

Submission status: Runtime Error

Solution code:
import itertools

n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
t = 0
if n <= 26:
    print(s[n - 1])
    exit()
for i in range(2, 100):
    t += 26 ** i
    n -= 26 ** (i - 1)
    if n <= t:
        t = i
        break
res = list(itertools.product(s, repeat=t))[n - 1]

print("".join(res))

Submission status: Runtime Error

Solution code:
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce

n = int(input())
az = "abcdefghijklmnopqrstuvwxyz"
cnt = 12
ret = []
ama = n % 26
na = n
for i in range(12, 0, -1):
    if 26**(i-1) > n:
        continue
    sho = na // (26**i)
    if sho > 0:
        ret.append(az[sho-1])
    else:
        if len(ret) > 0:
            ret.append('z')
    na -= sho * (26**i)
if (ret[0] == 'z'):
    del ret[0]
re = "".join(ret)
print(re)

Submission status: Runtime Error

Solution code:
N = int(input())
n = 0
saidai = 0
namae = ""
alpha = [chr(i) for i in range(97, 97+26)]


while 26*(26**(n+1)-1)/25 < N: #ここの＝はありかなしか
    n += 1
print(str(n)+":n")

x = int(N - 26*((26**n)-1)/25) #これからxを２６進数で表す
while 26**(saidai+1) < x:  #ここの＝はありかなしか saidai:xが26の何条まであるか
    saidai += 1
print(str(saidai)+":saidai")
print(str(x)+":x初期値")

if saidai < n:
    for h in range(0,n-saidai):
        namae += "a"
for i in range(0,saidai+1):
    z = int(x // (26**(saidai-i)))
    x -= int(z*(26**(saidai-i)))
    if i == saidai:
        z -= 1
    print(str(x)+":x")
    print (str(z)+":z")
    namae += str(alpha[z])

print(namae)

"""
while x > 0:
    y = int(x // 26**saidai)
    x -= (26**saidai)*y
    saidai -= 1
    namae += str(alpha[y])
print(namae)
"""

Submission status: Runtime Error

Solution code:
n = int(input())
a = 0
r = 26
count = 1
result = ""
moji = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
while a == 0:
    if r <= n:
        n -= r
        r *= 26
        count += 1
    else:
        a = 1
zenbu = 26**count

def kaidan(zenbu,n):
    global moji
    for i in range(26):
        #print(i)
        if zenbu/26*i < n <= zenbu/26*(i+1):
            return(moji[i],i)

for l in range(count):
    kotae,s = kaidan(zenbu/(26**l),n)
    result += kotae
    n -= 26**(count-l-1)*s
print(result)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
dog = 1000000000000001
cnt=0
j=1
tmp = n
num = [0] * 100000000
moji = "abcdefghijklmnopqrstuvwxyz"
ans_ = ""
ans = ""
for i in range(10000000):
    cnt+=1
    if 1 > tmp / 27:
        num[i] = int(tmp % 26)
        break
    else:
        num[i] = int(tmp / 26)
        tmp = tmp - pow(26,i+1)
        #num[i] = int(tmp % 26)

for i in range(cnt):
    ans_ = moji[num[i]-1] + ans_
ans = ans_[::-1]
   
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

keta_now = 0
res_num = []

MAP = {
    1:"a",
    2:"b",
    3:"c",
    4:"d",
    5:"e",
    6:"f",
    7:"g",
    8:"h",
    9:"i",
    10:"j",
    11:"k",
    12:"l",
    13:"m",
    14:"n",
    15:"o",
    16:"p",
    17:"q",
    18:"r",
    19:"s",
    20:"t",
    21:"u",
    22:"v",
    23:"w",
    24:"x",
    25:"y",
    26:"z",
}

while True:
    keta_now += 1
    if n < sum([26**k for k in range(keta_now+1)]):
        
        for i in range(keta_now, 0, -1):
            for al in range(26, 0, -1):
                if i == 1:
                    res_num.append(n)
                    break
                if n >= (26**(i-1) * al):
                    res_num.append(al)
                    n -= (26**(i-1) * al)
                    break
            
        break           
print("".join([MAP[n] for n in res_num]))

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())

    i = 1
    sum = 0
    temp = 0
    while True:
        temp = 0
        i += 1
        sum += 1
        for j in range(1,i):
            temp += 26**j

        if N <= temp:
            break

    # 文字数はsum
    #for j in range(1,sum):
        #temp += 26**j
    #N -= temp

    ans = []
    flag = 0
    cnt = 0
    for j in range(sum):
        amari = N%26
        if amari == 0:
            flag = 1
            cnt += 1
            if cnt == 1:
                #print(amari,flag)
                ans.append(amari)
                N = N//26
                continue
        N = N//26
        #print(amari,flag)
        ans.append(amari-flag)

    #print(ans)

    ans2 = [0]*(sum)
    dict = {1:'a',2:'b',3:'c',4:'d',5:'e',6:'f',7:'g',8:'h',9:'i',10:'j',11:'k',12:'l',13:'m',14:'n',15:'o',16:'p',17:'q',18:'r',19:'s',20:'t',21:'u',22:'v',23:'w',24:'x',25:'y',0:'z'}
    for j in range(sum):
        ans2[sum-1-j] = dict[ans[j]]
    print(''.join(ans2))


main()

Submission status: Runtime Error

Solution code:
n= input()
n=int(n)
dic = {1:"a",2:"b",3:"c",4:"d",5:"e",6:"f",7:"g",8:"h",9:"i",10:"j",
       11:"k",12:"l",13:"m",14:"n",15:"o",16:"p",17:"q",18:"r",19:"s",20:"t",
       21:"u",22:"v",23:"w",24:"x",25:"y",26:"z"}
if n >= 26**1+1 and n <= 26**2+26**1:
  dic[n] = dic[n//26] + dic[n%26]
#elif n >= 26**2+26**1+1 and n <= 26**3+26**2+26**1:
#  dic[n] = dic[n//26**2]  + dic[n%26**2] + dic[n%26**1]

print(dic[n])

Submission status: Runtime Error

Solution code:
N = int(input())
 
def num2alpha(N):
  grobal(N)
  if (N-1)<=26:
    return chr(64+N-1)
  elif (N-1)%26==0:
    return num2alpha((N-1)//26-1)+chr(90)
  else:
    return num2alpha((N-1)//26)+chr(64+(N-1)%26)
  
num2alpha(N-1)

Submission status: Runtime Error

Solution code:
N = int(input())
alphabet = "zabcdefghijklmnopqrstuvwxy"
num = N
cnt = 0
div = 26
res = ""
while True:
  # print(num, div)
  sho = num // div
  amari = num % div
  # print(sho, amari, alphabet[amari])
  # print("--")
  res += alphabet[amari]
  if amari != 0:
    num = sho
  else:
    num = sho
    div += 1
  if sho == 0:
    break
  elif sho == 1 and amari == 0 and alphabet[amari] == "z":
    break
print(res[::-1])

Submission status: Runtime Error

Solution code:
N = int(input())

cnt = 1
th = 0

while th < N:
    th += 26**cnt
    cnt+=1

keta = cnt - 1

alpha = 0
alpha_list = []


for j in range(keta):
    
    alpha = N % 26
    if alpha == 0:
        alpha = 26
        
    N //=26
        
    alpha_list.append(alpha)

alpha_list = alpha_list[::-1]
result = ""
for aaa in alpha_list:
    result+=abc[aaa-1]
print(result)

Submission status: Runtime Error

Solution code:
import copy

bs = [26**i for i in range(0, 20)]
""" pull up """
for i in range(1, len(bs)):
    bs[i] += bs[i-1]
# print(bs)

def dec_wac(num, params):
    rs = []
    for d, p in reversed(params):
        r = num//(26**d)
        # print(p, r, num)
        rs.append(r)
        num -= r*(26**d)
    return rs

def loop(num):
    """ calc max """
    a = [(idx,b) for idx, b in enumerate(bs) if b <= num]
    # print(a)
    k_num = num - a[-1][1]
    params = [(d,kn) for d, kn in a]
    # print(k_num, params, dec_wac(num, params))
    return dec_wac(num, params)

cs = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ".lower())

a = "".join([cs[i-1] for i in loop(int(input()))])
print(a)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 21 21:17:02 2020

@author: akinari
"""


N = int(input())

if N <= 26: #1
    ans = chr(N+96)
    
elif N <= 26 ** 2 + 26: #2
    N2 = int(N / 26)
    N1 = N % 26
    ans = chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26 ** 3 + 26 **2 +26: #3
    N3 = int(N / 26**2)
    N2 = int((N - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)

elif N <= 26**4 + 26**3 + 26**2 * 26: #4
    N4 = int(N / 26**3)
    N3 = int((N - 26**3*N4) / 26**2)
    N2 = int((N - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26**5 + 26**4 + 26**3 + 26**2 * 26:
    N5 = int(N / 26**4)
    N4 = int((N - 26**4*N5 )/ 26**3)
    N3 = int((N - 26**4*N5 - 26**3*N4) / 26**2)
    N2 = int((N - 26**4*N5 - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N5 + 96) + chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26**6 + 26**5 + 26**4 + 26**3 + 26**2 * 26:
    N6 = int(N /26**5)
    N5 = int((N - 26**5*N6)/ 26**4)
    N4 = int((N - 26**5*N6- 26**4*N5 )/ 26**3)
    N3 = int((N - 26**5*N6- 26**4*N5 - 26**3*N4) / 26**2)
    N2 = int((N - 26**5*N6- 26**4*N5 - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N6 + 96) + chr(N5 + 96) + chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
elif N <= 26**7 + 26**6 + 26**5 + 26**4 + 26**3 + 26**2 * 26:
    N7 = int(N / 26**6)
    N6 = int((N - 26**6*N6)/26**5)
    N5 = int((N - 26**6*N6 - 26**5*N6)/ 26**4)
    N4 = int((N - 26**6*N6 - 26**5*N6 - 26**4*N5 )/ 26**3)
    N3 = int((N - 26**6*N6 - 26**5*N6 - 26**4*N5 - 26**3*N4) / 26**2)
    N2 = int((N - 26**6*N6 - 26**5*N6 - 26**4*N5 - 26**3*N4  - 26**2*N3) / 26)
    N1 = N % 26
    ans = chr(N6 + 96) + chr(N6 + 96) + chr(N5 + 96) + chr(N4 + 96) + chr(N3 + 96) + chr(N2 + 96) + chr(N1 + 96)
    
print(ans)

Submission status: Runtime Error

Solution code:
import math

N = int(input())
i = 0

c = math.log(N-1, 26)
A = list(range(int(c)+1))

while(N!=0):
  c,d = divmod(N-1, 26)
  A[i] = chr(d+97)
  N = c
  i+=1

A.reverse()
print("".join(A))

Submission status: Runtime Error

Solution code:
def sequence(i):
  return 26 * (pow(26, i) - 1) // 25

n = int(input())
group = 1
while(n > sequence(group)):
  group += 1
  
at = n - sequence(group - 1)

name = ''
alph = 'abcdefghijklmnopqrstuvwxyz'

for i in range(group):
    base = n // pow(26, group - 1 - i)
    name += alph[base-1]
    n -= base * pow(26, group - 1 -i)

print(name)

Submission status: Runtime Error

Solution code:
import string
n = int(input())
letters = list(string.ascii_lowercase)
name = ''
store = []
b = 0
while n > 26:
    a = n%26
    n /= 26
    b += 1
    store.append(int(a))
if store[0] == 0:
    for i in range(0, b):
        name += 'z'
else:
    for i in store:
        name += letters[i-1]
    name += letters[int(n)-1]
print(name[::-1])