I wrote the following two codes

 FCTRL2.py
----------

```
import sys;
def fact(x):
    res = 1
    for i in range (1,x+1):
        res=res*i
    return res;

t = int(raw_input());
for i in range (0,t):
    print fact(int(raw_input()));

```

and 

AP2.py
------

```
import sys;

t = int(raw_input());
for i in range (0,t):
    x,y,z = map(int,sys.stdin.readline().split())
    n = (2*z)/(x+y)
    d = (y-x)/(n-5)
    a = x-(2*d)
    print n
    for j in range(0,n):
        sys.stdout.write(a+j*d)
        sys.stdout.write(' ')
    print' '

```

FCTRL2.py is accepted on spoj whereas AP2.py gives NZEC error. Both work fine on my machine and i do not find much difference with regard to returning values from both. Please explain what is the difference in both and how do i avoid NZEC error for AP2.py