Saturday, June 16, 2018

KUSAC - Kusac : Classical

#The solution in Python 3 is as follows:

from fractions import gcd
N, M = map(int, input().split())
print (M - gcd(M, N))                              #simple formula for output


#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!