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())
alf = [chr(i) for i in range(97, 97+26)]
List = []
for i in range(100):
  if N > 0:
    N -= 1
    a = N % 26
    N = N // 26
    List.append(alf[a])
  else:
    break
    

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

Submission status: Accepted

Solution code:
n = int(input())

ans = []

while n > 0:
    if n%26 != 0:
        a = chr(n%26+96)
        ans.append(a)
        n = n//26
    else:
        ans.append('z')
        n = n//26-1

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

Submission status: Accepted

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
res = ''
while(N):
    N -= 1
    res += chr(ord('a') + N % 26)
    N //= 26
print(res[::-1])

Submission status: Accepted

Solution code:
def solve(n):
    string = []
    while n > 0:
        remainder = n % 26
        if remainder == 0:
            string.append('z')
            n = (n//26)-1
        else:
            a = chr((remainder-1)+ord('a'))
            string.append(a)
            n = n//26
    return ''.join(string[::-1])

if __name__ == '__main__':
    n = int(input())
    print(solve(n))

Submission status: Accepted

Solution code:
N = int(input())

ans = ''
while N:
    N -= 1
    ans = chr(ord('a') + N % 26) + ans
    N //= 26
print(ans)

Submission status: Accepted

Solution code:
import math

n = (int)(input())

#
remain = []
while n > 0:
    re = n % 26
    if re == 0:
        re = 26
    remain.append(re)
    n = math.floor(n / 26)
    if re == 26:
        n -= 1
remain.reverse()

#
ret = ""
for i in remain:
    ret += chr(i + 96)

print("{}".format(ret))

Submission status: Accepted

Solution code:
N = int(input())


def solve(x):
    if x == 0:
        return ""
    x -= 1
    return solve(x // 26) + chr(97 + x % 26)


print(solve(N))

Submission status: Accepted

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

Submission status: Accepted

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

Solution code:
def encode(x):
    return chr(x + 97)


def solve(N):
    ans = []
    while True:
        N -= 1
        q, r = divmod(N, 26)
        ans.append(r)
        if q == 0:
            break
        N //= 26
    return "".join(map(encode, ans[::-1]))


print(solve(int(input())))

Submission status: Accepted

Solution code:
def encode(x):
    return chr(x + 97)


def solve(N):
    N -= 1
    ans = []
    while True:
        q, r = divmod(N, 26)
        ans.append(r)
        if q == 0:
            break
        N //= 26
        N -= 1
    return "".join(map(encode, ans[::-1]))


print(solve(int(input())))

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())
chars="-abcdefghijklmnopqrstuvwxyz"

n_rem = n
res = ""

while True:
    x = n_rem % 26
    if x == 0:
        x = 26
    res += chars[x]
    n_rem -= x
    if n_rem == 0:
        break
    n_rem //=26

print(res[::-1])

Submission status: Accepted

Solution code:
N = int(input())
out = []
def Saiki(N):
  w = N // 26
  z = N % 26
  ca = 1
  if(z == 0):
    w -= 1
    z = 26
  ca += z - 1
  out.insert(0, chr(ca + 96))
  if(w == 0): return
  Saiki(w)
Saiki(N)
print(''.join(out))

Submission status: Accepted

Solution code:
N = int(input())
al = ["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"]

ls =[]

while N > 0:
  N -= 1
  a = (N%26)
  ls.append(al[a])
  N = N // 26

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

Submission status: Accepted

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

    orda = ord('a')
    ans = ''
    
    while N:
        N -= 1
        N, Nmod = divmod(N, 26)
        ans = chr(orda + Nmod) + ans

    print(ans)


if __name__ == '__main__':
	main()

exit()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 9)

asc2en = lambda x: chr(x + 97)
N = int(input())


