qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())-1
result = ""

if n!=0:
    while(1):
        tmp = n % 26
        result += chr(tmp+97)
        n = n // 26
        n -= 1
        if n==0: break
print(result[::-1])

Fixed code:
n = int(input())-1
result = ""

while(1):
    tmp = n % 26
    result += chr(tmp+97)
    n = n // 26
    if n==0: break
    n -= 1
    
print(result[::-1])
Buggy code:
n = int(input())-1
result = ""
v = 11

tmp = n % 26
result += chr(tmp+97)
n = n // 26

if n!=0:
    while(1):
        n -= 1
        print(tmp,result,n)
        tmp = n % 26
        result += chr(tmp+97)
        n = n // 26
        if n==0: break


print(result[::-1])

Fixed code:
n = int(input())-1
result = ""
v = 11

tmp = n % 26
result += chr(tmp+97)
n = n // 26

if n!=0:
    while(1):
        n -= 1
        # print(tmp,result,n)
        tmp = n % 26
        result += chr(tmp+97)
        n = n // 26
        if n==0: break

print(result[::-1])
Buggy 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']
ln = []

while True:
    n -= 1
    b = n % 26
    ln.append(alphabet[b])

    if n <= 26:
        break

    a = n//26
    n = a

ln.reverse()
ln=''.join(ln)
print(ln)

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

while True:
    n -= 1
    b = n % 26
    ln.append(alphabet[b])

    if n <= 25:
        break

    a = n//26
    n = a

ln.reverse()
ln=''.join(ln)
print(ln)
Buggy code:
import math

n = int(input())
keta = int(math.log(n)/math.log(26)) + 1
name = [0]*keta

for i in range(keta):
    name[i] = n % 26
    n = n // 26

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']

ans = ''

for j in range(keta):
    if name[j] != 0:
        ans = alp[name[j]-1] + ans
    elif j != keta-1:
        name[j] = 26
        name[j+1] -= 1
        ans = alp[name[j]-1] + ans

print(name)
print(ans)


Fixed code:
import math

n = int(input())
keta = int(math.log(n)/math.log(26)) + 1
name = [0]*keta

for i in range(keta):
    name[i] = n % 26
    n = n // 26

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']

ans = ''

for j in range(keta):
    if name[j] == 0 and j != keta-1:
        name[j] = 26
        name[j+1] -= 1
        ans = alp[name[j]-1] + ans
    elif name[j] == -1 and j != keta-1:
        name[j+1] -= 1
        name[j] += 26
        ans = alp[name[j]-1] + ans
    elif j == keta-1 and name[j] == 0:
        pass
    else:
        #name[j] != 0
        ans = alp[name[j]-1] + ans

#print(name)
print(ans)
Buggy code:
def main():
    N = int(input()) - 1
    digits = []

    while True:
        a, b = N // 26, N % 26
        digits.append(b)
        if a == 0:
            break
        N = a

    digits.reverse()
    chars = map(to_alphabet, digits)
    print(''.join(chars))


def to_alphabet(x: int):
    return chr(65 + x).lower()


if __name__ == "__main__":
    main()


Fixed code:
def main():
    N = int(input()) - 1
    digits = []

    while True:
        a, b = N // 26, N % 26
        if a == 0:
            digits.append(b)
            break
        digits.append(b)
        N = a - 1

    digits.reverse()
    chars = map(to_alphabet, digits)
    print(''.join(chars))


def to_alphabet(x: int):
    return chr(65 + x).lower()


if __name__ == "__main__":
    main()
Buggy code:
N = int(input())
al = [chr(i) for i in range(97, 97+26)]
ans = ""
while True:
    temp = N % 26
    ans = al[temp-1] + ans
    if N // 26 == 0:
        break
    else:
        N = N // 26
        if N == 1:
            break

print(ans)

Fixed code:
N = int(input())
al = [chr(i) for i in range(97, 97+26)]
ans = ""
while True:
    temp = N % 26
    ans = al[temp-1] + ans
    if N // 26 == 0:
        break
    else:
        if N == 26:
            break
        if N % 26 == 0:
            N = N // 26 - 1
        else:
            N = N // 26

print(ans)
Buggy code:
n = int(input())
b = 26
ans = []
for i in range(1,99):
    if n <= b:
        n -= 1
        for j in range(i-1):
            ans.append(chr(97 + n % b))
            n //= b
        break
    else:
        n -= b ** i

for k in range(len(ans)):
    print(ans[-(k+1)],end="")

Fixed code:
n = int(input())
b = 26
ans = []
for i in range(1,99):
    if n <= b**i:
        n -= 1
        for j in range(i):
            ans.append(chr(97 + n % b))
            n //= b
        break
    else:
        n -= b ** i
