NZEC runtime error in python3

This solution for “the rise and fall of power (in practice(easy))” is showing NZEC error. though it runs fine in IDLE . Please help.

def main():
	t=input()
	for i in range(int(t)):
		n,k=input().split()
		pwr(n,k)
def pwr(n,k):
	s=int(n)**int(n)
	b=str(s)
	for i in range(int(k)):
		print(b[i],end="")
	print(" ",end="")
	for i in range(int(k),0,-1):
		print(b[-i],end="")
	print()
 
if _name__=="__main_":main()

Here N can range from 1 <= N <= 10^9. So value of N^N would be very large too fit in a variable even in python (so the runtime error). You certainly need a better algorithm to solve this problem rather than calculating N^N.

Hope it helps, Best Luck :slight_smile:

//