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: Accepted

Solution code:
import sys
# from collections import defaultdict, deque
import math

# import copy
# from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 998244353

def solve():
    n = getN()
    # n = 26* 26 * 26
    n -= 1
    ref = [chr(ord("a") + i) for i in range(26)]
    ans = []
    while(n >= 0):
        idx = (n) % 26
        ans.append(ref[idx])
        n = (n // 26) - 1

    ans.reverse()
    print("".join(ans))
def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

Solution code:
def solve(n):
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    s_list = []
    m = n
    while m > 0:
        m = m - 1
        s_list.append(alphabet[m % 26])
        m = m // 26
    return "".join(reversed(s_list))


def main():
    n = int(input())
    res = solve(n)
    print(res)


def test():
    assert solve(2) == "b"
    assert solve(27) == "aa"
    assert solve(123456789) == "jjddja"


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

Solution code:
N = int(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)
    
print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
N = int(input())
ans = []
while N!=0 :
    ans.append( chr( ( (N-1) %26)+ord('a') ))
    N = (N-1)//26
print("".join(ans[::-1]))

Submission status: Accepted

Solution code:
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)
n = int(input())
ans = num2alpha(n)
print(ans.lower())

Submission status: Accepted

Solution code:
import sys 
input = lambda:sys.stdin.readline().strip()
n = int(input())
n-=1
ans = ""
while n>=0:
    ans+=chr(ord('a')+n%26)
    n = n//26
    n-=1
print(ans[::-1])

Submission status: Accepted

Solution code:
n=int(input())
num=[]
ans=""
for i in range(1000):
    if n%26!=0:
        num.append(n%26)
        n=n//26
    else:
        num.append(26)
        n=n//26-1
    if n==0:
        break
for i in range(len(num)):
    num1=96+num[-1-i]
    ans+=chr(num1)
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    s = ''
    while N:
        N -= 1
        s += chr(ord('a') + N % 26)
        N //= 26
    return ''.join(s[::-1])

print(main())

Submission status: Accepted

Solution code:
n=int(input())
l=[]
while n>0:
  l.append(chr(97+(n-1)%26))
  n-=1
  n//=26
print(''.join(l[::-1]))

Submission status: Accepted

Solution code:
# Contest No.: ABC171
# Problem No.: C
# Solver:      JEMINI
# Date:        20200621

import sys
import heapq

def main():
    n = int(input())
    ans = ""
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    while n > 0:
        ans = alphabet[(n - 1) % 26] + ans
        n = (n - 1) // 26
    print(ans)
    return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# import numpy as np