for k in range(1,len(ans)+1):
    print(ans[-k],end="")
Buggy code:
N = int(input())

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

Fixed code:
N = int(input())

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

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"]
re = []


while(n > 1):
    am = n%26
    
    n = n//26
    
    re.append(al[am])
    
re.reverse()

for i in re:
    print(i,end="")

Fixed code:
n = int(input())

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"]
re = []


while(n != 0):
    am = n%26
    
    n = n//26
    
    re.append(al[am])
    
    if(am == 0):
        n -=1
    
re.reverse()

for i in re:
    print(i,end="")
Buggy code:
n = int(input())
alfa = ['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']
re = []
while n > 26:
    re.append(int(n % 26))
    n = int(n / 26)
re.append(n % 26)
print(re)
result = ''
for i in range(len(re)):
    result += alfa[re[len(re)-i-1]-1]
print(result)


Fixed code:
n = int(input())
alfa = ['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']
re = []
while n > 26:
    re.append(int(n % 26))
    if int(n%26) == 0:
        n -= 1
    n = int(n / 26)
re.append(n % 26)
result = ''
for i in range(len(re)):
    result += alfa[re[len(re)-i-1]-1]
print(result)
Buggy code:
N = int(input())
a = 26
counter = 1
while a<N:
  N -= a
  counter += 1
  a *= 26
ans = []
N=-1
while N>26
  ans.append(N%26)
  N = N //26
