import sys,re SQRT=lambda x:x**.5 def R(v):r=int(v[1:])-1;c=ord(v[0])-65;s[r][c]=a=G(s[r][c]);return float(a) G=lambda v:"="==v[:1]and`eval(re.sub("([A-Z]\d+)","R('\\1')",v[1:]))`or v s=[l[:-1].split("\t")for l in sys.stdin] for l in s: o="" for v in l: \x09try:g=G(v);f=round(eval(g),2);g=("%"+"is"[f%1>0])%f;z \x09except:o+="\t"+g print o[1:]
Note that non-ascii characters in the above source code will be escaped (such as \x9f).