sys.setrecursionlimit(int(pow(10,6)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

# @lru_cache(None)
def printString(n): 
  
    # To store result (Excel column name) 
    string = ["\0"] * 50
  
    # To store current index in str which is result 
    i = 0
  
    while n > 0: 
        # Find remainder 
        rem = n % 26
  
        # if remainder is 0, then a  
        # 'Z' must be there in output 
        if rem == 0: 
            string[i] = 'z'
            i += 1
            n = (n // 26) - 1
        else: 
            string[i] = chr((rem - 1) + ord('a')) 
            i += 1
            n = n // 26
    string[i] = '\0'
    ans=[]
    for ele in string:
        if ele.isalpha():
            ans.append(ele)
    string=ans
    # Reverse the string and print result 
    string = string[::-1] 
    print( "".join(string)) 
n=l()[0]
printString(n)

Submission status: Accepted

Solution code:
def examA():
    S = SI()
    if S in alphabet:
        ans = "a"
    else:
        ans = "A"
    print(ans)
    return

def examB():
    N, K = LI()
    P = LI()
    P.sort()
    ans = sum(P[:K])
    print(ans)
    return

def examC():
    N = I()
    ans = ""
    while(N>0):
        N -= 1
        ans += alphabet[N%26]
        N //= 26
        if N==0:
            break
    print(ans[::-1])
    return

def examD():
    N = I()
    A = LI()
    q = I()

    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

Solution code:
N = int(input())
ans = ''
nowN = N
while nowN != 0:
    nowN -= 1
    now = nowN % 26
    ans = chr(now + 97) + ans
    nowN //= 26
print(ans)

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n = int(input())
l = [chr(v) for v in range(ord("a"), ord("z")+1)]

ans = []
while n>0:
    n -= 1
    i,j = n//26, n%26
    ans.append(l[j])
    n = i
# ans.append(l[n])
print("".join(ans[::-1]))

Submission status: Accepted

Solution code:
from string import ascii_lowercase
n = int(input())
q = n
s = []
while q > 0:
    q -= 1
    q, r = divmod(q, 26)
    s = [ascii_lowercase[r]] + s
print(*s, sep='')

Submission status: Accepted

Solution code:
n = int(input())
n-=1

for l in range(1,15):
    if n >= 26 ** l:
        n -= 26 ** l
        continue

    ans = ""
    for i in range(l):
        d = n % 26
        ans += chr(d + ord('a'))
        n //= 26
    ans = ans[::-1]
    break

print(ans)

Submission status: Accepted

Solution code:
def main():
    from string import ascii_lowercase
    dic = {i+1: a for i, a in enumerate(ascii_lowercase)}
    rdic = {a: i+1 for i, a in enumerate(ascii_lowercase)}
    N = int(input())

    def dfs(s, N):
        if N <= 0:
            return s
        v = N % 26
        if v == 0:
            v = 26
        N -= v
        N //= 26
        S = dfs(s+dic[v], N)
        return S
    ans = dfs('', N)[::-1]
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    
    alpha = "abcdefghijklmnopqrstuvwxyz"

    ans = []
    while n!= 0:
        n-=1
        i = n%26
        ans.append(alpha[i])
        n//=26

    print("".join(ans[::-1]))
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():

    N = int(input())
    ans = ""
    p = 1
    while N > 0:
        N -= 1
        ans += chr(N % 26 + ord('a'))
        N -= N % 26
        N //= 26
    return ans[::-1]

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
from string import ascii_lowercase as abc
n = int(input())
a = {i + 1: s for i, s in enumerate(abc)}
ans = ''
while n >= 1:
    n, r = divmod(n, 26)
    if r == 0:
        r = 26
        n -= 1
    
    ans += a[r]
print(ans[::-1])

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

n = int(input())
ans = []
while n > 0:
    a = (n-1) % 26
    ans.append(chr(a + ord("a")))
    n = (n-1)//26

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    r = ''
    while N > 0:
        if N%26 == 0:
            r = 'z' + r
        else:
            r = chr(ord('a') + (N%26) - 1) + r
        N = (N-1)//26
    return r
print(main())

Submission status: Accepted

Solution code:
n = int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while n > 0:
    n -= 1
    ans = alpha[(n%26)] + ans
    n = n // 26
print(ans)

Submission status: Accepted

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

N = int(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)

print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
num = 26
answer = ''
while N:
    N -= 1
    remain = N%num
    answer += chr(remain+ord('a'))
    N //= num

print(answer[::-1])

Submission status: Accepted

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

    t = 1

    ans = ''
    while n > 0:
        p = ((n - 1) // t) % 26
        ans += chr(ord('a') + p)
        n -= t * (p+1)
        t *= 26

    ans = ans[::-1]

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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)
    
def main():
    N = int(input())
    ans = num2alpha(N).lower()
    print(ans)
main()

Submission status: Accepted

Solution code:
N = int(input())
res = []
ls = 'abcdefghijklmnopqrstuvwxyz'
while N>0:
    tmp = (N-1)%26
    N = (N-1)//26
    res.append(ls[tmp])
res = res[::-1]
print(''.join(res))

Submission status: Accepted

Solution code:
def printString(n):
    letters = "abcdefghijklmnopqrstuvwxyz"
    result = ""
    while n:
        result = letters[(n - 1) % 26] + result
        n = (n - 1) // 26
    return result
n = int(input())
print(printString(n))

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
ans = []

while N != 0:
    N -= 1
    p, r = divmod(N, 26)
    ans.append(ascii_lowercase[r])
    N = p

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

Submission status: Accepted

Solution code:
N = int(input())
k = 1
while 26**k <= N:
    N -= 26**k
    k += 1

def itoc(i):
    return chr(ord('a') + i)

N -= 1
ans = ''
for _ in range(k):
    N,i = divmod(N,26)
    ans += itoc(i)

if all(c=='z' for c in ans):
    print(ans[:-1])
else:
    print(ans[::-1])

Submission status: Accepted

Solution code:
# 数値→アルファベット
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)


N=int(input())
print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
N = int(input())

t = 1000000000000001

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)
    
    
    
print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
N = int(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)
print(num2alpha(N).lower())

Submission status: Accepted

Solution code:
n = int(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)


print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
n = int(input())
i = 1
while pow(26,i) < n:
    n -= pow(26,i)
    i += 1
ans = ''
n -= 1
for _ in range(i):
    ans += chr(ord('a') + n%26)
    n //= 26
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input()) - 1
A = [chr(i) for i in range(ord("a"),ord("z")+1)]

