fork download
  1. x=int(input())
  2. y=int(input())
  3. while x!=y:
  4. if x>y: x=x-y
  5. else: y=y-x
  6. print(x)
  7.  
Success #stdin #stdout 0.11s 13968KB
stdin
40
16
stdout
8