Linear Congruences by hallvabo

n=()
while 1:
 s=raw_input();i=0;j=1
 if s:n+=map(int,[s[4:6],s[11:-1]]),;continue
 while(i<2e4)*any(i%b-a for a,b in n):i+=1
 for _,e in n:
\x09a=j;b=e
\x09while b:a,b=b,a%b
\x09j*=e/a
 print(`i`+" + %uk"%j,'no solutions')[i>1e4];n=()

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

download

return top