def rec(N):
    if (N - 1) // 26:
        return rec((N - 1) // 26) + asc2en((N - 1) % 26)
    return asc2en((N - 1) % 26)


print(rec(N))

Submission status: Accepted

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

    aord = ord('a')
    ans = ''
    
    while N:
        N, Nmod = divmod(N, 26)
        if Nmod:
            ans = chr(aord + Nmod - 1) + ans
        else:
            ans = chr(aord + 25) + ans
            N -= 1

    print(ans)


if __name__ == '__main__':
	main()

exit()

Submission status: Accepted

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

N = int(input())
M = 26
digit = 0
N -= 1

for d in range(1, 12):
    if N < M ** d:
        digit = d - 1
        break
    N -= M ** d

name = ""

for i in range(digit + 1):
    name += chr(ord("a") + (N % M))
    N //= M

print(name[::-1])

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
from string import ascii_lowercase
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations, product
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

chs = ascii_lowercase


def main():
    from builtins import int, map

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

f = ''
for i in range(1, 100):
    if n <= 26**i:
        n -= 1    #1→26から0→25への変換
        for i in range(i):
            f += chr(ord('a') + n%26)
            n //= 26
        break
    else:
        n -= 26**i

print(f[::-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    a = int(input())
    ans = ''

    for i in range(1, 99):
        if a <= 26 ** i:
            a -= 1
            for j in range(i):
                ans += chr(ord('a') + a % 26)
                a //= 26
            break
        else:
            a -= 26 ** i
    print(ans[::-1])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#<C>(17+)
n = int(input())
t = []
while n > 0:
    n -= 1
    t.append(chr(n % 26 + ord("a")))
    n //= 26
print("".join(t[::-1]))

Submission status: Accepted

Solution code:
n=int(input())
ans=""
for l in range(1,15):
  if n<=26**l:
    n-=1
    for j in range(l):
      ans+=chr(ord('a')+n%26)
      n//=26
    break
  else:
    n-=26**l
    
print(ans[::-1])

Submission status: Accepted

Solution code:
N=int(input())
ans=''
alf='abcdefghijklmnopqrstuvwxyz'

#26進数
while 1:
  N-=1
  l = N%26
  N = N//26
  ans+=alf[l]
  if N==0:
    break
print(ans[::-1])

Submission status: Accepted

Solution code:
num=[26**i for i in range(12)]
n=int(input())
s_num=[]
sss=0
e=0
for i in num:
    sss+=i
    if sss>n:
        break
    s_num.append(sss)
num=num[:len(s_num)][::-1]
n-=s_num[-1]

xxx=[]
ans=""
for i in num:
    x=n//i
    n-=x*i
    xxx.append(x+1)
    ans+=chr(ord('a')+x)
  
#print(xxx)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
temp = 'abcdefghijklmnopqrstuvwxyz'
t = 26
k = 1
while N > t:
    k += 1
    N -= t
    t *= 26
    
M = []
N -= 1
for n in range(k-1, -1, -1):
    d = N // (26 ** n)
    M.append(d)
    N -= (26 ** n) * d

print(''.join([temp[v]  for v in M]))

Submission status: Accepted

Solution code:
N = int(input())
ans=""
for i in range(1,15):
    if N<=26**i:
        N=N-1
        for j in range(i):
            # print(N)
            ans=ans+(chr(N%26+ord("a")))
            N=int(N/26)
        break
    else:
        N=N-26**i
print(ans[::-1])

Submission status: Accepted

Solution code:
def main():

    n = int(input())
    alph = 'abcdefghijklmnopqrstuvwxyz'
    ans = ''
    while n > 0:
        n -= 1
        rem = n % 26
        ans += alph[rem]
        n //= 26

    ans = ans[::-1] # 文字列の反転
    print(f'{ans}')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
alpha = list('abcdefghijklmnopqrstuvwxyz')
ans = ""
while N>0:
    N -= 1
    d = N%26
    ans += alpha[d]
    N //= 26
ans = list(reversed(ans))
ans = "".join(ans)
print(ans)

Submission status: Accepted

Solution code:
import sys


def log(s):
    # print("| " + str(s), file=sys.stderr)
    pass


def output(x):
    print(x, flush=True)


def input_ints():
    return list(map(int, input().split()))


def f(n, b, d):
    digits = []
    for _ in range(d):
        digits.append(n % b)
        n //= b
    return reversed(digits)


def main():
    n = int(input()) - 1

    b = 0
    i = 1
    while n >= b + 26**i:
        b += 26**i
        i += 1

    print("".join([chr(k+97) for k in f(n - b, 26, i)]))


main()

Submission status: Accepted

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

n = int(input())
s = []
while n:
    n -= 1
    s.append(chr(n % 26 + ord('a')))
    n //= 26
print(''.join(s[::-1]))

Submission status: Accepted

Solution code:
alfa=['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())
ans=''
while n>0:
    ans+=alfa[n%26]
    n=n-1
    n=n//26

print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
x = 0
l = 0
while x < n:
    l += 1
    x += 26**l
for i in range(1,l):
    n -= 26**i
n -= 1
ans = ""
while len(ans) < l:
    ans += chr(ord("a")+n%26)
    n //= 26
print(ans[::-1])

Submission status: Accepted

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

    chars = 'zabcdefghijklmnopqrstuvwxy'

    st = ''
    while True:
        a = n % 26
        st += chars[a]
        n = n // 26
        if n == 0 or (a == 0 and n == 1):
            break
        elif a == 0:
            n -= 1


    res = ''.join(list(reversed(st)))
    print(res)


main()

Submission status: Accepted

Solution code:
N = int(input())
Min = 1
Max = 26
Count = 0
Flag = True
while Flag:
    Count += 1
    if Min<=N<=Max:
        Disp = ['']*Count
        Flag = False
        Num = N-Min
        for T in range(1,Count+1):
            Disp[-T] = chr(97+Num%26)
            Num = Num//26
    else:
        Min = Max+1
        Max += pow(26,Count+1)
print(''.join(Disp))

Submission status: Accepted

Solution code:
alphabets = "abcdefghijklmnopqrstuvwxyz"


n = int(input())

A = []
while True:
    A.append(n % 26)
    n //= 26
    if n == 0:
        break

for i in range(len(A) - 1):
    if A[i] <= 0:
        A[i] += 26; A[i + 1] -= 1

ANS = []
for a in A[::-1]:
    if a == 0:
        continue
    ANS.append(alphabets[a - 1])

print("".join(ANS))

Submission status: Accepted

Solution code:
#!python3

# input
N = int(input())

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


def main():
    x = N
    ans = ""
    while x > 0:
        x -= 1
        ans += alpha[x % 26]
        x //= 26
    print(ans[::-1])
        

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
N=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"]
t=1
for i in range(1,20):
    if n>26**i:
        n=n-26**i
        t+=1
p=[0]*t
s=0
A=""
for i in range(1,t+1):
    s=N%26
    if s == 0:
        s = 26
    N=(N-s)//26
    p[t-i]=s
for i in range(t):
    A+=(a[p[i]-1])
print(A)

Submission status: Accepted

Solution code:
 
# from math import factorial as fac
from collections import defaultdict
# from copy import deepcopy
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
# print(f.readline())
sys.setrecursionlimit(10**2)

	
def print_case_iterable(case_num, iterable):
	print("Case #{}: {}".format(case_num," ".join(map(str,iterable))))

def print_case_number(case_num, iterable):
	print("Case #{}: {}".format(case_num,iterable))

def print_iterable(A):
	print (' '.join(A))

def read_int():
	return int(f.readline().strip())
def read_int_array():
	return [int(x) for x in f.readline().strip().split(" ")]
def rns():
	a =  [x for x in f.readline().split(" ")]
	return int(a[0]), a[1].strip()
def read_string():
	return list(f.readline().strip())
def ri():
	return int(f.readline().strip())
def ria():
	return [int(x) for x in f.readline().strip().split(" ")]
def rns():
	a =  [x for x in f.readline().split(" ")]
	return int(a[0]), a[1].strip()
def rs():
	return list(f.readline().strip())
def bi(x):
	return bin(x)[2:]





from collections import deque
import math
# NUMBER = 10**9 + 7
NUMBER = 998244353
def factorial(n) : 
	M = NUMBER
	f = 1
  
	for i in range(1, n + 1):  
		f = (f * i) % M # Now f never can  
						# exceed 10^9+7  
	return f
def mult(a,b):
	return (a * b) % NUMBER

def minus(a , b):
	return (a - b) % NUMBER

def plus(a , b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		g, y, x = egcd(b % a, a)
		return (g, x - (b // a) * y, y)

def modinv(a):
	m = NUMBER
	g, x, y = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m
def choose(n,k):
	if n < k:
		assert false
	return  mult(factorial(n), modinv(mult(factorial(k),factorial(n-k))))
from collections import deque, defaultdict 
import heapq


from types import GeneratorType
def bootstrap(f, stack=[]):
	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to

	return wrappedfunc


def dfs(g, timeIn, timeOut,depths,parents): 
	# assign In-time to node u 
	cnt = 0
	# node, neig_i, parent, depth
	stack = [[1,0,0,0]]
	while stack:
		v,neig_i,parent,depth = stack[-1]
		parents[v] = parent
		depths[v] = depth
		# print (v)
		if neig_i == 0:
			timeIn[v] = cnt    
			cnt+=1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i+=1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u,0,v,depth+1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
  
def isAncestor(u: int, v: int, timeIn: list, timeOut: list) -> str: 
	return timeIn[u] <= timeIn[v] and timeOut[v] <= timeOut[u] 

cnt = 0
@bootstrap
def dfs(v,adj,timeIn, timeOut,depths,parents,parent=0,depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt+=1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u,adj,timeIn,timeOut,depths,parents,v,depth+1)
	timeOut[v] = cnt
	cnt+=1
	yield 


def solution(n):
	# n = 8*26**3 + 3*26**2 + 3
	res = []
	# n = n-1
	while n > 0:
		n = n-1
		res.append(chr(ord('a')+n%26))
		n//=26
	# res.append(chr(ord('a')+(n)%26))
	return ''.join(reversed(res))


	
def main():
	T = 1
	# T = ri()
	for i in range(T):
		# s = rs()
		n = ri()
		# n,k = ria()
		# a=ria()

		x = solution(n)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			print >>output,str(x)# "Case #"+str(i+1)+':',
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()

if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
#example usage:
#    for l in res:
#       print >>output, str(len(l)) + ' ' +  ' '.join(l)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
n = int(input())

ans = str()
while n != 0:
    n -= 1
    ans += chr(ord('a') + n % 26)
    n //= 26

print(ans[::-1])

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    n -= 1
    res = ''
    while n >= 0:
        n, m = divmod(n, 26)
        res += chr(97 + m)
        n -= 1

    print(res[::-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
########関数部分##############
def Base_10_to_n(X, n):
    X -= 1
    if (int(X/n)):
            return Base_10_to_n((X)//n, n) + str(X%n) + " "
    return str(X%n) + " "
############################

def nanketa(X):
    n = 1
    a = 0
    while X > (26 ** n) + a:
        a += 26 ** n
        n += 1
    return n


#####関数をつかってみる．#####
######今回は二進数に変換######
x10 = int(input())
x2 = Base_10_to_n(x10, 26)
##print(x2)
ans = ""
a = ""
cnt = 0
x2 = list(x2.split(" "))[:-1]
x2 = list(map(int, x2))
#if x2[-1] == 25:
    #x2[-1] = -1
#x2[-1] += 1
##print(x2)
for x in x2:
    ans += chr(x + 97)

print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)

N = ini()


def solve():
    k = 26
    a = k
    p = k
    l = 1
    while a < N:
        p *= 26
        a += p
        l += 1
    x = N - (a - p) - 1
    name = [None] * l
    for i in range(l):
        c = x % 26
        name[i] = chr(ord("a") + c)
        x //= 26
    return "".join(reversed(name))


print(solve())

Submission status: Accepted

Solution code:
name = []
N = int(input())

while  N  > 0:
    N, mod = divmod((N-1), 26)
    name.insert(0,chr(97+mod))
name=''.join(name)
print(name)

Submission status: Accepted

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

n = 1
s = 26
for i in range(1,12):
    if N <= s:
        n = i
        break
    else:
        s += 26**(i+1)
        
s = 0
for i in range(1,n):
    s += 26**i
    
N = N - s - 1
if N == 0:
    Ans = ""
    for _ in range(n):
        Ans += "a"
else:
    L = [0 for _ in range(n)]
    i = 1
    while N > 0:
        L[-i] = N%26
        N = N//26
        i +=1
    
    Ans = ""
    for x in L:
        Ans += alphabet[x]
print(Ans)

Submission status: Accepted

Solution code:
def base10to(base, target, conv_list):
    if target <= base:
        conv_list.insert(0, target)
        return conv_list
    elif target % base == 0:
        conv_list.insert(0, base)
        return base10to(base, target // base - 1, conv_list)
    else:
        conv_list.insert(0, target % base)
        return base10to(base, target // base, conv_list)


def ret_alpha(target):
    return chr(96 + target)


def main():
    num = int(input())
    base = 26
    result_list = list()
    result_list = base10to(base, num, result_list)

    result = ''
    for i in result_list:
        result = result + ret_alpha(i)
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
alph = 'abcdefghijklmnopqrstuvwxyz'
def acc_seq(i):
  return 26 * (pow(26, i) - 1) // 25

def name_dog(digit, at, name):
  if digit ==1:
    return name + alph[at]
  else:
    group = at // pow(26, digit - 1)
    at -= pow(26, digit - 1) * group
    name += alph[group]
    return name_dog(digit-1, at, name)

n = int(input())
digit = 1
while(n > acc_seq(digit)):
  digit += 1

at = abs(n - acc_seq(digit - 1) - 1)
print(name_dog(digit, at, ''))

Submission status: Accepted

Solution code:
from collections import deque

def to_char(n):
    base = ord('a')
    return chr(base + n)

def main():
    N = int(input())
    q = deque([])
    # print(q)
    while N > 0:
        N -= 1
        v = N % 26
        q.appendleft(v)
        N //= 26

    # print(q)
    print(''.join(map(to_char, q)))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
        break
    else:
        N -= 26 ** i

print(ans[::-1])

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n:
    return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
print(*[AZ[x] for x in base_10_to_n_without_0(N, 26)],sep="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p = [pow(26, i) for i in range(17)]
num = [0 for i in range(17)]
for i in range(17):
  if i == 0:
    continue
  if i == 1:
    num[i] = 26
  else:
    num[i] = num[i-1] + p[i]
n = int(input())
ans = ''
l = 0
while n > num[l]:
  l += 1
x = n - num[l-1] - 1
for _ in range(l):
  c = chr(ord("a") + x % 26)
  ans = c + ans
  x //= 26
print(ans)

Submission status: Accepted

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

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
ans = ""

while N > 0:
    N -= 1
    ans = chr(97 + N % 26) + ans
    N //= 26

print(ans)

Submission status: Accepted

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

d = 26
for i in range(1,15):
    if N >= d:
        N -= d
        d *= 26
    else:
        d //= 26
        ans = ""
        # for j in range(i):
        #     ans += chr(N // d + ord("a"))
        #     N %= d
        #     d //= 26

        for j in range(i):
            ans += chr(N % 26 + ord("a"))
            N //= 26
        break

print(ans[::-1])

Submission status: Accepted

Solution code:

#=input()
n=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

def f(x):
    return chr(x+96)

ans = ""
while n >= 26:
    if n % 26 == 0:
        ans += 'z'
        n //= 26
        n -= 1
    else:
        ans += f(n % 26)
        n //= 26
if n != 0:
    ans += f(n)
print(ans[::-1])

Submission status: Accepted

Solution code:
n = int(input())
ans = ''
for i in range(1,99):
    if(n <= 26**i):
        n-=1
        for j in range(i):
            ans += chr(ord('a') + n%26)
            n//=26
        break
    else:
        n-= 26**i
print(ans[::-1])

Submission status: Accepted

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

d = 26
for i in range(1,15):
    if N >= d:
        N -= d
        d *= 26
    else:
        d //= 26
        ans = ""
        for j in range(i):
            ans += chr(N // d + ord("a"))
            N %= d
            d //= 26
        break

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
import math
N = int(input())
lennum = np.array([26**i for i in range(1,13)])
sumnum = np.array([sum(lennum[:i]) for i in range(12)])
lennum = np.hstack((1, lennum))
lennum,sumnum

dig = min(np.where(sumnum >= N)[0])
n = N - sumnum[dig - 1]
n, dig
ret =''
tmp = n
for i in range(dig)[::-1]:
    dig_i = math.ceil(tmp/lennum[i])
    ret += chr(97 + dig_i - 1)
    tmp = tmp - lennum[i]*(dig_i - 1)
print(ret)

Submission status: Accepted

Solution code:
n=int(input())
ans=""
while n>0:
    n-=1
    ans+=chr(ord('a')+n%26)
    n//=26
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 = ''
while n:
  n -= 1
  a = d[n % 26] + a
  n //= 26
print(a)

Submission status: Accepted

Solution code:
N = int(input())
L =[' ','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']
res = []
q=N
while(q>0):
    r = q % 26
    q = q //26
    if(r==0):
        res.append(L[26])
        q -= 1
    else:
        res.append(L[r])
for i in range(len(res)-1,-1,-1):
    print(res[i],end='',sep='')

Submission status: Accepted

Solution code:
n = int(input()) - 1
i = 1
s = 26

while n >= s:
    n -= s
    s *= 26
    i += 1

lst = []
for j in range(i):
    lst.append(n % 26)
    n //= 26

for j in lst[::-1]:
    print(chr(j + ord('a')), end='')

Submission status: Accepted

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

def solve(N: int):
    ans = ""
    while N > 0:
        N -= 1
        ans += chr(ord("a") + N % 26)
        N //= 26
    print(ans[::-1])
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
import math

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

tonum = lambda c: ord(c) - 97
tochr = lambda num: chr(num + 97)

def to26(n):
	ans = deque()
	while n:
		n -= 1
		n, dig = divmod(n, 26)
		ans.appendleft(dig)
	return ans

def main():
	n = int(rl())
	ans = [tochr(x) for x in to26(n)]
	print("".join(x for x in ans))
	stdout.close()

if __name__ == "__main__":
	main()

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())
ans=''
while N>0:
  N-=1
  ans+=chr(ord('a')+N%26)
  N//=26
print(ans[::-1])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000)

def group(num):
    return sum([26**i for i in range(num)])

N = int(input())

group_num = 1
while group(group_num + 1) <= N:
    group_num += 1

kth_place = N - (group(group_num) - 1)
kth_place -= 1
ans = []
for i in range(group_num):
    ans.append(chr(ord('a') + (kth_place % 26)))
    kth_place //= 26
    if not kth_place > 0:
        break

if len(ans) < group_num:
    ans.extend(['a' for i in range(group_num - len(ans))])

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