Can't resolve NZEC error in Python on codechef, Although it gave correct output on IDE

Question:

def gcd(x,y):
    while(x!=y):
        if(y != 0):
            return(gcd(y,x%y))
        else:
            return(x)
t = input()
while (t>0):
    t = t-1
    a,b,n = raw_input().split(" ")
    a=int(a)
    b=int(b)
    n=int(n)
    x = pow(a,n) + pow(b,n)
    y = a-b
    print(gcd(x,y))

Here i got NZEC(Runtime) error in codechef but if i write test cases mannually then it is work finely, So please Help…

Asked By: Khantil Sanghani

||

Answers:

For python 3

  1. Convert the t variable to int

    t=int(t)
    
  2. Change raw_input() to input().

Comment the line if you have not.

Answered By: wins999
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.