ans.append(N)
dic = ["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 = [dic[i] for i in ans[::-1]]
n = len(ans)
print("a"*(conter-n) + "".join(ans))

Fixed code:
N = int(input())
a = 26
counter = 1
while a<N:
  N -= a
  counter += 1
  a *= 26
ans = []
N -= 1
while N>=26:
  ans.append(N%26)
  N = N //26
ans.append(N)
dic = ["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 = [dic[i] for i in ans[::-1]]
n = len(ans)
print("a"*(counter-n) + "".join(ans))
Buggy code:
	a_list = [chr(ord('a') + i) for i in range(26)]
n = int(input())

l_list = []
ans = ''
while n > 0:
    
    if n % 26 == 0:
        l_list.append(25)
        n = n // 26 - 1
    else:
        l_list.append(n%26)
        n = n // 26
l_list = l_list[::-1]
for i in l_list:
    ans += a_list[i]
print(ans)

Fixed code:
a_list = [chr(ord('a') + i) for i in range(26)]
n = int(input())

l_list = []
ans = ''
while n > 0:
    if n % 26 == 0:
        l_list.append(26)
        n = n // 26 - 1
    else:
        l_list.append(n%26)
        n = n // 26
l_list = l_list[::-1]
for i in l_list:
    ans += a_list[i-1]
print(ans)
Buggy code:
n = int(input())
mod = 26
x = 1
l = list()
while True:
    if n <= mod:
        for i in range(x):
            l.append(n%26)
            n = n//26
        break
    else:
        n -= mod
        mod *= 26
        x += 1
l.reverse()

print(l)
l2 = list()
if l.count(0) == x:
    print("z"*x)
    exit()
for i in range(len(l)):
    if i == x-1:
        if l[i] == 0:
            l2.append("z")
        else:
            l2.append(chr(l[i]+96))
    else:
        l2.append(chr(l[i]+97))
print("".join(l2))

Fixed code:
n = int(input())
mod = 26
x = 1
l = list()
while True:
    if n <= mod:
        for i in range(x):
            l.append(n%26)
            n = n//26
        break
    else:
        n -= mod
        mod *= 26
        x += 1
l.reverse()

l2 = list()
# if l.count(0) == x:
#     print("z"*x)
#     exit()
# for i in range(len(l)):
#     if l[i] == 0:
#         l[i-1] -= 1
#         l[i] = 26
if l.count(0) == x:
    print("z"*x)
    exit()
for i in range(x-1):
    l[i] += 1
for i in range(x-1,-1,-1):
    if l[i] == 0:
        l[i-1] -= 1
        l[i] = 26
for i in range(len(l)):
    l2.append(chr(l[i]+96))
print("".join(l2))
Buggy code:
n = int(input())
def B(X, n):
    X_dumy = X
    ln = []
    while X_dumy>0:
        ln.append(int(X_dumy%n))
        X_dumy = int(X_dumy/n)
    ln.reverse()
    return ln
ln = B(n, 26)
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']
q = []
print(ln)
for i in range(len(ln)):
    if ln[i] == 1 and ln[i] < ln.index(0):
        q.append('z')
    elif ln[i] != 0:
        q.append(a[ln[i] - 1])
print(''.join(q))

Fixed code:
n = int(input())
def B(X, n):
    X_dumy = X
    ln = []
    while X_dumy>0:
        ln.append(int(X_dumy%n))
        X_dumy = int(X_dumy/n)
    return ln
ln = B(n, 26)
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']
q = []
for i in range(len(ln)):
    if ln[i] > 0:
        q.append(a[ln[i] - 1])
    elif ln[i] == 0:
        if i != len(ln) - 1:
            ln[i + 1] -= 1
            q.append('z')
    elif ln[i] < 0:
        q.append('y')
        ln[i + 1] -= 1
        
q.reverse()
print(''.join(q))
Buggy code:
A="abcdefghijklmnopqrstuvwxyz"
n=int(input())
i=1
while n-26**i>0:
    n-=26**i
    i+=1
name=[]
n-=1
for j in range(i):
    temp=n%26
    name.append(A[temp])
    n//=26

print(name[::-1])

Fixed code:
A="abcdefghijklmnopqrstuvwxyz"
n=int(input())
i=1
while n-26**i>0:
    n-=26**i
    i+=1
name=[]
n-=1
for j in range(i):
    temp=n%26
    name.append(A[temp])
    n//=26
for k in name[::-1]: print(k,end="")
Buggy code:
def solve():
    n=int(input())
    ans=''
    check='abcdefghijklmnopqrstuvwxyz'
    while n!=0:
        n-=1
        ans+=check[n%26]
    print(ans[::-1])
    return 0

if __name__ == "__main__":
    solve()


Fixed code:
def solve():
    n=int(input())
    ans=''
    check='abcdefghijklmnopqrstuvwxyz'
    while n!=0:
        n-=1
        ans+=check[n%26]
        n //= 26
    print(ans[::-1])
    return 0

if __name__ == "__main__":
    solve()
Buggy code:
N = int(input())
chars = "Xabcdefghijklmnopqrstuvwxyz"
ans = ""
while True:
    la = N // 26
    sm = N % 26
    if sm == 0:
        sm = 26
        la -= 1
    ans += chars[sm]
    N = la
    if N <= 1:
        break
print(ans[::-1])

Fixed code:
N = int(input())
chars = "Xabcdefghijklmnopqrstuvwxyz"
ans = ""
while True:
    la = N // 26
    sm = N % 26
    if sm == 0:
        sm = 26
        la -= 1
    ans += chars[sm]
    N = la
    if N < 1:
        break
print(ans[::-1])
Buggy code:
n = int(input())

moji = [chr(i) for i in range(97, 97+26)]
ans = ''
while n != 0:
    ans += moji[int((n-1) % 26)]
    n =  n //26
print(ans)

Fixed code:
n = int(input())

moji = [chr(i) for i in range(97, 97+26)]
ans = ''
while n > 0:
    n -= 1
    x = int(n % 26)
    ans = moji[n % 26] + ans
    n //= 26
print(ans)
Buggy code:
N = int(input())
alf = [chr(i) for i in range(97, 97+26)]
List = []
for i in range(100):
  if N > 26:
    a = N % 26
    N = int(N / 26)
    List.append(alf[a-1])
  else:
    List.append(alf[N-1])
    break
    

print("".join(List))

Fixed 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]))
Buggy code:
sum=26
count=0
n = int(input())
k = ord('a')-1
while(sum<n) :
  count+=1
  sum+=26**(count+1)

current=n
mozi=''
mozi1=''

list1=[]
for i in reversed(range(count+1)) :
  c=current//26**i
  current = current % 26 ** i
  list1.append(c)
print(list1)
for i in range(1,count+1) :
  if list1[-i]<=0 :
    list1[-i]+=26
    list1[-i-1]-=1
print(list1)
for  i in range(count+1) :
  mozi+=chr(list1[i]+k)
print(mozi)

Fixed code:
sum=26
count=0
n = int(input())
k = ord('a')-1
while(sum<n) :
  count+=1
  sum+=26**(count+1)

current=n
mozi=''
mozi1=''

list1=[]
for i in reversed(range(count+1)) :
  c=current//26**i
  current = current % 26 ** i
  list1.append(c)

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

for  i in range(count+1) :
  mozi+=chr(list1[i]+k)
print(mozi)
Buggy code:
number   = int(input())
alphabet = [chr(i) for i in range(97, 97+26)]
name_tag = []

while number != 0:
  number, a = divmod(number-1, 26)
  name_tag.append(a)
  
