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:
N = int(input())
alphabet_lst = list('abcdefghijklmnopqrstuvwxyz')
#print(alphabet_lst)

keta = 0
keta_lst = []
while N>=sum(keta_lst):
    keta_lst.append(26**keta)
    keta += 1
    
keta -= 1
keta_lst = keta_lst[:keta]
#print(keta_lst)
#print(keta)

ans_lst = []
for i in range(keta):
    ans_n = N // keta_lst[-(i+1)]
    #print(ans_n)
    #print(keta_lst[-(i+1)])
    N -= ans_n*keta_lst[-(i+1)]
    ans_lst.append(alphabet_lst[ans_n-1])

for i in range(keta):
    print(ans_lst[i],end="")

Submission status: Runtime Error

Solution code:
N = int(input())

def num2alpha(N-1):
  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:
s="abcdefghijklmnopqrstuvwxyz"
m=""
while n:		
  # print(r)
  if(n%26==0):
    m+='z'
    else:
      m+=s[(n%26)-1]
      n=(n//26)
      # reverse
      m=m[::-1]
      print(m)

Submission status: Runtime Error

Solution code:
N = int(input())

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

i = 1
my_str = []
while True:
    if 26 ** i > N:
        if i == 1:
            print(amari(N))
            exit()
        for j in range(i - 2 + 2):
            t = amari(N // (26 ** (1 + i - 2 - j)))
            my_str.append(t)
            N -= ((26 ** (1 + i - 2 - j) *  (N // (26 ** (1 + i - 2 - j)))))
        strA = "".join(my_str)
        print (strA)
        exit()
    i += 1

Submission status: Runtime Error

Solution code:
N = int(input())

moji = [chr(i) for i in range(97, 97+26)]


lst = [0]
n = 0
for i in range(1,12):
    n = n + 26 ** i
    lst.append(n)

#lst.sort(reverse=True)
#print(lst)
keta = 0
for i in range(len(lst)):
    if N <= lst[i]:
        keta = i
        break

keta -= 1
ans = []
for i in range(keta+1):
    tmp = N // (26**keta)
    ans.append(tmp)
    N = N % (26**keta)
    keta -= 1
#print(ans)

answer = ''
for i in ans:
    answer += moji[i-1]
print(answer)

Submission status: Runtime Error

Solution code:
N = int(input())
str_row = ['z','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']
result = []

while N > 26:
    r = N % 26
    result.append(str_row[r])
    N = int(N / 26)
    if N == 27:
        break

if N == 27:
    result.append('z')
else:
    result.append(str_row[N])

for i in result[::-1]:
    print(str(i), end='')

Submission status: Runtime Error

Solution code:
s="abcdefghijklmnopqrstuvwxyz"
	m=""
	while n:		
		# print(r)
		if(n%26==0):
			m+='z'
		else:
			m+=s[(n%26)-1]
		n=(n//26)
	# reverse
	m=m[::-1]
	print(m)

Submission status: Runtime Error

Solution code:
N =int(input())
S =N
count = 1
t = 13
for i in range(t):
    if S > 26**(t-i):
        a = S // 26**(t-i)
        S -= a*26**(t-i)
        count += 1


A=["*"]*count
#print(A)
for i in range(len(A)):
    a = N // 26**(len(A)-i-1) 
    if a ==27:
        A[i] = 26
        N-=26 * 26**(len(A)-i-1)
    else:
        A[i] = a
        N -= a * 26**(len(A)-i-1)
    
    
#print(A)
B =[]
for i in A:
    if i != "*":
        B.append(chr(96+i))
    
print("".join(B))

Submission status: Runtime Error

Solution code:
N = int(input())
List = ['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']
nList = []
while True:
  if N % 26 != 0:
    nList.append(List[(N % 26)-1])
    N = (N - (N % 26)) / 26
  else:
    break
nList.reverse()
print(''.join(nList))

Submission status: Runtime Error

Solution code:

 k=0
ans=[]
while k<1:
    if num<=26:
        ans.append((chr(96+num)))
        k=1
    elif num%26==0:
        num=(num//26-1)
        ans.append((chr(96+26)))
    else:
        ans.append((chr(96+num%26)))
        num=(num//26)

for i in range(len(ans)-1,-1,-1):
    if i ==0:
        print(ans[i])
    else:
        print(ans[i], end="")

Submission status: Runtime Error

Solution code:
alp=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','z']
if a<27:
 print(alp[a-1])
else:
 b=a//26
 c=a%26
 ans=[]
 for i in range(17):
  if b/(10^(i+1))>0:
    d=int(b/(10^(i+1)))
    ans.append(alp[d-1])
  else:
    break
 ans.append(alp[c-1])

 print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
X=[chr(ord('a')+i) for i in range(26)]
if N<=26:
    print(X[N-1])
elif N<=702:
    K1=((N-26)//26)
    K2=(((N-26)%26)-1)
    K=X[K1]+X[K2]
    print(K)
elif N<=18278:
    K1=((N-702)//676)
    K2=((N-702-(K1)*676)//26)
    K3=((N-702)%26)-1
    K=X[K1]+X[K2]+X[K3]
    print(K)
elif N<=474552:
    K1=((N-18278)//17576)
    K2=((N-18278-(K1)*18278)//676)
    K3=((N-18278-(K1)*18278-(K2)*676)//26)
    K4=((N-188278)%26)-1
    K=X[K1]+X[K2]+X[K3]+X[K4]
    print(k)
elif N<=12338352:
    K1=((N-474552)//456976)
    K2=((N-474552-(K1)*456976)//17576)
    K3=((N-474552-(K1)*456976-(K2)*17576)//676)
    K4=((N-474552-(K1)*456976-(K2)*17576-(K3)*676)//26)
    K5=((N-474552)%26)-1
    K=X[K1]+X[K2]+X[K3]+X[K4]+X[K5]
    print(K)
else:
    K1=((N-12338352)//11881376)
    K2=((N-12338352-(K1)*11881376)//456976)
    K3=((N-12338352-(K1)*11881376-(K2)*456976)//17576)-1
    K4=((N-12338352-(K1)*11881376-(K2)*456976-(K3)*17576)//676)-1
    K5=((N-12338352-(K1)*11881376-(K2)*456976-(K3)*17576-(K4)*676)//26)-1
    K6=((N-12338352)%26)-1
    K=X[K1]+X[K2]+X[K3]+X[K4]+X[K5]+X[K6]
    print(K)

Submission status: Runtime Error

Solution code:
n = int(input())

import math
# 桁判定
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 < (26**keta_now + 26**(keta_now-1)):
    if n < sum([26**k for k in range(keta_now+1)]):
        # 26より大きく702以下
        
        # 最大桁iのうち、i**1からi**26(a to z)でnより小さく最大のものを26_iとする
        # n - 26_i
        # (i-1)**1から(i-1)**26でn -26_iより小さく最大のもの
        # 繰り返してiが0の時に終了
        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:
N = int(input())
n = N
num = 1
str = ''
str_list = 'abcdefghijklmnopqrstuvwxyz'
#str_list = str_list[::-1]
while True:
  if n > 26**num:
    n -= 26 ** num
    num+=1
  else:
    break
    
for ind, i in enumerate(reversed(range(num))):
  if N > 26**i:
    N -= 26**i
    str += str_list[N // (26**i)]
  else:
    str += str_list[N // (26**i)-1]
  N -= 26**i * (N // (26**i))
    
print(str)

Submission status: Runtime Error

Solution code:
N=int(input())
L =[chr(ord('a') + i) for i in range(26)]
K=[]
i=1
while True:
  if 26**i>=N:
    break
if i == 1:
  K.insert(L[N])
else:
  for h in range(2,i+1):
    T=(N/26-1)*(h-1)
    K.insert(L[T])

Submission status: Runtime Error

Solution code:
import math
Alp = [chr(ord('a') + i) for i in range(26)]
N = int(input())
k = int(math.ceil(math.log((25*N/26)+1,26)))
n = int(N-(26*(26**(k-1)-1)/25))
for i in range(k):
  if i<k-1:
    kre = int(n//(26**(k-1-i)))
    print(Alp[kre], end='')
    n -= int((26**(k-1-i))*kre)
  else:
    print(Alp[n-1], end='')

Submission status: Runtime Error

Solution code:
#%%
N = int(input())

dic = {}
for i in range(1, 27):
    dic[i] = chr(97 + i -1)

temp = N 
ans = ""

while temp // 26 != 0:
    aa = temp % 26
    ans += dic[aa]
    temp = temp // 26
        
ans += dic[temp]
ans = ans[::-1]
print(ans)

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = i()
A = [26**i for i in range(1,100)]
A = [0]+list(itertools.accumulate(A))
cnt = 0
for i in range(N):
    if A[i] >= N:
        p = cnt
        break
    cnt += 1
if p == 1:
    print(chr(N+96))
    exit()
s = []
if N in A:
    print('z'*p)
    exit()
for i in range(p):
    m = chr(N%26+96)
    if m == '`':
        m = 'a'
    s.append(m)
    N = N//26
s.reverse()
print(''.join(s))

Submission status: Runtime Error

Solution code:
n = int(input())
#n = 475256
strList = [chr(ord('a') + i) for i in range(26)]
surplusList = []
while n > 26:
    if n==27 and 0 in surplusList:
        #surplusList.append(n%26)
        break
    else:
        surplusList.append(n%26)
        n = n/26
surplusList.append(n)
surplusList.reverse()
while 0 in surplusList:
    index = surplusList.index(0)
    surplusList[index-1] = surplusList[index-1]-1
    surplusList[index] = 26
name = ''
for i in range(len(surplusList)):
    name = name + strList[surplusList[i]-1]
print(surplusList)
print(name)

Submission status: Runtime Error

Solution code:
d={0:"z",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"}

x=input()
y=int(x)
s=""
while y!=0:
	s+=d[y%26]
	
	y=y//26
	//print(y)
	
print(s[::-1])

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]]
  elif i==len(p)-1:
    ans_2=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:
MAX = 1000000000000001
n = int(input())

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

  
buffer = 1
cutlist = []
while True :
  buffer *= 26
  cutlist.append(buffer)
  buffer += 1
  if(buffer > MAX):
    break
target = 0
for i in range(len(cutlist)):
  if n/cutlist[i] <= 1:
    target= i
    break

moji = []
divn = n
for j in range(target+1):
  moji.append(divn%26)

  divn = int(divn/26)
  if divn < 1:
    break
cou = 0
for g in moji:
  if g == 0:
    moji[cou] = 26
  cou += 1

count = 0
for o in moji:
  if count == 0:
    before = o
    count += 1
    continue
  if (before == 26):
    moji[count] -= 1
  before = o
  
moji.reverse()
text = ""
for m in moji:
  text += chenge_moji(m)

    
print(text)

Submission status: Runtime Error

Solution code:
import math
N = int(input())
if math.log(25*N+26, 26) == int(math.log(25*N+26, 26)):
    d = int(math.log(25*N+26, 26)) -1
else:
    d = int(math.log(25*N+26, 26))
pre = (pow(26,d)-26)//25
diff = N - pre
ans = [97 for _ in range(d)]
for i in range(d):
    if i == d-1:
        ans[i] += diff -1
        break
    if diff % pow(26, d-1-i) == 0:
        x = 25
    else:
        x = diff // pow(26, d-1-i)
    ans[i] += x
    diff -= x*pow(26, d-1-i)
for a in ans:
    print(chr(a), end='')

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:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
A = sorted(A)
for i in range(Q):
  B, C = map(int,input().split())
  flag = False
  for j in range(N):
    if A[j]==B:
      A[j]=C
      flag = True
    elif flag:
      break

  print(sum(A))

Submission status: Runtime Error

Solution code:
ml = []
n = int(input())

for i in range(1,11):
    if (26**i-1)*26/25 > n:
        break
a = n - (26**(i-1)-1)*26/25
lis =[]
for k in range(i-1):
    lis.append(a%26)
    a = a//26

alp = list('abcdefghijklmnopqrstuvwxyz')
lis.append(a)
lis.reverse()
m = lis[-1]
del lis[-1]
for j in lis:
    ml.append(alp[int(j)])
ml.append(alp[int(m)-1])
print("".join(ml))

Submission status: Runtime Error

Solution code:
n = int(input())

table = []
x = 1
for i in range(20):
    table.append(x)
    x *= 26

i = 0
while True:
    if table[i] > n:
        k = i
        break;
    else:
        i += 1

k -= 1
cnt = 0
mapping = []

while k >= 0:
    if k == 0:
        mapping.append(n)
        break
    if n > table[k]:
        n -= table[k]
        cnt += 1
    else:
        mapping.append(cnt)
        cnt = 0
        k -= 1

"""
for i in range(len(mapping)):
    if mapping[i] == 0:
        mapping[i] = 1
"""

#print(mapping)

dictionary = {}
alphabet = 'a'
for i in range(26):
    dictionary[i+1] = alphabet
    alphabet = chr(ord(alphabet) + 1)

for i in mapping:
    print(dictionary[i], end='')
print()
#k = 11

Submission status: Runtime Error

Solution code:
n=int(input())

while n>=0:
  n=n-1 ##for tracking last character
  z+= chr( n%26 + ord('a') )
  n=n//26
print(z[::-1])

Submission status: Runtime Error

Solution code:
n = int(input())

table = []
x = 1
for i in range(12):
    table.append(x)
    x *= 26

i = 0
while True:
    if table[i] > n:
        k = i
        break;
    else:
        i += 1

k -= 1
cnt = 0
mapping = []

while k >= 0:
    if k == 0:
        mapping.append(n)
        break
    if n > table[k]:
        n -= table[k]
        cnt += 1
    else:
        mapping.append(cnt)
        cnt = 0
        k -= 1

"""
for i in range(len(mapping)):
    if mapping[i] == 0:
        mapping[i] = 1
"""

#print(mapping)

dictionary = {}
alphabet = 'a'
for i in range(26):
    dictionary[i+1] = alphabet
    alphabet = chr(ord(alphabet) + 1)

for i in mapping:
    print(dictionary[i], end='')
print()
#k = 11

Submission status: Runtime Error

Solution code:
A=list(input().split(" "))
B=list(input().split(" "))
C=sorted(B)
D=[]
M=0
for i in range(int(A[1])):
    D.append(int(C[i]))
for j in range(len(D)):
    M=D[j]+M
print(M)

Submission status: Runtime Error

Solution code:
import string
n=input(int())
a=[chr(i) for i in range(97,97+26)]
b=n
c=[]
while b>0:
    b=b//25
    d=b%25
    c.append(a[d])
c=''.join(c)
print(c)

Submission status: Runtime Error

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

d = int(math.log(25*N+26, 26)-0.0000001)
pre = (pow(26,d)-26)//25
diff = N - pre
ans = [97 for _ in range(d)]
# print(d, diff)
for i in range(d):

    if i == d-1:
        ans[i] += diff -1
        break
    if diff % pow(26, d-1-i) == 0:
        x = 25
    else:
        x = diff // pow(26, d-1-i)
    # x = diff//26
    ans[i] += x
    # if x == 0:
    #     continue
    diff -= x*pow(26, d-1-i)
    # print(x, diff, pow(26, d-1-i))
# print(ans)
for a in ans:
    print(chr(a), end='')

Submission status: Runtime Error

Solution code:
from sys import stdin, setrecursionlimit


a_list = 'abcdefghijklmnopqrstuvwxyz'


def base_convert(nl, ibase, obase):
    o = []
    while any(nl):
        c = 0
        for i in range(len(nl)):
            c = c * ibase + nl[i]
            nl[i], c = divmod(c, obase)
        o.append(c)
    o.reverse()
    return o


def main():
    input = stdin.buffer.readline
    n = int(input())
    if n == 1:
        print('a')
    else:
        n = [int(i) for i in list(str(n - 1))]
        idx = base_convert(n, 10, 26)
        for i in range(len(idx)):
            if i < len(idx) - 1:
                idx[i] -= 1
        if len(idx) > 1:
            j = idx.index(-1)
            idx = idx[j + 1:]
            idx = [-1] * j + idx
        print(*[a_list[i] for i in idx], sep='')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Runtime Error

Solution code:
dictio = {'1':'a', '2':'b', '3':'c','4':'d','5':'e','6':'f','7':'g','8':'h','9':'i',
'A':'j','B':'k','C':'l','D':'m','E':'n','F':'o','G':'p','H':'q','I':'r','J':'s','K':'t','L':'u','M':'v','N':'w','O':'x','p':'y','10':'z','0':'z'}

chars = "0123456789abcdefghijklmnopqrstuvwxyz" 
def to26(value):
  n = 26
  result = ''
  tmp = int(value)
  while tmp >= n:
      idx = tmp%n
      result = chars[idx] + result
      tmp = int(tmp / n)
  idx = tmp%n
  result = chars[idx] + result
  return result

num = int(input())

if num == 26:
  print('z')
  exit()
else:
  converted = to26(num).upper()
  result_strings =[]
  for i in converted:
    result_strings.append(dictio[i])
  
  print(''.join(result_strings))

Submission status: Runtime Error

Solution code:
from collections import deque
import math


def main():
    n = int(input())
    digits = deque()
    alpha = ord('a') - 1
    maxex = int(math.log(n-1, 26))
    ex = 1
    zflag = False
    for ex in range(1, maxex + 2):
        bb = pow(26, ex - 1)
        aa = bb * 26
        rem = n % aa // bb
        n -= bb * rem
        if rem == 0:
            if n == 0:
                break
            rem += 26
            n -= aa
        digits.appendleft(chr(alpha + rem))

    [print(d, end='') for d in digits]
    print()


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N=int(input())
strlist=[chr(ord('a') + i) for i in range(26)]
first=26
second=702
third=18278
forth=475254
if N<=first:
  ans1=N
  print(strlist[ans1-1])
elif first<N<=second:
  ans2, ans1 = divmod(N-first-1, first)
  print(strlist[ans2]+strlist[ans1])
elif second<N<=third:
  ans3, temp1 = divmod(N-second-1, second-first)
  if temp1+1<=first:
    ans1=temp1
    ans2=0
    print(strlist[ans3]+strlist[ans2]+strlist[ans1])
  elif first<=temp1<=second-first:
    ans2, ans1 = divmod(temp1, first)
    print(strlist[ans3]+strlist[ans2]+strlist[ans1])
elif third<N<=forth:
  ans4, temp1 = divmod(N-third-1, third-second)
  if temp1+1<=first:
    ans1=temp1
    ans2=0
    ans3=0
    print(strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
  elif first<=temp1<second-first:
    ans2, ans1 = divmod(temp1, first)
    ans3=0
    print(strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
  elif second-first<=temp1<=third-second:
    ans3, temp2 = divmod(temp1, second-first)
    if temp2+1<=first:
      ans1=temp2
      ans2=0
      print(strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
    elif first<=temp2<=second-first:
      ans2, ans1 = divmod(temp2, first)
      print(strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
elif forth<N:
  ans5, temp1 = divmod(N-forth-1, forth-third)
  if temp1+1<=first:
    ans1=temp1
    ans2=0
    ans3=0
    ans4=0
    print(strlist[ans5]+strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
  elif first<=temp1<second-first:
    ans2, ans1 = divmod(temp1, first)
    ans3=0
    ans4=0
    print(strlist[ans5]+strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
  elif second-first<=temp1<third-second:
    ans3, temp2 = divmod(temp1, second-first)
    if temp2+1<=first:
      ans1=temp2
      ans2=0
      ans4=0
      print(strlist[ans5]+strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
    elif first<=temp2<=second-first:
      ans2, ans1 = divmod(temp2, first)
      ans4=0
      print(strlist[ans5]+strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
  elif third-second<=temp1<=forth-third:
    ans4, temp2 = divmod(temp1, third-second)
    if temp2+1<=first:
      ans1=temp2
      ans2=0
      ans3=0
      print(strlist[ans5]+strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
    elif first<=temp2<second-first:
      ans2, ans1 = divmod(temp2, first)
      ans3=0
      print(strlist[ans5]+strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
    elif second-first<=temp2<=third-second:
      ans3, temp3 = divmod(temp2, second-first)
      if temp3+1<=first:
        ans1=temp3
        ans2=0
        print(strlist[ans5]+strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])
      elif first<=temp3<=second-first:
        ans2, ans1 = divmod(temp3, first)
        print(strlist[ans5]+strlist[ans4]+strlist[ans3]+strlist[ans2]+strlist[ans1])

Submission status: Runtime Error

Solution code:
n = int(input())
alplis = ['z','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']
num = 0
p = ""
for i in range(10000):
    num += 26**i
    if num > n:
        if i != 0:
            for x in range(i-1):
                i -= 1
                p = p + alplis[n//(26**(i))]
                n = n%(26**(i))
        break
print(p+alplis[n % 26])

Submission status: Runtime Error

Solution code:
import math

N = int(input())
i = 0
a,b = divmod(N, 26)
c = math.log(N, 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(A)
print("".join(A))

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:
n = int(input())
kugiri = [0,26,702,18278,475254,12356630,321272406,8353082582,217180147158,5646683826134]
ans = ""

for i in range(len(kugiri)):
    if n <= kugiri[i]:
        keta = i
        break
        
n -= kugiri[i-1]

for i in range(keta):
    moji = -(-n // 26**(keta-1))
    ans += chr(moji+96)
    n -= (moji-1) * 26**(keta-1)
    keta -= 1
    
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
n -= 1
l = []
flag = True
for i in range(13):
    if i > 0:
        n -= 1
    s = n // 26
    a = n % 26
    l.append(a)
    if s < 26:
        if s > 0:
            s -= 1
            flag = False
        l.append(s)
        break
    else:
        n = s
l.reverse()
for i in range(len(l)):
    if l[i] == 0:
        if flag:
            l[i] = ''
        else:
            l[i] = 'a'
    elif l[i] == 1:
        l[i] = 'b'
    elif l[i] == 2:
        l[i] = 'c'
    elif l[i] == 3:
        l[i] = 'd'
    elif l[i] == 4:
        l[i] = 'e'
    elif l[i] == 5:
        l[i] = 'f'
    elif l[i] == 6:
        l[i] = 'g'
    elif l[i] == 7:
        l[i] = 'h'
    elif l[i] == 8:
        l[i] = 'i'
    elif l[i] == 9:
        l[i] = 'j'
    elif l[i] == 10:
        l[i] = 'k'
    elif l[i] == 11:
        l[i] = 'l'
    elif l[i] == 12:
        l[i] = 'm'
    elif l[i] == 13:
        l[i] = 'n'
    elif l[i] == 14:
        l[i] = 'o'
    elif l[i] == 15:
        l[i] = 'p'
    elif l[i] == 16:
        l[i] = 'q'
    elif l[i] == 17:
        l[i] = 'r'
    elif l[i] == 18:
        l[i] = 's'
    elif l[i] == 19:
        l[i] = 't'
    elif l[i] == 20:
        l[i] = 'u'
    elif l[i] == 21:
        l[i] = 'v'
    elif l[i] == 22:
        l[i] = 'w'
    elif l[i] == 23:
        l[i] = 'x'
    elif l[i] == 24:
        l[i] = 'y'
    elif l[i] == 25:
        l[i] = 'z'
print(''.join(l))
        l[i] = 's'
    elif l[i] == 19:
        l[i] = 't'
    elif l[i] == 20:
        l[i] = 'u'
    elif l[i] == 21:
        l[i] = 'v'
    elif l[i] == 22:
        l[i] = 'w'
    elif l[i] == 23:
        l[i] = 'x'
    elif l[i] == 24:
        l[i] = 'y'
    elif l[i] == 25:
        l[i] = 'z'
print(''.join(l))

Submission status: Runtime Error

Solution code:
N=int(input())
lists = 'abcdefghijklmnopqrstuvwxyz'
stack=0
_ans=[]
for n in range(1,100000):
    pre_stack=stack
    stack+=26**n 
    if stack >= N:
        diff=N-pre_stack
        ans=['a']*n
        _stack=0
        next_n=N
        for u in range(n,0,-1):
            re=n-u
            temp1=next_n//26**(u-1)
            _ans.insert(0,temp1)
            ans[re]=temp1
            temp2=next_n%26**(u-1)
            ans[re]=temp2
            next_n=next_n%26**(u-1)
        break 

ans=[]
for x in _ans:
    ans.insert(0,lists[x-1])
res=''.join(ans)
print(res)

Submission status: Runtime Error

Solution code:
n = int(input())
ab = ['z','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']
op = ''
startCount = False
for i in [11,10,9,8,7,6,5,4,3,2,1,0]:
    if not startCount:
        upLim = 0
        for j in range(i+1):
            upLim += 26**j
    if n >= upLim and not startCount:
        startCount = True
    if startCount:
        op += ab[n//26**i]
        n -= (n//26**i)*26**i
print(op)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    alphabets = [None] + [chr(ord("a") + x) for x in range(26)]
    # 1~26:１桁
    # 27 ~ 702(26**2*"1"+26**1*"1"+ 0):2桁
    # 27 ~ 52番：aa ~ az(26+1~26)
    # 53 ~ 78番：ba ~ bz(26*"2"+"1~26")
    # 703 ~ 18278(26+26*26+26*26*26):３桁
    # 703 ~ 726: aaa ~ aaz(26**2*"1"+26*"1"+"1~26")

    #何桁か？
    cnt = 0
    m = n
    while m > 0:
        cnt += 1
        m -= 26 ** cnt
    #print(cnt)

    # 各桁がどの文字か？
    num = []
    for i in range(cnt):
        # 最初は、26で割り、次は
        y = n % (26 ** (i+1))
        if y == 0:
          y = 26
        #print("amari:", y, "nokori:", n)
        n -= y
        num += [y // (26**i)]

    #print(num)

    ans = ""
    for s in num[::-1]:
        ans += alphabets[s]
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N=input()
def num2alpha(num):
  if num<=26:
    return chr(64+num)
  elif num%26==0:
    return num2alpha(num/26-1)+chr(90)
  else:
    return num2alpha(num/26)+chr(64+num%26)
name=num2alpha(N)
print(name.lower())

Submission status: Runtime Error

Solution code:
N = int(input())
alpha = "abcdefghijklmnopqrstuvwxyz"
# print(len(alpha))

T = 26

t = 1
lst = [0] * 11
lst[0] = 0
for i in range(10):
    t *= 26
    lst[i+1] = lst[i] + t
lst = lst[::-1]
# print(lst)
# print(t)

n = N-1
ans = ""
for i in range(11):
    if i == 10:
        ans += alpha[n]
    elif n >= lst[i]:
        ans += alpha[n // t - 1]
        n %= t
    t //= 26
    # print(n, t, lst[i], ans)
print(ans)

Submission status: Runtime Error

Solution code:
abc = ['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']

ans = []
def rec(n):
    print(n,n%26,abc[n%26])
    #print(n)
    if n>=26:
        ans.append(abc[int(n%26)])
        return rec(int(n/26))
        #ans.append(abc[int(n%26)])
        #print(n%26)
    else:
       ans.append(abc[int(n)])
       #print(n%26)
N = int(input())
#rec(N)
#i=N
r=1
q=N
while q>0:

    r = q%27
    if q>26:
        ans.append(abc[r])
    else:
        ans.append(abc[r-1])
    q=int(q/27)
for i in range(len(ans)-1,-1,-1):
    print(ans[i],end="")