m = 26
s = 0
g = 1
while s+m <= n:
    s += m
    m *= 26
    g += 1

# print(g)
n -= s

# print("n",n)
ANS = []
for i in range(g):
    ANS.append(A[n%26])
    n//=26
print("".join(ANS[::-1]))

Submission status: Accepted

Solution code:
N = int(input())

t = []
while N > 0:
    N -= 1
    t.append(chr(N % 26 + ord('a')))
    N //= 26
t = t[::-1]
print(''.join(t))

Submission status: Accepted

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

N = int(input())

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

P = 26
t = 1
L = 1
while t + P <= N:
    t += P
    L += 1
    P *= 26

seq = N - t
ans = []
for l in range(L):
    ans.append(Alp[seq % 26])
    seq //= 26

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

Submission status: Accepted

Solution code:
n = int(input())
alp = "abcdefghijklmnopqrstuvwxyz"
name = ""
while n > 0:
    name += alp[n%26-1]
    n = (n-1)//26
print(name[::-1])

Submission status: Accepted

Solution code:
n = int(input())-1
if n == 0:
	print("a")
else:
	ans = ""
	while n >= 0:
		ans += chr(n%26 + 97)
		n //= 26
		n -= 1
	print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
N -= 1

alpha = "abcdefghijklmnopqrstuvwxyz"

a = 1
for i in range(1,10000):
    a *= 26
    if N < a:
        NN = N
        o = [0]*i
        for j in range(i):
            o[j] = NN % 26
            NN //= 26
        print(''.join([alpha[x] for x in o[::-1]]))
        exit()
    else:
        N -= a

Submission status: Accepted

Solution code:
N = int(input()) - 1
K = 26
j = 0
for i in range(1, 100):
    if N >= K ** i:
        N -= K ** i
        j = i
S = ""
for i in range(j + 1)[::-1]:
    k = N // (K ** i)
    N %= K ** i
    S += chr(97 + k)
print(S)

Submission status: Accepted

Solution code:
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')



def convertToTitle(num):
    capitals = [chr(x) for x in range(ord('a'), ord('z')+1)]
    result = []
    while num > 0:
        result.append(capitals[(num-1)%26])
        num = (num-1) // 26
    result.reverse()
    return ''.join(result)

n=ii()
print(convertToTitle(n))

Submission status: Accepted

Solution code:
n = int(input())

ans = []
while n:
    n -= 1
    q, r = divmod(n, 26)
    c = chr(ord("a") + r)
    ans.append(c)
    n = q

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

Submission status: Accepted

Solution code:
n = int(input())
s = ""
while n > 0:
  n -= 1
  s = chr(ord('a') + (n%26)) + s
  n //= 26
print(s)

Submission status: Accepted

Solution code:
n = int(input())
arr = []
while n != 0:
  arr.append(chr(ord("a") + (n-1) % 26))
  n = (n-1)//26
arr.reverse()
print("".join(arr))

Submission status: Accepted

Solution code:

n = int(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)

print(num2alpha(n).lower())

Submission status: Accepted

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

print(num2alpha(int(input())))

Submission status: Accepted

Solution code:
n = int(input())
alph = "zabcdefghijklmnopqrstuvwxy"


ans = ""
while n >= 1:
    div, mod = divmod(n, 26)
    ans += alph[mod]
    n = div
    if mod == 0:
        n -= 1
print(ans[::-1])

Submission status: Accepted

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[]
while n>0:
  n-=1
  A.append(n%26)
  n//=26
ans=""
for a in A:
  ans+=chr(97+a)
print(ans[::-1])

Submission status: Accepted

Solution code:
def colnum_string(n):
    string = ""
    while n > 0:
        n, remainder = divmod(n - 1, 26)
        string = chr(97 + remainder) + string
    return string