reverse_name_tag = reversed(name_tag)
for i in reverse_name_tag:
  print(alphabet[i-1], end="")

Fixed code:
number   = int(input())
alphabet = [chr(i) for i in range(97, 97+26)]
name_tag = []

while number > 0:
  number, a = divmod(number-1, 26)
  name_tag.append(a)
  
reverse_name_tag = reversed(name_tag)
for i in reverse_name_tag:
  print(alphabet[i], end="")
Buggy code:
N = int(input())
s=1
while pow(26,s)<N:
    N-=pow(26,s)
    s+=1


ans=["a"]*s
print(N)
print(s)

N-=1
for i in range(s):
    r = N%26
    ans[-i] = chr(ord(ans[-i])+r)
    N//=26

#if ans[0]=="a":
#    ans[0]="z"
#else:
#    ans[0] = chr(ord(ans[0])+1)
print("".join(reversed(ans)))


Fixed code:
N = int(input())
s=1
while pow(26,s)<N:
    N-=pow(26,s)
    s+=1


N-=1
ans=["a"]*s
for i in range(s):
    r = N%26
    ans[i] = chr(ord(ans[i])+r)
    N//=26

#if ans[0]=="a":
#    ans[0]="z"
#else:
#    ans[0] = chr(ord(ans[0])+1)
print("".join(reversed(ans)))
Buggy code:
#!/usr/bin/env python3
import sys
import string

