Problem p02629 (python)

Fixed submission:
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
 
def solve(n):
	#n = readInt()
	i = 1
	maxk = 26
	while 1:
		if n<=maxk:
			ke = i
			break
		else:
			i+=1
			maxk =maxk + 26**i
	#print(ke)
	#ke 桁数
	tar = n
	l= []
	while 1:
		a = tar//26
		b = tar%26
		if b==0:
			a-=1
			b = 26
		l.append(chr(ord("a")-1+b))
		tar = a
		if tar==0:
			break
 
	print("".join(l[::-1]))
 
solve(readInt())
#for i in range(1,1000000,26**2):
#	print(i)
#	solve(i)

Buggy submission (verdict: Runtime Error):
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
 
def solve(n):
	#n = readInt()
	i = 1
	maxk = 26
	while 1:
		if n<=maxk:
			ke = i
			break
		else:
			i+=1
			maxk =maxk + 26**i
	#print(ke)
	#ke 桁数
	tar = n
	l= []
	while 1:
		if tar<=26:
			l.append(tar)
			break
		else:
			t = tar%(26**(i-1))
			#t = tar//(26**(i-1))
			t = (tar-t)//(26**(i-1))
			t = min(t,26)
			if t==0:
				l[-1]-=1
				t=26
			l.append(t)
			tar = tar - t*(26**(i-1))
			i-=1
 
	print("".join([chr(96+i) for i in l]))
 
solve(readInt())
#for i in range(1,1000000,26**2):
#	print(i)
#	solve(i)

Buggy submission (verdict: Runtime Error):
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
 
def solve(n):
	#n = readInt()
	i = 1
	maxk = 26
	while 1:
		if n<=maxk:
			ke = i
			break
		else:
			i+=1
			maxk =maxk + 26**i
	#print(ke)
	#ke 桁数
	tar = n
	l= []
	while 1:
		if tar<=26:
			l.append(tar)
			break
		else:
			t = tar%(26**(i-1))
			#t = tar//(26**(i-1))
			t = (tar-t)//(26**(i-1))
			t = min(t,26)
			if t==0:
				l[-1]-=1
				t=26
			l.append(t)
			tar = tar - t*(26**(i-1))
			i-=1
 
	print("".join([chr(96+i) for i in l]))
 
solve(readInt())
#for i in range(1,1000000,26**2):
#	print(i)
#	solve(i)

Buggy submission (verdict: Runtime Error):
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
 
def solve(n):
	#n = readInt()
	i = 1
	maxk = 26
	while 1:
		if n<=maxk:
			ke = i
			break
		else:
			i+=1
			maxk =maxk + 26**i
	#print(ke)
	#ke 桁数
	tar = n
	l= []
	while 1:
		if tar<=26:
			l.append(tar)
			break
		else:
			t = tar%(26**(i-1))
			#t = tar//(26**(i-1))
			t = (tar-t)//(26**(i-1))
			t = min(t,26)
			if t==0:
				l[-1]-=1
				t=26
			l.append(t)
			tar = tar - t*(26**(i-1))
			i-=1
 
	print("".join([chr(96+i) for i in l]))
 
solve(924093)
#for i in range(1,1000000,26**2):
#	print(i)
#	solve(i)

Buggy submission (verdict: Runtime Error):
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

def solve(n):
	#n = readInt()
	i = 1
	maxk = 26
	while 1:
		if n<=maxk:
			ke = i
			break
		else:
			i+=1
			maxk =maxk + 26**i
	#print(ke)
	#ke 桁数
	tar = n
	l= []
	while 1:
		if tar<=26:
			l.append(tar)
			break
		else:
			t = tar%(26**(i-1))
			#t = tar//(26**(i-1))
			t = (tar-t)//(26**(i-1))
			t = min(t,26)
			if t==0:
				l[-1]-=1
			t=26
			l.append(t)
			tar = tar - t*(26**(i-1))
			i-=1

	print("".join([chr(96+i) for i in l]))

solve(924093)
#for i in range(1,1000000,26**2):
#	print(i)
#	solve(i)