Linear Congruences by tryeng

while 1:
 a=b=();l=m=1
 while l:
\x09l=raw_input().split()
\x09if l:
\x09 s=q=int(l[4][:-1]);x=m;a+=(int(l[2]),q),
\x09 while x:s,x=x,s%x
\x09 m=m*q/s
 while 1:
\x09if all(x%q==p for p,q in a):print x,"+ %dk"%m;break
\x09if x>7e3:print"no solutions";break
\x09x+=1

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top