n = int(input())
print(colnum_string(n))

Submission status: Accepted

Solution code:
N = int(input())
name = ''
while N > 0:
    name += chr(ord('a') + (N - 1) % 26)
    N = (N - 1) // 26
print(name[::-1])

Submission status: Accepted

Solution code:
n = input() - 1
l = 1

while n >= 26 ** l:
    n -= 26 ** l
    l += 1

s = ''
for _ in xrange(l):
    s += chr(ord('a') + n % 26)
    n /= 26

print s[::-1]

Submission status: Accepted

Solution code:
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)

n = int(input())
print(num2alpha(n).lower())

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
i = 1
while(n):
    k = (n - 1) % 26
    ans += chr(ord('a') + k)
    n -= k
    n //= 26
ans = ans[::-1]
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import string


def generate_sequence(n):
    n -= 1
    def gen(result, x):
        if x < 0:
            return result
        else:
            d, m = divmod(x, 26)
            char = string.ascii_lowercase[m]
            return gen(char + result, d - 1)
    return gen("", n)


main = lambda: print(generate_sequence(int(input())))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())-1

l = 1
while N>=26**l:
  N -= 26**l
  l += 1

ans = ""
for i in range(l):
  ans += chr(ord("a")+N//26**(l-i-1)%26)
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni() - 1
l = 1

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

while True:
    if n < nus[l]:
        s = ""
        for i in range(l):
            s += chr(n%26+97)
            n //= 26
        print(s[::-1])
        break
    n -= nus[l]
    l += 1

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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)


n = int(input())
ans = num2alpha(n)
print(ans.lower())

Submission status: Accepted

Solution code:
N=int(input())
S=""
while N:
    N-=1
    S+=chr(ord("a")+N%26)
    N//=26
print(S[::-1])

Submission status: Accepted

Solution code:
N = int(input())
abc = list("abcdefghijklmnopqrstuvwxyz")

ans = ""

while N:
  N -= 1
  ans += abc[N % 26]
  N //= 26

print(ans[::-1])

Submission status: Accepted

Solution code:
n=int(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)
print( num2alpha(n).lower() )

Submission status: Accepted

Solution code:
def main():
    from string import ascii_lowercase

    N = int(input())

    ans = ''
    while N > 0:
        N -= 1
        N, r = divmod(N, 26)
        ans = ascii_lowercase[r] + ans

    print(ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Accepted

Solution code:
n = int(input())

s = "abcdefghijklmnopqrstuvwxyz"
ans = ''
while n > 0:
    n -= 1
    ans = s[n % 26] + ans
    n //= 26
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=""
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"]

while n>0:
    name=(n-1)%26
    ans=List[name]+ans
    n=(n-1-name)//26
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
alphabets = [chr(i) for i in range(ord('a'), ord('a') + 26)]

ans = ''
while N > 0:
    N -= 1
    ans += alphabets[N % 26]
    N = N // 26


print(ans[::-1])

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    n -= 1
    ans = []
    while n >= 0:
        ans.append(chr(ord("a")+n%26))
        n //= 26
        n -= 1
    print(*ans[::-1],sep="")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n = int(input())
s = ""
abc = "abcdefghijklmnopqrstuvwxyz"
while n:
    s = abc[(n - 1) % 26] + s
    n -= 1
    n //= 26

print(s)

Submission status: Accepted

Solution code:
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]

####

from collections import defaultdict as ddic

def solve(N):
    ans = []
    while True:
        N -= 1
        r = (N) % 26
        N //= 26
        ans.append(chr(r + ord('a')))

        if N == 0: break
    return "".join(ans[::-1])
print solve(rri())

Submission status: Runtime Error

Solution code:
import math

# one = 1000000000000001
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",26:"z"}

n=int(input())

if n==1:
    print("a")
    exit()

keta= math.floor(math.log(n-1,26))

ans=[]
for i in range(keta+1):

    if i==0:
        ans.append(dict[((n-1)//26**i)%26+1])
    else:
        ans.append(dict[((n-1)//26**i)%26])

for str in ans[::-1]:
    print(str,end="")

Submission status: Runtime Error

Solution code:
n = int(input())
l = []
while n:
    N -= 1
    l.append(chr(97+(n % 26)))
    n //= 26

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