def fac(number): fact = 1 for n in range(1, number): fact = fact*(n + 1) return fact def main(): import time import sys mul=0 f=open("in1_6.txt","r") f1=open("out_3_sec1_6.txt","a+") start=time.clock() temp=[] temp1=[] f.readline() m=0 for i2 in f.readlines(): temp=i2.split(",") n=fac(int(temp[0])) k=fac(int(temp[1])) r=fac(int(temp[2])) res=(n*k)/r mul=mul+1 print res f1.write(str(res)+"\n") el=time.clock()-start print el total=sys.getsizeof(res)+sys.getsizeof(n)+sys.getsizeof(k)+sys.getsizeof(r) print total f1.write("time "+str(el)+"\nmemory "+str(total)+'\nmultiplication '+str(mul)) f.close() f1.close() main()