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
import numpy as np
from heapq import heappush, heappop 
from bisect import bisect_left as bi_l, bisect_right as bi_r
from collections import deque, Counter, defaultdict
from itertools import combinations, product
inf = float('inf')
MOD = 10**9+7
# MOD = 998244353


class NumberTheory():
  def __init__(self, n=2*10**6, numpy=True):
    self.n = n
    self.np_flg = numpy 
    self.is_prime_number, self.prime_numbers = self.sieve_of_eratosthenes(n)
  
  def sieve_of_eratosthenes(self, n):
    if self.np_flg:
      sieve = np.ones(n+1, dtype=np.int64); sieve[:2] = 0
      for i in range(2, int(n**.5)+1):
        if sieve[i]: sieve[i*2::i] = 0
      prime_numbers = np.flatnonzero(sieve)
    else:
      sieve = [1] * (n+1); sieve[0] = sieve[1] = 0
      for i in range(2, int(n**.5)+1):
        if not sieve[i]: continue
        for j in range(i*2, n+1, i): sieve[j] = 0
      prime_numbers = [i for i in range(2, n+1) if sieve[i]]
    return sieve, prime_numbers 

  def prime_factorize(self, n):
    res = dict()
    if n < 2: return res
    border = int(n**.5)
    for p in self.prime_numbers:
      if p > border: break
      while n % p == 0: res[p] = res.get(p, 0)+1; n //= p
      if n == 1: return res
    res[n] = 1; return res

  def prime_factorize_factorial(self, n):
    res = dict()
    for i in range(2, n+1):
      for p, c in self.prime_factorize(i).items(): res[p] = res.get(p, 0)+c
    return res
  
  @staticmethod
  def gcd(a, b): return gcd(b, a%b) if b else abs(a)

  @staticmethod
  def lcm(a, b): return abs(a // gcd(a, b) * b)

  @staticmethod
  def find_divisors(n):
    divisors = []
    for i in range(1, int(n**.5)+1):
      if n%i: continue
      divisors.append(i)
      j = n // i
      if j != i: divisors.append(j)
    return divisors
  
  @staticmethod
  def base_convert(n, b):
    if not n: return [0]
    res = []
    while n:
      n, r = divmod(n, b)
      if r < 0: n += 1; r -= b
      res.append(r)
    return res


class UnionFind():
  def __init__(self, n=10**6):
    self.root = list(range(n))
    self.height = [0] * n 
    self.size = [1] * n 
  
  def find_root(self, u):
    if self.root[u] == u: return u
    self.root[u] = self.find_root(self.root[u])
    return self.root[u]
  
  def unite(self, u, v):
    ru = self.find_root(u)
    rv = self.find_root(v)
    if ru == rv: return 
    hu = self.height[ru]
    hv = self.height[rv]
    if hu >= hv:
      self.root[rv] = ru 
      self.size[ru] += self.size[rv]
      self.height[ru] = max(hu, hv+1)
    else:
      self.root[ru] = rv 
      self.size[rv] += self.size[ru]


class Combinatorics():
  def __init__(self, N=10**9, n=10**6, mod=10**9+7, numpy=True):
    self.mod = mod
    self.nCr = dict()
    self.np_flg=numpy
    self.make_mod_tables(N, n)

  sys.setrecursionlimit(10**6)
  def choose(self, n, r, mod=None): # no mod, or mod ≠ prime
    if r > n or r < 0: return 0
    if r == 0: return 1
    if (n, r) in self.nCr: return self.nCr[(n, r)]
    if not mod:
      self.nCr[(n, r)] = (self.choose(n-1, r) + self.choose(n-1, r-1))
    else:
      self.nCr[(n, r)] = (self.choose(n-1, r, mod) + self.choose(n-1, r-1, mod)) % mod
    return self.nCr[(n,r)]
  
  def cumprod(self, a):
    p = self.mod
    l = len(a); sql = int(np.sqrt(l)+1)
    a = np.resize(a, sql**2).reshape(sql, sql)
    for i in range(sql-1): a[:, i+1] *= a[:, i]; a[:, i+1] %= p
    for i in range(sql-1): a[i+1] *= a[i, -1]; a[i+1] %= p
    return np.ravel(a)[:l]

  def make_mod_tables(self, N, n):
    p = self.mod
    if self.np_flg:
      fac = np.arange(n+1); fac[0] = 1; fac = self.cumprod(fac)
      ifac = np.arange(n+1, 0, -1); ifac[0] = pow(int(fac[-1]), p-2, p)
      ifac = self.cumprod(ifac)[n::-1]
      n_choose = np.arange(N+1, N-n, -1); n_choose[0] = 1;
      n_choose[1:] = self.cumprod(n_choose[1:])*ifac[1:n+1]%p
    else:
      fac = [None]*(n+1); fac[0] = 1
      for i in range(n): fac[i+1] = fac[i]*(i+1)%p
      ifac = [None]*(n+1); ifac[n] = pow(fac[n], p-2, p)
      for i in range(n, 0, -1): ifac[i-1] = ifac[i]*i%p
      n_choose = [None] * (n+1); n_choose[0] = 1
      for i in range(n): n_choose[i+1] = n_choose[i]*(N-i)%p
      for i in range(n+1): n_choose[i] = n_choose[i]*ifac[i]%p
    self.fac, self.ifac, self.mod_n_choose = fac, ifac, n_choose


def z_algorithm(s):
  n = len(s)
  a = [0] * n; a[0] = n
  l = r = -1
  for i in range(1, n):
    if r >= i: a[i] = min(a[i-l], r-i)
    while i + a[i] < n and s[i+a[i]] == s[a[i]]: a[i] += 1
    if i+a[i] >= r: l, r = i, i+a[i]
  return a


class ABC001():
  def A():
    h1, h2 = map(int, sys.stdin.read().split())
    print(h1-h2)

  def B(): pass
  def C(): pass 
  def D(): pass 


class ABC002():
  def A():
    x, y = map(int, sys.stdin.readline().split())
    print(max(x, y))

  def B():
    vowels = set('aeiou')
    s = sys.stdin.readline().rstrip() 
    t = ''
    for c in s:
      if c in vowels: continue 
      t += c 
    print(t)

  def C():
    *coords, = map(int, sys.stdin.readline().split())
    def triangle_area(x0, y0, x1, y1, x2, y2):
      x1 -= x0; x2 -= x0; y1 -= y0; y2 -= y0;
      return abs(x1*y2 - x2*y1) / 2
    print(triangle_area(*coords))

  def D():
    n, m = map(int, sys.stdin.readline().split())
    edges = set()
    for _ in range(m):
      x, y = map(int, sys.stdin.readline().split())
      x -= 1; y -= 1
      edges.add((x, y))
    cand = []
    for i in range(1, 1<<n):
      s = [j for j in range(n) if i>>j & 1]
      for x, y in combinations(s, 2):
        if (x, y) not in edges: break
      else:
        cand.append(len(s))
    print(max(cand))


class ABC003():
  def A():
    n = int(sys.stdin.readline().rstrip())
    print((n+1)*5000)

  def B():
    atcoder = set('atcoder')
    s, t = sys.stdin.read().split()
    for i in range(len(s)):
      if s[i] == t[i]: continue
      if s[i] == '@' and t[i] in atcoder: continue 
      if t[i] == '@' and s[i] in atcoder: continue
      print('You will lose')
      return 
    print('You can win')

  def C():
    n, k, *r = map(int, sys.stdin.read().split())
    res = 0
    for x in sorted(r)[-k:]:
      res = (res+x) / 2
    print(res)

  def D(): pass 


class ABC004():
  def A():
    print(int(sys.stdin.readline().rstrip())*2)

  def B():
    c = [sys.stdin.readline().rstrip() for _ in range(4)]
    for l in c[::-1]:
      print(l[::-1])

  def C():
    n = int(sys.stdin.readline().rstrip())
    n %= 30
    res = list(range(1, 7))
    for i in range(n):
      i %= 5
      res[i], res[i+1] = res[i+1], res[i]
    print(''.join(map(str, res)))

  def D(): pass 


class ABC005():
  def A():
    x, y = map(int, sys.stdin.readline().split())
    print(y//x)

  def B():
    n, *t = map(int, sys.stdin.read().split())
    print(min(t))

  def C():
    t = int(sys.stdin.readline().rstrip())
    n = int(sys.stdin.readline().rstrip())
    a = [int(x) for x in sys.stdin.readline().split()]
    m = int(sys.stdin.readline().rstrip())
    b = [int(x) for x in sys.stdin.readline().split()]
    i = 0
    for p in b:
      if i == n: print('no'); return 
      while p-a[i] > t:
        i += 1
        if i == n: print('no'); return 
      if a[i] > p: print('no'); return 
      i += 1
    print('yes')

  def D():
    n = int(sys.stdin.readline().rstrip())
    d = np.array([sys.stdin.readline().split() for _ in range(n)], np.int64)
    s = d.cumsum(axis=0).cumsum(axis=1)
    s = np.pad(s, 1)
    max_del = np.zeros((n+1, n+1), dtype=np.int64)
    for y in range(1, n+1):
      for x in range(1, n+1):
        max_del[y, x] = np.amax(s[y:n+1, x:n+1] - s[0:n-y+1, x:n+1] - s[y:n+1, 0:n-x+1] + s[0:n-y+1, 0:n-x+1])
    res = np.arange(n**2+1)[:, None]
    i = np.arange(1, n+1)
    res = max_del[i, np.minimum(res//i, n)].max(axis=1)
    q = int(sys.stdin.readline().rstrip())
    p = np.array(sys.stdin.read().split(), dtype=np.int64)
    print(*res[p], sep='\n')


class ABC006():
  def A():
    n = sys.stdin.readline().rstrip()
    if '3' in n: print('YES')
    elif int(n)%3 == 0: print('YES')
    else: print('NO')

  def B():
    mod = 10007
    t = [0, 0, 1]
    for _ in range(1001001):
      t.append(t[-1]+t[-2]+t[-3]); t[-1] %= mod
    n = int(sys.stdin.readline().rstrip())
    print(t[n-1])
    
  def C():
    n, m = map(int, sys.stdin.readline().split())
    cnt = [0, 0, 0]
    if m == 1: cnt = [-1, -1, -1]
    else:
      if m & 1: m -= 3; cnt[1] += 1; n -= 1
      cnt[2] = m//2 - n 
      cnt[0] = n - cnt[2]
    if cnt[0]<0 or cnt[1]<0 or cnt[2]<0: print(-1, -1, -1)
    else: print(*cnt, sep=' ')
      
  def D():
    n, *c = map(int, sys.stdin.read().split())
    lis = [inf]*n 
    for x in c: lis[bi_l(lis, x)] = x 
    print(n - bi_l(lis, inf))


class ABC007():
  def A():
    n = int(sys.stdin.readline().rstrip())
    print(n-1)

  def B():
    s = sys.stdin.readline().rstrip()
    if s == 'a': print(-1)
    else: print('a')

  def C():
    r, c = map(int, sys.stdin.readline().split())
    sy, sx = map(int, sys.stdin.readline().split())
    gy, gx = map(int, sys.stdin.readline().split())
    sy -= 1; sx -=1; gy -= 1; gx -= 1
    maze = [sys.stdin.readline().rstrip() for _ in range(r)]
    queue = deque([(sy, sx)])
    dist = np.full((r, c), np.inf); dist[sy, sx] = 0
    while queue:
      y, x = queue.popleft()
      for i, j in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
        i += y; j += x
        if maze[i][j] == '#' or dist[i, j] != np.inf: continue 
        dist[i, j] = dist[y, x] + 1
        queue.append((i, j))
    print(int(dist[gy, gx]))
  
  def D(): pass 


class ABC008():
  def A():
    s, t = map(int, sys.stdin.readline().split())
    print(t-s+1)

  def B():
    n, *s = sys.stdin.read().split()
    res = defaultdict(int)
    for name in s: res[name] += 1
    print(sorted(res.items(), key=lambda x: x[1])[-1][0])

  def C():
    n, *a = map(int, sys.stdin.read().split())
    a = np.array(a)
    c = n - np.count_nonzero(a[:, None]%a, axis=1)
    print(np.sum((c+1)//2/c))
  
  def D(): pass

class ABC009():
  def A():
    n = int(sys.stdin.readline().rstrip())
    print((n+1)//2)

  def B():
    n, *a = map(int, sys.stdin.read().split())
    print(sorted(set(a))[-2])
    
  def C():
    n, k = map(int, sys.stdin.readline().split())
    s = list(sys.stdin.readline().rstrip())
    cost = [1]*n
    r = k
    for i in range(n-1):
      q = []
      for j in range(i+1, n):
        if s[j] < s[i] and cost[i]+cost[j] <= r:
          heappush(q, (s[j], cost[i]+cost[j], -j))
      if not q: continue
      _, c, j = heappop(q); j = -j 
      s[i], s[j] = s[j], s[i]
      r -= c 
      cost[i] = cost[j] = 0
    print(''.join(s))
      
  def D(): pass 


class ABC010():
  def A():
    print(sys.stdin.readline().rstrip()+'pp')
  def B():
    n, *a = map(int, sys.stdin.read().split())
    tot = 0
    for x in a:
      c = 0 
      while x%2==0 or x%3==2:
        x -= 1
        c += 1
      tot += c
    print(tot)

  def C():
    sx, sy, gx, gy, t, v, n, *xy = map(int, sys.stdin.read().split())
    x, y = np.array(xy).reshape(-1, 2).T
    def dist(x1, y1, x2, y2):
      return np.sqrt((x2-x1)**2 + (y2-y1)**2)
    ans = 'YES' if (dist(sx, sy, x, y)+dist(x, y, gx, gy) <= v*t).any() else 'NO'
    print(ans)

  def D(): pass 

class ABC011():
  def A():
    n = int(sys.stdin.readline().rstrip())
    print(n%12+1)

  def B():
    s = sys.stdin.readline().rstrip() 
    print(s[0].upper()+s[1:].lower())

  def C():
    n, *ng = map(int, sys.stdin.read().split())
    ng = set(ng)
    if n in ng: print('NO')
    else:
      r = 100
      while n > 0:
        if r == 0: print('NO'); return
        for i in range(3, 0, -1):
          if (n-i) in ng: continue 
          n -= i
          r -= 1
          break 
        else: print('NO'); return 
      print('YES')

  def D(): pass 


class ABC170():
  def A():
    x = [int(x) for x in sys.stdin.readline().split()]
    for i in range(5):
      if x[i] != i+1:
        print(i+1)
        break

  def B():
    x, y = map(int, sys.stdin.readline().split())
    print('Yes' if 2*x <= y <= 4*x and y%2 == 0 else 'No')
      
  def C():
    x, n, *p = map(int, sys.stdin.read().split())
    a = list(set(range(102)) - set(p))
    a = [(abs(y-x), y) for y in a]
    print(sorted(a)[0][1])

  def D():
    n, *a = map(int, sys.stdin.read().split())
    cand = set(a)
    cnt = 0
    for x, c in sorted(Counter(a).items()):
      cnt += c == 1 and x in cand
      cand -= set(range(x*2, 10**6+1, x))
    print(cnt)

  def E():
    n, q = map(int, sys.stdin.readline().split())
    queue = [] 
    num_kindergarten = 2*10**5
    queue_kindergarten = [[] for _ in range(num_kindergarten)]
    highest_kindergarten = [None] * num_kindergarten
    where = [None] * n
    rate = [None] * n

    def entry(i, k):
      where[i] = k
      while queue_kindergarten[k]:
        r, j = heappop(queue_kindergarten[k])
        if where[j] != k or j == i: continue 
        if rate[i] >= -r:
          highest_kindergarten[k] = rate[i]
          heappush(queue, (rate[i], k, i))
        heappush(queue_kindergarten[k], (r, j))
        break
      else:
        highest_kindergarten[k] = rate[i]
        heappush(queue, (rate[i], k, i))
      heappush(queue_kindergarten[k], (-rate[i], i))

    def transfer(i, k):
      now = where[i]
      while queue_kindergarten[now]:
        r, j = heappop(queue_kindergarten[now])
        if where[j] != now or j == i: continue
        if highest_kindergarten[now] != -r:
          highest_kindergarten[now] = -r
          heappush(queue, (-r, now, j))
        heappush(queue_kindergarten[now], (r, j))
        break
      else:
        highest_kindergarten[now] = None
      entry(i, k)

    def inquire():
      while True:
        r, k, i = heappop(queue)
        if where[i] != k or r != highest_kindergarten[k]: continue 
        heappush(queue, (r, k, i))
        return r

    for i in range(n):
      a, b = map(int, sys.stdin.readline().split())
      rate[i] = a 
      entry(i, b-1)
    for _ in range(q):
      c, d = map(int, sys.stdin.readline().split())
      transfer(c-1, d-1)
      print(inquire())
    
  def F(): pass 


class ABC171():
  def A():
    c = sys.stdin.readline().rstrip()
    print('A' if c < 'a' else 'a')

  def B():
    n, k, *p = map(int, sys.stdin.read().split())
    print(sum(sorted(p)[:k]))

  def C():
    n = int(sys.stdin.readline().rstrip())
    n -= 1
    l = 1
    while True:
      if n < pow(26, l):
        break 
      n -= pow(26, l)
      l += 1
    res = ''.join([chr(ord('a')+d%26) for d in NumberTheory.base_convert(n, 26)][::-1])
    res = 'a'*(l-len(res)) + res
    print(res)

  def D(): pass 
  def E(): pass 
  def F(): pass 

if __name__ == '__main__':
  ABC171.C()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = "abcdefghijklmnopqrstuvwxyz"
d = 0
while n > 0:
    d += 1
    n -= 26 ** d
n += 26 ** d-1
s = ""
while d:
    s = s + a[n % 26]
    n = n // 26
    d -= 1
print(s[::-1])

Submission status: Accepted

Solution code:
N = int(input())

def name(n):
    if n == 0:
        return ''
    n -= 1
    return name(n//26) + chr(ord('a') + n % 26)

print(name(N))

Submission status: Accepted

Solution code:
# print('input >>')
N = int(input())
alphabets = 'abcdefghijklmnopqrstuvwxyz'

name = ''

while N > 0:
    mod = N % 26
    if mod == 0:
        mod = int(26)
    name = alphabets[int(mod-1)] + name
    N -= 0.1
    N //= 26

# print('-----output-----')
print(name)

Submission status: Accepted

Solution code:
import itertools
import string

n = int(input())
alphabets = string.ascii_lowercase

digit = 0
counter = 0
while counter < n:
	digit += 1
	counter += 26**digit

answer = ""
for d in range(digit):
	if d == 0:
		alphabet = n % 26 - 1
		if alphabet == -1:
			alphabet = 25
		answer = alphabets[alphabet] + answer
		n = n - alphabet
	else:
		n = n // 26
		alphabet =  n % 26 - 1
		if alphabet == -1:
			alphabet = 25
		answer = alphabets[alphabet] + answer
		n = n - alphabet

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
c,I,ans = 0,1,[]
lis = 'abcdefghijklmnopqrstuvwxyz'

I_=0
while 26**I+I_<N:
  I_+=26**I
  I+=1
  
for i in range(I):
  N,mod = divmod(int(N),26)
  if mod == 0:
    N-=1
  #print('N',N)
  #print('mod',mod)
  ans.append(lis[mod-1])

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

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']
s=''
M=[26**i for i in range(12)]
k=0
for i in range(12):
    k=k+M[i]
    if N<k:
        m=k-M[i]
        N=N-m
        L=[0]
        n=0
        for j in range(1, i+1):
            L.append(N%M[j])
            s=Al[(L[j]-L[j-1])//M[j-1]]+s
        break
print(s)

Submission status: Accepted

Solution code:
N = int(input())

S = "abcdefghijklmnopqrstuvwxyz"

ans = ""
while N > 0:
    N -= 1
    ans += S[N%26]
    N //= 26

print(ans[::-1])

Submission status: Accepted

Solution code:
import math

n = int(input())
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']
name = ''

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

Submission status: Accepted

Solution code:
def c171(n):

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

    return ans[::-1]

def main():
    n = int(input())
    print(c171(n))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def c171(n):

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

    return ans[::-1]

def main():
    n = int(input())
    print(c171(n))

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:
n=int(input())
l=list("abcdefghijklmnopqrstuvwxyz")
name=""
while n>=1:
    name=(l[(n-1)%26])+name
    n=(n-1)//26
print(name)

Submission status: Accepted

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys


def tes(n):
    return int((26**(n+1)-1)/(26-1))


n = int(stdin.readline().rstrip())
b = n
data1 = ['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']
data2 = []
for el in range(1, 16):
    data2.append('a'*el)
d = []
pos = 0
for el in range(12):
    d.append(tes(el))
for el in range(len(d)):
    if n < d[el]:
        pos = el-1
        break
num = d[pos]
diff = n-num
de = []
counter = 16
while True:
    de.append(diff % 26)
    diff = int(diff/26)
    counter -= 1
    if counter == 0:
        break
stri = data2[pos]
res = ''
count = 0
for el in stri:
    res += data1[de[count]]
    count += 1
print(''.join(list(reversed(res))))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

n = int(input())

ans = []

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

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

Submission status: Accepted

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

for i in range(1, 15):
    if n >= 26**i:
        n -= 26**i
        continue
    for j in range(i):
        r = n % 26
        n //= 26
        result += chr(ord('a') + r)
    break
print(result[::-1])

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 numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N = int(input())
alphabet = [chr(i) for i in range(97, 97+27)]
tss = [26**i for i in range(1, 12)]

for ind, ts in enu(tss):
    if ts < N:
        N -= ts
    else:
        break
keta = ind + 1
# print('keta', keta)

moji = ''
N -= 1
# print('->', N)
for ket in range(keta):
    N, mod = divmod(N, 26)
    # print(' N, mod', N, mod)
    moji += alphabet[mod]
moji = ''.join(list(reversed(moji)))
print(moji)

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"]
k = -1
sum = []
for i in range(13):
  k += 26**i
  sum.append(k)
j = 0
while sum[j]<N:
  j += 1

N += -sum[j-1]-1
ans = ""
for m in range(j):
  z = N//(26**(j-m-1))
  N += -26**(j-m-1)*z
  ans+=al[z]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
x=1
X='abcdefghijklmnopqrstuvwxyz'
for i in range(1,100):
    if x<=n<x+26**i:
        n-=x
        cnt=i
        break
    else:
        x+=26**i
ans=''
for i in range(cnt):
    ans=ans+X[n%26]
    n//=26

print(ans[::-1])

Submission status: Accepted

Solution code:
n=int(input())
x=1
X='abcdefghijklmnopqrstuvwxyz'
for i in range(1,100):
    if x<=n<x+26**i:
        n-=x
        cnt=i
        break
    else:
        x+=26**i
ans=''
for i in reversed(range(cnt)):
    ans+=X[n//(26**i)]
    n%=(26**i)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
X = 'abcdefghijklmnopqrstuvwxyz'

d, m = divmod(N - 1, 26)
ans = X[m]
while d > 26:
    d, m = divmod(d - 1, 26)
    ans = X[m] + ans

if d != 0:
    ans = X[d - 1] + ans
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
b=""

while n>0:
  n-=1
  b+=chr(ord("a")+n%26)
  n=n//26
  
print(b[::-1])

Submission status: Accepted

Solution code:
roman = "abcdefghijklmnopqrstuvwxyz"
num_to_roman = {}
for i in range(26):
  num_to_roman[i] = roman[i]

n = int(input())
ans = []
while(n):
  n-=1
  ans.insert(0,num_to_roman[n%26])
  n = n//26
  
ans_str = ''.join(ans)
print(ans_str)

Submission status: Accepted

Solution code:
n = int(input())

A = []

ans = ""
while(n > 0):
    n -= 1
    A.append(n% 26)
    n //= 26
for i in range(len(A)):
    ans += chr(ord('a') + A[len(A)-i-1])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans=""
amari=[]

while n>=25:
    amari.insert(0,n%26)
    n//=26

amari.insert(0,n)

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

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())-1
L=[]
S=[]
A=[chr(i) for i in range(97,123)]
X=""
while N>=0:
  if N==0:
    L.append(N%26)
    N=N//26
    break
  elif N!=0:
    L.append(N%26)
    N=N//26-1
S=list(reversed(L))
for i in range(len(S)):
  X+=A[S[i]]
print(str(X))

Submission status: Accepted

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

    while N > 0:
        ans = l[N % 26 - 1] + ans
        N = (N-1) // 26

    print(ans)


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())
alphabet = ["","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 = ""
for i in reversed(range(12)):
    b=0
    if n//26**i>0:
        for j in range(i):
            b+=26**j
    a = (n-b)//26**i
    ans += alphabet[a]
    n = n-a*(26**i)
print(ans)

Submission status: Accepted

Solution code:
# ABC171C
import sys
import re
n = int(input())
ABC = [chr(i) for i in range(97,97+26)]
ans = []

a = n
while a > 0:
    a -= 1
    t = a%26
    a = a//26
    ans.append(ABC[t])
ans.reverse()
print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())

alphabets = 'zabcdefghijklmnopqrstuvwxyz'
numbers = list(range(0, 26, 1))
alphabet_dict = {}
for i in numbers:
    alphabet_dict[i] = alphabets[i]

words = []
while True:
    if n >= 1:
        cnt = n % 26
        word = alphabet_dict[cnt]
        words.append(word)
        if cnt == 0:
            n = (n//26) - 1
        else:
            n = n//26
    else:
        break

words.reverse()
print(''.join(words))

Submission status: Accepted

Solution code:
def dogsName(n):
	if (n==0):
		return
	n = n-1
	last_char = n%26
	dogsName(n//26)
	print(chr(ord('a') + last_char), end='')

n = int(input())
dogsName(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def generate(n):
	if n == 0:
		return ""
	return generate((n-1)//26) + chr((n-1)%26+ord('A'))

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

Submission status: Accepted

Solution code:
N = int(input())
Alphabet = str('abcdefghijklmnopqrstuvwxyz')
import bisect

List = [0, 26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510, 3817158266467286, 99246114928149462, 2580398988131886038, 67090373691429037014, 1744349715977154962390, 45353092615406029022166, 1179180408000556754576342, 30658690608014475618984918]
V = []

if List.count(N) == 1:
	for i in range (0, List.index(N)):
		V.append('z')
	print(*V, sep = '')
	exit()

k = 26
A = [0]
for i in range (2, 20):
	A.append(k)
	k = k+26**i
    
S = []

B = bisect.bisect_right(A, N)

N = N-A[B-1]-1
for i in range (0, B):
	S.append(Alphabet[N%26])
	N = N//26
    
S = reversed(S)
print(*S, sep = '')

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in range(12):
    c = (num-1) % 26
    ans += alf[c]
    num = (num-1) // 26
    if num < 1:
        break

print("".join(reversed(ans)))

Submission status: Accepted

Solution code:
N = int(input())

def ntoa(n):
    return chr(ord('a') + n)

s = ''
while True:
    c = (N-1) % 26
    s += ntoa(c)
    N = (N-1) // 26
    if N <= 0:
        break

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

Submission status: Accepted

Solution code:
n = int(input())

ans = ""

for i in range(1, 15):
    if n <= 26**i:
        # print(n)
        n -= 1
        for j in range(i):
            ans = chr(ord("a") + n % 26) + ans
            # print(ans)
            n //= 26
        break
    else:
        n -= 26**i

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
name = 'abcdefghijklmnopqrstuvwxyz'
ans = []
while n>0:
    n -= 1
    ans.append(name[n%26])
    n //= 26
print(''.join(ans[::-1]))

Submission status: Accepted

Solution code:
N=int(input())
List='abcdefghijklmnopqrstuvwxy'

Ans=''

while N>=1:
    Amari=N%26
    
    if Amari==0:
        Ans='z'+Ans
    else:
        Ans=List[Amari-1]+Ans
        
    N=(N-1)//26
    
print(Ans)

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  ans = ''
  abc = "abcdefghijklmnopqrstuvwxyz"
  
  
  while N > 0:
    N -=1
    ans += abc[N % 26]
    
    N = N//26
  
  print(ans[::-1])
  
  
  
main()

Submission status: Accepted

Solution code:
import math
li=[chr(i) for i in range(97, 97+26)]
AnsFromRight = []
AmsFromLeft=[]
def GetN_Hidari(j):
        tmp=0
        for k in range(j+1):
            tmp+=26**k
        return tmp-1        
#---------
N=int(input())
i=0
while True:
    N_HidariCut=N-GetN_Hidari(i)
    if N_HidariCut<=0:
        break
    OrderWithinKatamari = N_HidariCut%(26**(i+1))
    AnsFromRight.append(li[math.ceil(OrderWithinKatamari/(26**i)-1)])
    i+=1    
AnsFromLeft= AnsFromRight[::-1]
print("".join(AnsFromLeft))

Submission status: Accepted

Solution code:
n = int(input())

def change_n_shinsu(x, n):
    ans = []
    while True:
        shou = x // n
        amari = x % n
        if shou == 0 and amari == 0:
            break
        ans.append(amari)
        x = shou
    return ans

end = [26]
for i in range(2, 100):
    end.append(26**i+end[-1])
    if end[-1] > 1000000000000001:
        break
start = [1]
for i in end[:-1]:
    start.append(i+1)

i = 0
while n > end[i]:
    i += 1
keta = i+1
n -= start[i]

ret = change_n_shinsu(n, 26)
ans = ''
for i in ret:
    ans = chr(i+ord('a')) + ans
ans = 'a'*(keta-len(ret)) + ans
print(ans)