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:
n = int(input())
n_temp = n
index_pochi = []
eiji_list = [chr(ord('a') + i) for i in range(26)]
while(True):
    eiji = eiji_list[(n_temp-1)%26]
    index_pochi = [eiji] + index_pochi
    if int((n_temp-1)/26) == 0:
        break
    n_temp = int((n_temp-1)/26)
print("".join(index_pochi))

Submission status: Accepted

Solution code:
import math
# from collections import Counter

# N = int(input()) # 1行, 単数
# arg = list(map(int, input().split())) # 1行, 配列
# D = Counter(arg) # 出現数カウント

# print('Yes')
# print('No')
# print()


alf = ['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']


N = int(input()) # 1行, 単数
M = N
ans = []

while True:
  ans.append(alf[M % 26])
  if M % 26 == 0:
    M = M - 1
  if M <= 26:
    break
  M = math.floor(M / 26)

ans.reverse()
print(''.join(ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
MAX = 12
ecg = ['']*MAX
#max: 724GO7J0OAD
for i in range(MAX):
  sho = N % 26
  if(sho == 0):
    sho = 26
  ecg[i] = chr(sho + 96)
  N //= 26
  if(sho == 26):
    N -= 1
  if(N == 0):
    break

print((''.join(ecg))[::-1])

Submission status: Accepted

Solution code:
n=int(input())
ans,flag="",False
while n > 0 or not flag:
  s = (n-1) % 26
  ans += chr(97+s)
  n -= s
  n //= 26
  flag=True
print(ans[::-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N = int(input())
character = list('abcdefghijklmnopqrstuvwxyz')
len_S = int(math.log(N*25+1, 26))
order = N - (26**(len_S)-1) / 25
ans = []
for i in range(len_S):
  c = int(order / 26 **(len_S-i-1))
  order -= 26 **(len_S-i-1) * c
  ans.append(character[c])
print("".join(ans))

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:
import math

N = int(input()) - 1
answer = ''
length = 0

for i in range(1, 12):
    num = 26 ** i # 1 ~ 11
    if N // num < 1:
        length = i
        break
    N -= num

for i in range(length):
    num = 26 ** (length - (i + 1))
    chara = chr(97 + N // num)
    answer += chara
    N -= num * (N // num)
print(answer)

Submission status: Accepted

Solution code:
n=int(input())
ans=''
i=1
c=0
while n>0:
	t=n%26
	if t==0:
		t=26
		c=1
	ans=chr(t+ord('a')-1)+ans
	n//=26
	n-=c
	c=0
	
print(ans)

Submission status: Accepted

Solution code:
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    count = 1
    k,l = 26,26
    while k < n:
        l *= 26
        k += l
        count += 1
    r = n - k + l -1
    s = ''
    for i in range(count):
        m = r%26
        r //= 26
        s += chr(ord('a')+ m)
    s = s[::-1]
    print(s)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
N = int(input())

#@njit
def solve(N,K,d):
    a = K*26
    if (N <= a):
        s = ""
        s = chr((N-1)%26+97) + s
        N = int((N-1)/26)
        while (N > 0):
            s = chr((N)%26+97) + s
            N = int((N)/26)
        return ("{:a>" +str(d)+"}").format(s)
    else:
        return solve(N-a,a,d+1)

print(solve(N,1,1))

Submission status: Accepted

Solution code:
n = int(input())
alp = [chr(i) for i in range(97, 97+26)]

ans = []
while n != 0:
  c = n % 26
  ans.insert(0, alp[c-1])
  n //= 26
  if c == 0:
    n -= 1
  
print("".join(ans))

Submission status: Accepted

Solution code:
n = int(input())
alphabet = list("abcdefghijklmnopqrstuvwxyz")
if n <= 26:
    print(alphabet[n-1])
else:
    ans = ""
    while(True):
        q, mod = divmod(n, 26)
        if mod == 0:
            q -= 1
            ans = "z" + ans
        else:
            ans = alphabet[mod-1] + ans
        if q < 1:
            break
        n = q
    print(ans)

Submission status: Accepted

Solution code:
def itoa(i):
    return chr(97 + i)


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

    ans = ""
    while N:
        i = (N - 1) % 26
        N = (N - 1) // 26
        ans += itoa(i)

    print(ans[::-1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
temp = 0
lowercase = 'abcdefghijklmnopqrstuvwxyz'
for i in range(1,13):
    temp += 26**i
    if n <= temp:
        break

diff = n - (temp - 26**i + 1)
ans = ''
for j in range(i):
    ans = lowercase[diff % 26] + ans
    diff = diff // 26
print(ans)

Submission status: Accepted

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

from collections import deque

n=I()
s=deque()
abc=[chr(i) for i in range(97,123)]
sub=26
while n>0:
    dg=n%26
    n//=26
    if dg==0:
            n-=1
    s.appendleft(abc[dg-1])
for i in s:
    print(i,end="")
print()

Submission status: Accepted

Solution code:
# C
n = int(input())
ans = []
while n > 26:
    # print(n)
    if n % 26 == 0:
        ans.append(26)
    else:
        ans.append(n % 26)
    if n <= 26:
        break
    n = (n - 1) // 26
ans.append(n)
ans.reverse()
# print(ans)
for i in ans:
    print(chr(i + 96), end='')

Submission status: Accepted

Solution code:
import math


def main():
    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"]
    n = int(input())

    i = 1
    r = ''
    while True:
        r = alphabets[math.ceil((n % (26 ** i)) / (26 ** (i - 1))) - 1] + r
        if n - 26**i > 0:
            n -= 26**i
            i += 1
        else:
            break

    print(r)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ans=""
while 0 < n:
  d=n%26
  if d==0:
    d=26
  ans=chr(int(d)+96) + ans
  n=(n-d)/26
  
print(ans)

Submission status: Accepted

Solution code:
import math
data = input()
num = int(data)
alp = ["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"]
list = []
num2 = num

while num2 > 26:
    a = num2 % 26
    if a == 0:
        list.append(26)
        num2 -= 26
    else:
        list.append(a)
    num2 = math.floor(num2/26)
list.append(num2)
list.reverse()
ans = "a"
for i in list:
    ans = ans + alp[i-1]
print(ans[1:])

Submission status: Accepted

Solution code:
n = int(input())
d, m = divmod(n, 26)
ans = ""
if m == 0:
    ans += 'z'
    d -= 1
else:
    ans += chr(m+96)

# ans = ""
while(not d==0):
    d, m = divmod(d, 26)
    if m == 0:
        ans += 'z'
        d -= 1
    else:
        ans += chr(m+96)

# ans += tmp
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
D = ['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']
a = 26
b = 1
while True:
    if N // (a + 1) == 0:
        break
    b += 1
    a += 26 ** b
A = [0] * b
for i in range(b):
    N -= 26 ** i
for i in range(b - 1, -1, -1):
    A[i] = N // (26 ** i)
    N -= A[i] * (26 ** i)
A = A[::-1]
for a in A:
    print(D[a], end='')
print('')

Submission status: Accepted

Solution code:
N = int(input())

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

print(''.join(reversed(buf)))

Submission status: Accepted

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

        ans = num2alpha(N)

        return ans.lower()

if __name__=="__main__":
        ans = main()
        print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

def Find(value):
    i = 0
    accSum = 0
    while True:
        current = 26 ** i
        accSum += current
        if value < accSum:
            accSum -= current
            return i, accSum
        i+=1


maxI, accu = Find(n)

import string
alp = [chr(ord('a') + i) for i in range(26)]
s = ''
cur = n
for b in range(maxI):
    currentI = maxI - b

    diff = cur - accu
    ind = diff // (26 ** (currentI-1))
    s += alp[ind]

    accu += (26 ** (currentI - 1)) * ind

print(s)

Submission status: Accepted

Solution code:
n = int(input())

ans = ""


while n > 0:
    x = n % 26
    if x == 0:
        ch = 'z'
        ans += ch
        n -= 1
        n //=26
        continue
    else:
        ch = chr(122-(26-x))
    ans += ch
    n //= 26
    

res = ''
for i in range(len(ans)-1, -1, -1):
    res+=ans[i]

print(res)

Submission status: Accepted

Solution code:
letters = 'abcdefghijklmnopqrstuvwxyz'

N = int(input())


def solve(n):
    result = ''
    while n > 0:
        letter_index = n % 26
        result = letters[letter_index-1] + result
        n //= 26
        if letter_index == 0:
            n -= 1

    print(result)


solve(N)

Submission status: Accepted

Solution code:
N = int(input())
ls = ['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']
word = ''
while N != 0:
    word = ls[N%26] + word
    N = (N-1) // 26
print(word)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


def itoa(n):
    if n == 0:
        return "z"
    else:
        return chr(n + 96)


n = I()

ans = []
mod = 1
while n // 26 != 0:
    n, mod = divmod(n, 26)
    if mod == 0:
        n -= 1
    ans.append(itoa(mod))

if n == 0 and mod == 0:
    print("".join(ans[::-1]))
else:
    print(str(itoa(n % 26)) + "".join(ans[::-1]))

Submission status: Accepted

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

a = int(input())

c = 1
keta = 0
while True:
    if a < c:
        break
    else:
        a -= c
        c *= 26
        keta += 1

def Base_10_to_n(X, n):
    if (X//n):
        return Base_10_to_n(X//n, n)+[X%n]
    return [X]

l = Base_10_to_n(a,26)
#print(l)

l2 = [chr(x + 65) for x in l]

st = "".join(l2).lower()

st = "a" * (keta-len(st)) + st

print(st)

Submission status: Accepted

Solution code:
n=int(input())
i=1
nn=n
while n>0:
    n-=26**i
    i+=1
k=i-1
n+=26**(i-1)
n-=1
s=[]
for j in range(k):
    k1=n//26**(k-j-1)
    n=n%26**(k-j-1)
    s.append(chr(k1+97))
for i in s:
    print(i,end='')

Submission status: Accepted

Solution code:
N=int(input())
def num2alpha(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(122)
    else:
        return num2alpha(num//26)+chr(96+num%26)
print(num2alpha(N))

Submission status: Accepted

Solution code:
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()


def main():
    n = int(input())
    ans = deque([])
    while n > 0:
        rem = n % 26
        if rem != 0:
            ans.appendleft(chr(96 + n % 26))
            n = (n - rem) // 26
        else:
            ans.appendleft("z")
            n = (n - 26) // 26

    print("".join(ans))



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
ans = ''
az = [chr(i) for i in range(97, 97+26)]
while N>0:
    r = N%26
    if r==0:
        ans+='z'
        N = (N-26)//26
    else:
        ans+=az[r-1]
        N = (N-r)//26
print(ans[::-1])

Submission status: Accepted

Solution code:
N = int(input())
N -= 1
ans = ""
base = ord("a")

while True:
    a = N % 26
    ans = chr(base+a) + ans
    if 0 <= N <= 25:
        break
    N = N // 26 - 1

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())

    ans = ''
    while N > 0:
        d, m = divmod(N, 26)
        if not m:
            d -= 1
            m = 26
        ans += chr(96 + m)
        N = d
    print(ans[::-1])


main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    n -= 1
    
    s = []
    for _ in range(15):
        # print(n)
        s.append(chr(ord('a')+(n%26)))
        n = int(n / 26)
        if n==0:
            break
        n -= 1
    s.reverse()
    print(''.join(s))

    pass

main()

Submission status: Accepted

Solution code:
n = int(input())
ans = []
while(True):
    if n <= 26:
        ans.append(chr(96+n))
        break
    n,a = divmod(n,26)
    if a == 0:
        ans.append('z')
        n -= 1
    else:
        ans.append(chr(96+a))
ans.reverse()
print(''.join(ans))

Submission status: Accepted

Solution code:

import sys
import math
import string

ALPHABET = string.ascii_lowercase
result = []

def alphabet_decimal(v):
    quotient = math.floor(v / len(ALPHABET))
    surplus = v % len(ALPHABET)
    quotient -= 1 if surplus == 0 else 0
    surplus = len(ALPHABET) if surplus == 0 else surplus
    result.append(surplus)
    if len(ALPHABET) < quotient:
        alphabet_decimal(quotient)
    elif len(ALPHABET) < v:
        result.append(quotient)
    return "".join([ALPHABET[i - 1] for i in reversed(result)])

print(alphabet_decimal(int(input())))

Submission status: Accepted

Solution code:
X = input()
x = int(X)

def trans(x):
    if x<=26:
        return chr(64+x)
    elif x%26==0:
        return trans(x//26-1)+chr(90)
    else:
        return trans(x//26)+chr(64+x%26)

ans = trans(x)
answer = ans.lower()
print(answer)

Submission status: Accepted

Solution code:
cnt=0
l=[]
for i in range(12):
    cnt+=26**i
    l.append(cnt)

n=int(input())
for i in range(12):
    if n>=l[i]:
        c=n-l[i]
        k=i+1

#print(c)

alp="abcdefghijklmnopqrstuvwxyz"
ans=""
for i in range(k):
    ans+=alp[c%26]
    c=c//26
    
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
alp = 'abcdefghijklmnopqrstuvwxyz'
ans = ''

while n > 0:
    m = n % 26
    ans += alp[m-1]
    n = n // 26
    if m == 0:
        n -= 1
print(ans[::-1])

Submission status: Accepted

Solution code:
A = ['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']
N = int(input())
ans = []
S = ''
while N != 0:
    ans.append(N%26)
    if N %26 == 0:
        N = N//26 - 1
    else:
        N = N//26
ans.reverse()
S = ''
for i in ans:
    S += A[i-1]
print(S)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np
import math
from collections import deque
from collections import defaultdict
from math import gcd


N = int(input())
M = 1000000000000001

k = 3
mini = 26*(1 - 26**(k-1)) / (1 - 26) + 1
maxi = mini + 26**k - 1

for k in range(100):
    mini = 26*(1 - 26**(k-1)) / (1 - 26) + 1
    maxi = mini + 26**k - 1

    if mini <= N <= maxi:
        keta = k
        nunkome = N - mini
        break

import string
alphabets = string.ascii_letters # a-z+A-Zをロード
characters = alphabets[:26]
def base_cvt(value, n=26):

    result = ''
    tmp = int(value)
    while tmp >= n:
        idx = tmp%n
        result =  characters[idx] + result
        tmp = int(tmp / n)
    idx = tmp%n
    result = characters[idx] + result
    return result

matsubi = base_cvt(nunkome)

num = k - len(matsubi)
print("a"*num + matsubi)

Submission status: Accepted

Solution code:
# ABC171 C 

from collections import deque

num2alpha = lambda c: chr(c+64)

n = int(input())
ans_dq = deque()

for i in range(1,12):
    _tmp = n%26
    if _tmp == 0:
        _tmp = 26
        n = n//26 - 1
    else:
        n = n//26
    ans_dq.appendleft(num2alpha(_tmp).lower())
    if n == 0:
        break
print(*ans_dq, sep="")

Submission status: Accepted

Solution code:
N=int(input())
k=1
ans=""
num2alpha = lambda c: chr(c+96)

#num2alpha(3) #==> C
while(1):
    if(N<=((((26**k)-1)*26)/25)):
        break
    else:
        k+=1
X=int(N-((((26**(k-1))-1)*26)/25))-1
#print(k)
#print(X)
for i in range(k):
    x= int(X // (26**(k-1-i)))
    #print(x)
    s=num2alpha(x+1)
    ans+=s
    X=X-x*(26**(k-1-i))
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
alpha=list('abcdefghijklmnopqrstuvwxyz')

def sin(l):
    sinsu=[]
    m=l
    while(m>0):
        if(m%26==0):
            m-=1
            sinsu.append((m%26))
        else:
            sinsu.append((m%26)-1)
        m//=26

    #print(sinsu)
    ans=[]
    for i in range(len(sinsu)):
        ans.append(alpha[sinsu[i]])
    ans=ans[::-1]
#    print(l,end=" ")
    print(''.join(ans))

sin(n)

Submission status: Accepted

Solution code:
N = int(input())

ans = str()
while N > 0:
    tmp = N % 26
    N //= 26
    if tmp == 0:
        tmp = 26
        N -= 1
    tmp += 96
    ans += chr(tmp)

print (ans[::-1])

Submission status: Accepted

Solution code:
n=int(input())
s=[]
while n!=0:
    x=n%26
    if x!=0:
        s.append(chr(96+x))
        n=n//26
    if x==0:
        s.append(chr(122))
        n=(n-1)//26
        
    
m=len(s)
ans=s[m-1]
if m==1:
    print(ans)
    exit()

for i in range(m-1):
    ans+=s[m-2-i]
print(ans)

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())
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())
final = ""
chars = "abcdefghijklmnopqrstuvwxyz"
dic = {i: chars[i] for i in range(0, 26)}
pw_26 = [26**i for i in range(13)]
cum = 0
digit = 0
for i in range(13):
    cum += pw_26[i]
    if N < cum:
        digit = i
        break
start_from = cum - pw_26[digit]
temp = N - start_from
digits = []
counter = 0
while counter < digit:
    res = temp % 26
    temp //= 26
    digits.append(res)
    counter += 1

for j in range(len(digits)):
    char = dic[digits[j]]
    final = char + final
print(final)

Submission status: Accepted

Solution code:
N=int(input())

def conv_alpha(N):
    if N<=26:
        return chr(96+N)
    elif N%26==0:
        return conv_alpha(N//26-1)+chr(122)
    else:
        return conv_alpha(N//26)+chr(96+N%26)
print(conv_alpha(N))

Submission status: Accepted

Solution code:
n=int(input())
m=n
A=['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']
for i in range(1,12):
  n-=26**i
  if n<=0:
    count=i
    break
n=m

for i in range(1,count):
  n-=26**i
n-=1

B=[]
for i in range(count-1,0,-1):
  B.append(n//(26**i))
  n-=(n//(26**i))*(26**i)
B.append(n)

C=[]
for i in B:
  C.append(A[i])
print(''.join(C))

Submission status: Accepted

Solution code:
from math import log, ceil
def main():
    n = int(input())
    s = [chr(i) for i in range(ord('a'), ord('z')+1)]
    # print(s)
    ans = ""
    m = ceil(log(25*n/26+1, 26))
    while(m>0 and n>0):
        m-=1
        if n%26==0:
            ans+=s[-1]
            n = n//26-1
        else:
            ans+=s[n%26-1]
            n = n//26
    print(ans[::-1])

    # for t in range(int(input())):
        # n = int(input())
        

# "Ashishgup" if he wins, and "FastestFinger"

# for #!/usr/bin/env python
# import os
# import sys
# from io import BytesIO, IOBase


# # region fastio

# BUFSIZE = 8192


# class FastIO(IOBase):
#     newlines = 0

#     def __init__(self, file):
#         self._fd = file.fileno()
#         self.buffer = BytesIO()
#         self.writable = "x" in file.mode or "r" not in file.mode
#         self.write = self.buffer.write if self.writable else None

#     def read(self):
#         while True:
#             b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
#             if not b:
#                 break
#             ptr = self.buffer.tell()
#             self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
#         self.newlines = 0
#         return self.buffer.read()

#     def readline(self):
#         while self.newlines == 0:
#             b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
#             self.newlines = b.count(b"\n") + (not b)
#             ptr = self.buffer.tell()
#             self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
#         self.newlines -= 1
#         return self.buffer.readline()

#     def flush(self):
#         if self.writable:
#             os.write(self._fd, self.buffer.getvalue())
#             self.buffer.truncate(0), self.buffer.seek(0)


# class IOWrapper(IOBase):
#     def __init__(self, file):
#         self.buffer = FastIO(file)
#         self.flush = self.buffer.flush
#         self.writable = self.buffer.writable
#         self.write = lambda s: self.buffer.write(s.encode("ascii"))
#         self.read = lambda: self.buffer.read().decode("ascii")
#         self.readline = lambda: self.buffer.readline().decode("ascii")


# sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
# input = lambda: sys.stdin.readline().rstrip("\r\n")

# # endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
ans = ""
while n > 0:
    ans += chr((n-1)%26 + ord("A"))
    n = (n-1) // 26

print(ans.lower()[::-1])

Submission status: Accepted

Solution code:
n = int(input())
ketasuu = 1
keta=[]
for i in range(1,100):
         if n - (26 ** i) > 0:
                  ketasuu += 1
                  n -= 26 ** i
n = n -1
for i in range(ketasuu):
         keta.append(n % 26)
         n = n // 26
keta = list(reversed(keta))
alphaketa=[]
for i in range(len(keta)):
         alphaketa.append(chr(keta[i] + 97))
ans = "".join(alphaketa)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
res = ""
char = dict(enumerate("zabcdefghijklmnopqrstuvwxy"))
#N -= 1
while N > 0:
    #res = chr(N % 26 + 0x61) + res
    res = char[N % 26] + res
    if N % 26 == 0:
        N = N // 26 - 1
    else:
        N //= 26

print(res)

Submission status: Accepted

Solution code:
alpha = 'abcdefghijklmnopqrstuvwxyz'
N= int(input())
len_alpha = 26
tmp = N
calc = tmp
cnt = 1

while tmp > 0:
    calc = tmp
    tmp -= (len_alpha **cnt)
    cnt += 1

res =''
for i in range(1, cnt - 1):
    tmp = int((calc-1)/(len_alpha**(cnt - i - 1)))
    calc -= tmp * len_alpha**(cnt - i - 1)
    res += alpha[tmp]

res += alpha[calc-1]
print(res)

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:
def number(num):
  if num<=26:
    return chr(96+num)
  elif num%26==0:
    return number(num//26-1)+chr(122)
  else:
    return number(num//26)+chr(96+num%26)

N = int(input())
print(number(N))

Submission status: Accepted

Solution code:
#n,k=map(int,input().split())
#l=list(map(int,input().split()))
n=int(input())
s=''
while(n>0):
  r=n%26
  n=n//26
  if r==0:
    s+='z'
    n-=1
  else:
    s+=chr(96+r)
print(s[::-1])

Submission status: Accepted

Solution code:
n = int(input())

name = ['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 = ''

stop = False

while not stop: 
  if (n-1) // 26 >= 1:
    ans += name[(n-1) % 26]
    n = (n-1) // 26
  else:
    ans += name[n-1]
    stop = True

r_ans = ans[::-1]

print(r_ans)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
n = 0
while n >= 0:
    if N > cnt:
        n += 1
        cnt += 26**n
    else:
        break
aToz = ['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']

number = N - (cnt - 26**n) - 1
ans = ""
for i in range(n):
    str = aToz[number % 26]
    ans += str
    number = number // 26
print(ans[::-1])

Submission status: Accepted

Solution code:
n=int(input())
al=[chr(97+i)for i in range(26)]
ans=""
while n>0:
    ans+=str(al[n%26-1])
    if n%26==0:
        n=n//26-1
    else:n//=26    
print(ans[::-1])

Submission status: Accepted

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

print(alp(N).lower())

Submission status: Accepted

Solution code:
import sys
#import copy
#import math
#import bisect
#import numpy as np
#import itertools
#import collections
#from collections import deque
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#import functools

sys.setrecursionlimit(10**6)
input = sys.stdin.readline
#read = sys.stdin.buffer.read

numbers = "0123456789"
characters = ['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 base_cvt(value:int, n=26):
    quot = value//n
    rest = value%n
    base = characters[rest]
    tmp = quot
    while quot >= 1:
        quot = (tmp-1)//n
        rest = (tmp-1)%n
        base = characters[rest] + base
        tmp = quot
    return base

def main():
    N = int(input())
    ans = base_cvt(N-1)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
name = []
while N > 0:
    name.append((N - 1) % 26)
    N -= 1
    N //= 26
name.reverse()
ans = "".join(chr(ord("a") + x) for x in name)
print(ans)

Submission status: Accepted

Solution code:
import string

N = int(input())

alphabet = string.ascii_lowercase

return_str = ''

while N > 0:
    digit = (N-1) % 26
    return_str += alphabet[digit]
    N = (N - digit) // 26

print(return_str[::-1])

Submission status: Accepted

Solution code:
import string

asc = string.ascii_lowercase
N = int(input())
name = ""
tmp = N - 1
div = 1
while div > 0:
  div = tmp // 26
  mod = tmp % 26
  tmp = div - 1
  name = asc[mod] + name

print(name)

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 = ""
flag = 1
al = ["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"]

while(n > 0):
    a = n % 26
    n = n //26
    for i in range(26):
        if a == i:
            ans += al[i]
    if a == 0:
        
        n = n - 1

ans = ans[::-1]

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = ["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"]
name = ""
s = True
while s:
  a = N % 26
  if a == 0:
    a = 25
  else:
    a -= 1
  name = A[a] + name
  N = (N - a) // 26
  if N == 0:
    s = False

print(name)

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()

al = [1]
nc = 0

def ntow(x):
    if x == 0:
        return 'z'
    v = chr(ord('a')+x-1)
    # print(x,v)
    return v

for i in range(1,15):
    nc += 26 ** i
    al.append(nc+1)
    if nc > 1000000000000001:
        break

# print(al)

for i in range(15):
    if n < al[i]:
        keta = i
        break

# print('keta',keta)
ans = ''

for i in range(keta):
    tmp = 26**(i+1)
    # print('tmp',tmp)
    nk = n%tmp
    if nk == 0:
        ans =  'z' + ans
        n -= tmp
    else:
        # print(nk//(26**i))
        ans =  ntow(nk//(26**i)) + ans
        n -= nk

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int1(input())
ans=[]
a=ord('a')
z=26
c=1
while N>=z:
    N-=z
    z*=26
    c+=1
while N:
    b=N%26
    ans.append(chr(b+a))
    if N<26:
        break
    N//=26
for _ in range(c-len(ans)):
    ans.append('a')
ans.reverse()
print(''.join(ans))