l = [None]+[c for c in string.ascii_lowercase]
def f(N: int):
    N -= 1
    if N // 26:
        return f(N//26) + l[N%26]
    else:
        return l[N%26]

def solve(N):
    print(f(N))

# 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()


Fixed code:
#!/usr/bin/env python3
import sys
import string

l = [c for c in string.ascii_lowercase]
def f(N: int):
    N -= 1
    if N // 26:
        return f(N//26) + l[N%26]
    else:
        return l[N%26]

def solve(N):
    print(f(N))

# 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()
Buggy code:
N=int(input())
keta=1
a=26
ans=""
while N>0:
  N-=1
  ans+=chr(ord('a')+N%26)
  N=N//26
print(ans)

Fixed code:
N=int(input())
keta=1
a=26
ans=""
while N>0:
  N-=1
  ans+=chr(ord('a')+N%26)
  N=N//26
print(ans[::-1])
Buggy code:
def main():
    N = int(input())
    ans = ""

    while N:
        N -= 1
        tmp = N % 26
        txt = chr(tmp + ord("a"))
        N //= 26

    print(ans[::-1])


if __name__ == '__main__':
    main()

Fixed code:
def main():
    N = int(input())
    ans = ""

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

    print(ans[::-1])


if __name__ == '__main__':
    main()
Buggy code:
MAX = 50
  
# Function to print Excel column name  
# for a given column number 
def printString(n): 
  
    # To store result (Excel column name) 
    string = ["\0"] * MAX
  
    # To store current index in str which is result 
    i = 0
  
    while n > 0: 
        # Find remainder 
        rem = n % 26
  
        # if remainder is 0, then a  
        # 'Z' must be there in output 
        if rem == 0: 
            string[i] = 'z'
            i += 1
            n = (n / 26) - 1
        else: 
            string[i] = chr((rem - 1) + ord('a')) 
            i += 1
            n = n / 26
    string[i] = '\0'
  
    # Reverse the string and print result 
    string = string[::-1] 
    #string=string.lower()
    print "".join(string) 
  
n=int(input())
printString(n)
  

Fixed code:
MAX = 50
  
# Function to print Excel column name  
# for a given column number 
def printString(n): 
  
    # To store result (Excel column name) 
    ans=""
  
    # To store current index in str which is result 
    i = 0
  
    while n > 0: 
        # Find remainder 
        rem = n % 26
  
        # if remainder is 0, then a  
        # 'Z' must be there in output 
        if rem == 0: 
            ans= ans+'z'
            i += 1
            n = (n // 26) - 1
        else: 
            ans+= chr((rem - 1) + ord('a')) 
            i += 1
            n = n //26
    
  
    # Reverse the string and print result 
    ans=ans[::-1]
    #string=string.lower()
    print(ans)
  
n=int(input())
printString(n)
Buggy code:
def main():
  N = int(input())
  ans = ''
  abc = "abcdefghijklmnopqrstuvwxyz"
  
  
  while N > 0:
    ans += abc[(N % 26)-1]
    print(ans)
    N = N//26
  
  print(ans[::-1])
  
  
  
main()

Fixed 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()
Buggy code:
N = int(input()) 
S = ''
K = (26 + 26**2 + 26**3 + 26**4 + 26**5 + 26**6 + 26**7 + 26**8 + 26**9 + 26**10)

for outer  in range(10):
    K -= 26**(10 - outer)
    print(K)
    if N > K:
        
        for iter in range(27):
            if N <= K + (iter) * 26**(10 - outer -1 ):
                S += chr(97+iter - 1)
                N -= (iter) * 26**(10 - outer - 1)
                break


# if N > (26 + 26**2 + 26**3 + 26**4 + 26**5 + 26**6 + 26**7 + 26**8 + 26**9):
#     for iter in range(25):
#         if N < (26 + 26**2 + 26**3 + 26**4 + 26**5 + 26**6 + 26**7 + 26**8) +iter * 26**9:
#             S += chr(97+iter)
#             N -= iter * 26**9
#             break



print(S)

Fixed code:
N = int(input()) 
S = ''
K = (26 + 26**2 + 26**3 + 26**4 + 26**5 + 26**6 + 26**7 + 26**8 + 26**9 + 26**10+ 26**11)

for outer  in range(11):
    K -= 26**(11 - outer)
    # print(K)
    if N > K:
        
        for iter in range(27):
            if N <= K + (iter) * 26**(11 - outer -1 ):
                S += chr(97+iter - 1)
                N -= (iter) * 26**(11 - outer - 1)
                break


# if N > (26 + 26**2 + 26**3 + 26**4 + 26**5 + 26**6 + 26**7 + 26**8 + 26**9):
#     for iter in range(25):
#         if N < (26 + 26**2 + 26**3 + 26**4 + 26**5 + 26**6 + 26**7 + 26**8) +iter * 26**9:
#             S += chr(97+iter)
#             N -= iter * 26**9
#             break



print(S)
Buggy code:
n=int(input())

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

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

Fixed code:
n=int(input())

ans = ''
while n:
    tmp = (n-1)%26
    ans += chr(ord('a')+tmp)
    n-=1
    n//=26
print(ans[::-1])
Buggy code:
n=int(input())
n-=1
i=26
c=1
while n-i>0:
    n-=i
    i*=26
    c+=1
al=list('abcdefghijklmnopqrstuvwxyz')
ans=[]
for i in range(c):
    ans.append(al[n%26])
    n=n//26
ans.reverse()
print(''.join(ans))

Fixed code:
n=int(input())
n-=1
i=26
c=1
while n-i>=0:
    n-=i
    i*=26
    c+=1
al=list('abcdefghijklmnopqrstuvwxyz')
ans=[]
for i in range(c):
    ans.append(al[n%26])
    n=n//26
ans.reverse()
print(''.join(ans))
Buggy code:
n = int(input())
ans = ""
while n > 0 :
    n -= 1
    ans += chr(ord("a") + n%26)
    n = n//26
print(ans)




Fixed code:
n = int(input())
ans = ""
while n > 0 :
    n -= 1
    ans += chr(ord("a") + n%26)
    n = n//26
print(ans[::-1])
Buggy code:
n=int(input(''))
a=1
t=[]
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']
n=n-1
while(1):
    b=n%(26)
    t.append(b)
    n=n-b-1
    n=int(n/26)
    if n==0:
        break
    
t.reverse()

s=''
for a in range(len(t)):
    s=s+l[t[a]]

print(s)

Fixed code:
n=int(input(''))
t=[]
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']
n=n-1
while(1):
    b=n%(26)
    t.append(b)
    n=n-b-1
    if n<=0:
        break
    n=int(n/26)
    
t.reverse()
 
s=''
for a in range(len(t)):
    s=s+l[t[a]]
 
print(s)
Buggy code:
from collections import deque

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

def main():
    N = int(input()) - 1
    q = deque([])
    v = N % 26
    q.appendleft(v)
    N //= 26
    while N > 0:
        v = (N - 1) % 26
        q.appendleft(v)
        N //= 26
    # print(q)
    if q[0] == 0:
        q.popleft()
    print(''.join(map(to_char, q)))

if __name__ == '__main__':
    main()


Fixed 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()
Buggy code:
N = int(input())
name = []
while N > 26:
    name.append(N%26)
    N = int(N / 26)
name.append(N)

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

swap_name = []
for i in range(len(name)):
    swap_name.append(swap(name[len(name)-i-1]))
print(*swap_name, sep="")

print(26**13)


Fixed code:
N = int(input())
name = []
N = N - 1
while N >= 26:
    name.append(N % 26)
    N = int(N / 26) - 1
name.append(N)

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

swap_name = []
for i in range(len(name)):
    swap_name.append(swap(name[len(name)-i-1]))
print(*swap_name, sep="")