0
def fact(y):
    if y == 1 or y == 0:
        return 1
    else:
        return y*fact(y-1)

x,n= map(int,input().split())

f = fact(n)%10
l = x**f

print(l%10)

It was getting submitted partially.

khelwood
  • 55,782
  • 14
  • 81
  • 108
Akhil Matcha
  • 25
  • 1
  • 4
  • 1
    What is the exact error you get and what are the inputs that you provide to the code that produce the error? – Hamatti May 23 '20 at 15:40

1 Answers1

0

most likely value of y is greater than 10^4. python's recursion stack space is 10^4. if this space runs out compiler throws nzec this can be prevented by adding this.set the limit according to the max length of y.

from sys import setrecursionlimit
setrecursionlimit(10**9)

Add constraints from next time.

Phoenix009
  • 30
  • 6