Problem:
Greatest Common Divisor Write a program which finds the greatest common divisor of two natural numbers a and b  Input  a and b are given in a line sparated by a single space. Output Output the greatest common divisor of a and b . Constrants 1 ≤ a , b ≤ 10 9  Hint You can use the following observation: For integers x and y , if x ≥ y , then gcd( x , y ) = gcd( y , x % y ) Sample Input 1 54 20 Sample Output 1 2 Sample Input 2 147 105 Sample Output 2 21

Solution (Python):
x,y = map(int, input().split())
while True:
   if x<y:
      z = y
      y = x
      x = z
   k = x%y
   if k==0:
      break
   x = y
   y = k
print(y)

Solution (Python):
import fractions as fra
x,y=map(int,input().split())
print(fra.gcd(x,y))

Solution (Python):
import math

v = [int(d) for d in input().split(" ")]

print(math.gcd(v[0], v[1]))

Solution (Python):
import math
x,y=map(int,input().split())
print(math.gcd(x,y))

Solution (Python):
import fractions
a, b = map(int, input().split())
print(fractions.gcd(a, b))

Solution (Python):

a, b = map(int, input().split())

while b > 0:
    if a < b:
        a, b = b, a
    a, b = b, a % b
print(a)

Solution (Python):



def calc(a, b):
    if a < b:
        a,b = b,a
    if b == 0:
        return a
    return calc(b, a%b)


A, B = map(int, input().split())
print(f'{calc(A, B)}')

Solution (Python):
a,b=map(int,input().split())
import math
print(math.gcd(a,b))

Solution (Python):
from math import gcd
x, y = map(int,input().split())
print(gcd(x,y))

Solution (Python):
a, b = map(int, input().split(' '))
if a < b :
    a, b = b, a
while True:
    if b == 0:
        print(a)
        break
    a, b = b, a %b

Solution (Python):
def gozyo(x,y):
    while True:
        if y == 0:
            return x
        x = x % y
        z = x
        x = y
        y = z
    
a,b = map(int,input().split())
if a < b:
    c = a
    a = b
    b = c
print(gozyo(a,b))

Solution (Python):
a,b = map(int,input().split())
if a < b:
    a,b = b,a
while b != 0:
    c = a % b
    a,b = b,c
print(a)

Solution (Python):
x, y = map(int,input().split())

if x < y:
    x, y = y, x
while x % y != 0:
    x, y = y, x % y

print(y)

Solution (Python):
x,y=map(int,input().split())
if y>x: x,y=y,x

while x%y!=0:
    m=x%y
    x,y=max(y,m),min(y,m)

print(y)

Solution (Python):
import math
x, y = map(int, input().split())
print(math.gcd(x, y))

Solution (Python):
m, n = map(int, input().split())
x = max(m, n)
y = min(m, n)
while y > 0:
    temp = y
    y = x % y
    x = temp
print(x)

Solution (Python):
x,y=map(int,input().split())
if x<y:
    x,y=y,x
while y>0:
    r=x%y
    x=y
    y=r
print(x)

Solution (Python):
def gcd(x,y):
    if x >= y:
        r = x % y
        if r == 0:
            return y
        return gcd(y,r)
    else:
        r = y % x
        if r == 0:
            return x
        return gcd(x,r)

a = list(map(int,input().split()))

print(str(gcd(a[0],a[1])))

Solution (Python):
def gcm(x, y):
    if x < y:
        x, y = y, x
    if  x % y == 0:
        return y
    else:
        return gcm(y, x % y)

x, y = map(int, input().split())
print(gcm(x, y))

Solution (Python):
x, y = map(int,input().split())

if x < y:
    x, y = y, x


while y > 0:
    r = x % y
    x = y
    y = r

print(x)

Solution (Python):
import math
x,y=map(int,input().split())

print(math.gcd(x,y))

Solution (Python):
x,y=map(int, input().split())

if x<y:
    x,y=y,x

while y!=0:
    x=x%y
    x,y=y,x

print(x)

Solution (Python):
x, y = map(int,input().split())
if x > y:
    x, y = y, x
while x % y != 0:
    x, y = y, x % y
print(y)

Solution (Python):
x, y = map(int,input().split())
if x<y:
    a = x
    x = y
    y = a

while y>0:
    r = x%y
    x = y
    y = r
print(x)

Solution (Python):
import math

x,y = map(int,input().split())
print(math.gcd(x,y))

Solution (Python):
a, b = map(int, input().split())

if b > a:
    a, b = b, a

while a % b != 0:
    a, b = b, a%b

print(b)

Solution (Python):
from math import gcd
a, b = map(int, input().split())
print(gcd(a, b))

Solution (Python):
from fractions import gcd
a,b = map(int,input().split())
print(gcd(a,b))

Solution (Python):
import sys
input = sys.stdin.readline


def gcd(x: int, y: int) -> int:
    if x < y:
        x, y = y, x
    while y > 0:
        r = x % y
        x, y = y, r
    return x


def main():
    X, Y = [int(i) for i in input().strip().split()]
    print(gcd(X, Y))


if __name__ == "__main__":
    main()

Solution (Python):
import math
x,y=list(map(int,input().split()))
print(math.gcd(x,y))

Solution (Python):



x,y = map(int,input().split())

if x<y:
    x,y = y,x
while x%y != 0:
    x,y = y,x%y
print(y)

Solution (Python):
a,b = map(int, open(0).read().split())

a,b = max(a,b), min(a,b)

while b:
    a,b = b,a%b

print(a)

Solution (Python):
a, b = map(int, input().split())
if a < b:
    a, b = b, a
while a % b != 0:
    a, b = b, a % b
print(b)

Solution (Python):
import math
x,y=map(int,(input().split()))
print(math.gcd(x,y))

Solution (Python):
import fractions


a,b=map(int,input().split())
if a<b:
    a,b=b,a
while a%b !=0:
    a,b =b,a%b
print(b)

Solution (Python):
import fractions
x,y=map(int,input().split())
print(fractions.gcd(x,y))

Solution (Python):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd,numbers)
    
x,y=map(int,input().split())
k=0
if x<y:
    k=x
    x=y
    y=k

z=x%y

n=(gcd(y,z))
print(n)

Solution (Python):
x, y = map(int, input().split())
x, y = max(x, y), min(x, y)


while True:
    if x % y == 0:
        break
    else:
        x, y = max(y, x % y), min(y, x % y)
        

print(y)

Solution (Python):
x, y = map(int, input().split())

def gcd(a, b):
    if a < b:
        return gcd(b, a)
    elif b == 0:
        return a
    elif b == 1:
        return 1
    else:
        return gcd(b, a % b)

print(gcd(x, y))

Solution (Python):
def greatest_common_divisor(a, b):
    a, b = max(a, b), min(a, b)
    while b != 0:
        a, b = b, a % b
    return a


if __name__ == '__main__':
    a, b = list(map(int, input().split()))
    print(greatest_common_divisor(a, b))

Solution (Python):
x,y = map(int, input().split())

if x < y:
    x,y = y,x

while y > 0:
    r = x % y
    x,y = y,r
    
print(x)

Solution (Python):
def gcd(x,y):
    if x < y:
        x,y = y,x
    if y == 0:
        return x
    return gcd(y,x%y)

x,y = map(int,input().split())
ans = gcd(x,y)
print(ans)

Solution (Python):
import fractions
x, y = map(int,input().split())
print(fractions.gcd(x, y))

Solution (Python):
import math

a, b =map(int, input().split())

print(math.gcd(a,b))

Solution (Python):

import fractions
x , y = map(int,input().split())
print(fractions.gcd(x,y))

Solution (Python):
from fractions import gcd
a,b=map(int,input().split())
print(gcd(a,b))

Solution (Python):
x,y = map(int, input().split())

if y > x:
    tmp = y
    y = x
    x = tmp

r = y
i = x
while r != 0:
    i = r
    r = x % y
    x = y
    y = r


print(i)

Solution (Python):
def GCD(x, y):
  if x < y:
    x, y = y, x
  rem = x % y
  if rem == 0:
    return y
  else:
    return GCD(rem, y)


data = map(int, input().strip().split())
ret = GCD(*data)
print(ret)

Solution (Python):
import math
import collections
import fractions
import itertools

def solve():
    x, y = map(int, input().split())
    print(math.gcd(x, y))
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
def gcd(a0, b0):
    res = 1
    a, b = min(a0, b0), max(a0, b0)

    if b % a == 0:
        res *= a
        b //= a
        a = 1

    i = 2
    while i**2 <= b0:
        if a % i == 0 and b % i == 0:
            res *= i
            a //= i
            b //= i
        else:
            i += 1

    return res


a, b = map(int, input().split())

ans = gcd(a, b)
print(ans)

Solution (Python):
x, y = map(int,input().split())
    
if x < y:
    (x, y) = (y, x)
   
while 1:
    if y == 0:
        print(x)
        break

    z = x % y
    x = z
    (x, y) = (y, x)

Solution (Python):
def gcd(x, y):
    while y > 0:
        tmp = x % y
        x = y
        y = tmp
    return x


x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
def gcd(a, b):
    if a > b:
        a, b = b, a
    if a == 0:
        return b
    return gcd(b % a, a)


x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
import math
x,y=map(int,input().split())
print(math.gcd(x,y))

Solution (Python):
def gcd(x,y):
    if y==0:
        return x
    r=x%y
    while r!=0:
        x=y
        y=r
        r=x%y
    return y

x,y=map(int,input().split())
print(gcd(x,y))

Solution (Python):
from math import gcd
x, y = map(int, input().split())


print(gcd(x,y))

Solution (Python):
from math import gcd

n, m = map(int, input().split())
print(gcd(n, m))

Solution (Python):



def gcd(x,y):
    if x<y:
        x,y=y,x
    while y>0:
        r=x%y
        x=y
        y=r
    return x

a=list(map(int,input().split(" ")))
print(gcd(a[0],a[1]))

Solution (Python):
import sys
from fractions import gcd

input = sys.stdin.readline


def main():
    x, y = map(int, input().split())

    ans = gcd(x, y)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

import math

x, y = map(int, input().split())
print(math.gcd(x,y))

Solution (Python):
x,y = map(int,input().split())

if x < y:
    x,y = y,x

while 1:
    if y == 0:
        print(x)
        break
    x,y = y,x%y

Solution (Python):
from math import gcd
a, b = map(int, input().split())
print(gcd(a,b))

Solution (Python):
def gcd(x,y):
    if x<y:
        x,y=y,x
    while y>0:
        r=x%y
        x=y
        y=r
    
    return x

x,y=map(int,input().split())
print(gcd(x,y))

Solution (Python):
x, y = map(int, input().split())
if x - y < 0:
    temp = x
    x = y
    y = temp

while True:
    surplus = x % y
    if surplus == 0:
        break
    x=y
    y=surplus
print(y)

Solution (Python):

from sys import stdin

def greatest_common_divisor3(x, y):
  xx = max(x, y)
  yy = min(x, y)
  v1 = xx % yy
  
  if yy <= 0 or v1 <= 0:
    return max(yy, v1)
  else:
    return greatest_common_divisor3(yy, v1)

x_y = list(map(int, stdin.readline().split()))
print(greatest_common_divisor3(x_y[0], x_y[1]))

Solution (Python):




N,M = map(int,input().split())

def euclid(N,M):
    
    if M > N:
        N,M = M,N
    while M > 0:
        r = N % M
        N = M
        M = r
        
    return N
    
ans = euclid(N,M)
print(ans)

Solution (Python):
from fractions import gcd
a,b=map(int,input().split())
print(gcd(a,b))

Solution (Python):
x, y = map(int, input().split())

if x < y:
    x, y = y, x

div = x % y
while div != 0:
    x, y = y, div
    div = x % y
    
print(y)

Solution (Python):
x,y=map(int,input().split())
if x>y:
  a=x
  b=y
else:
  a=y
  b=x
while 1:
  t=a%b
  if t==0:
    break
  a=b
  b=t
print(b)

Solution (Python):

import math
x, y = map(int, input().split())
print(math.gcd(x, y))

Solution (Python):
import math
a,b=map(int,input().split())
print(math.gcd(a,b))

Solution (Python):
x, y = map(int,input().split())

"""
n = min(x,y)
for d in range(n, 0, -1):
    if x % d == 0 and y % d == 0:
        print(d)
        break
"""

if x < y:
    x, y = y, x

while y > 0:
    r = x % y
    x = y
    y = r
print(x)

Solution (Python):
a, b = map(int,input().split())

def gcp(x, y):
    while min(x, y) != 0:
        if x < y:
            x, y = y, x
        x = x % y
    return max(x, y)

print(gcp(a,b))

Solution (Python):
a,b=map(int,input().split())
while b>0:
    if a<b:
        a,b=b,a
    a,b=b,a%b
print(a)

Solution (Python):
import math

x,y=map(int,input().split())

print(math.gcd(x,y))

Solution (Python):
x, y = map(int, input().split())


def gcd(x, y):
    lg = max(x, y)
    sm = min(x, y)
    div = True
    while div:
        lg_temp = sm
        sm = lg % sm
        lg = lg_temp
        if sm == 0:
            div = False
            return lg_temp




print(gcd(x, y))

Solution (Python):
def gcd(a,b):
    if a<b:
        a,b=b,a
    if b==0:
        return a
    return gcd(b,a%b)
    
a,b=map(int,input().split())
g=0
g=gcd(a,b)
print(g)

Solution (Python):
import sys
input = sys.stdin.readline

def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x % y)
    
if __name__ == "__main__":
    x,y = map(int,input().split())
    print(gcd(x,y))

Solution (Python):
def gcd(x, y):
    z = max(x, y)
    d = min(x, y)

    i = 1
    while z % d*i != 0:
        
        
        if z >= d*(i+1):
            i += 1
            continue
        else:
            z, d = d, z - d*i
            i = 1
        
    
    return d

x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
def gcd(x, y):
    m = max(x, y)
    n = min(x, y)
    while n != 0:
        tmp = n
        n = m % n
        m = tmp
    return m


def resolve():
    x, y = [int(i) for i in input().split()]
    print(gcd(x, y))


resolve()

Solution (Python):



def gcd(x, y):
   if x % y == 0:
      return y
   else:
      return gcd(y, x % y)

x, y = map(int, input().split())
if x < y:
   x, y = y, x

print(gcd(x, y))

Solution (Python):
N, M = map(int, input().split())
while True :
    if N < M :
        N, M = M, N
    amari = N % M
    if amari == 0 :
        break
    else :
        N, M = M, amari
print(M)

Solution (Python):
x,y = map(int, input().split())

while min(x,y)>0:
    if x<y:
        x,y = y,x
    x = x%y

ans = y
print(y)

Solution (Python):
x,y = [int(i) for i in input().split()]
gcd = 1

while x % y != 0:
    a = y
    y = x % y
    x = a

print(y)

Solution (Python):

import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


N, M = map(int, input().split())
print(gcd(N, M))

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect
import functools

x,y = map(int,input().split())
a = math.gcd(x,y)
print(a)

Solution (Python):
from fractions import gcd

a,b = (int(x) for x in input().split())
ans = gcd(a,b)
print(ans)

Solution (Python):
x,y = map(int, input().split())
mx =  max(x,y)
mn = min(x,y)

def GCD(large, small):
    if small == 0:
        return large;
    else:
        return GCD(small, large%small)


print(GCD(mx, mn))

Solution (Python):
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a
    
x,y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
def gcd(x: int, y: int) -> int:
    if x % y == 0:
        return y
    return gcd(y, x % y)


def main():
    x, y = map(int, input().split())
    if x < y:
        x, y = y, x
    result = gcd(x, y)
    print(result)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    x, y = LI()

    def gcd(x, y):
        if x<y:
            x, y = y, x
        if x%y==0:
            return y
        else:
            return gcd(y, x%y)

    print(gcd(x, y))

if __name__ == '__main__':
    resolve()

Solution (Python):
x, y = map(int,input().split(' '))

def gcd(x, y):
    new_x = max(x, y)
    new_y = min(x, y)
    while new_y > 0:
        r = new_x % new_y
        new_x = new_y
        new_y = r
    return new_x

print(gcd(x, y))

Solution (Python):
import math
x, y = map(int, input().split())
print(math.gcd(x, y))

Solution (Python):
x,y=map(int,input().split())
if y>x:
    x,y=y,x
while True:
    z=x%y
    if z==0:
        break
    else:
        x=y
        y=z
print(y)

Solution (Python):
def gcd(a,b):
    if a<b:
        a,b=b,a
    while b>0:
        a=a%b
        a,b=b,a
    return a
A = list(map(int, input().split()))

print(gcd(A[0],A[1]))

Solution (Python):

import math
a,b = map(int,input().split())

print(math.gcd(a, b))

Solution (Python):
x, y = map(int, input().split())


def gcd(x, y):
    if x < y:
        return gcd(y, x)
    if x % y == 0:
        return y
    return gcd(y, x % y)


print(gcd(x, y))

Solution (Python):
def gcd(x, y):
    if x < y:
        x, y = y, x
    
    while 0 < y:
        x, y = y, x % y

    return x

X, Y = map(int, input().split())
print(gcd(X, Y))

Solution (Python):
import math
x,y=map(int,input().split())
print(math.gcd(x,y))

Solution (Python):
def gcd(a, b):
    if b > a:
        a, b = b, a
    if a%b != 0:
        return gcd(b, a%b)
    else:
        return b
        
x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
x,y = map(int, input().split())
a,b = max(x,y), min(x,y)
while a % b != 0:
    a,b = b, a % b
print(b)

Solution (Python):
x,y  = list(map(int,input().split()))
if x < y:
    dummy = x
    x=y
    y=dummy
while x % y != 0:
    z = x%y
    x = y
    y = z
print(y)

Solution (Python):
def euclid(x : int , y : int):
    if y > x:
        x , y = y , x
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

a , b = map(int,input().split(' '))
print(euclid(a,b))

Solution (Python):
x,y = map(int,input().split())

if x == y:
    print(x)
else:
    while not (x == 1 and y == 1):
        if x > y:
            x = x % y
            if x == 0:
                print(y)
                break
            
        elif x < y:
            y = y % x
            if y == 0:
                print(x)
                break
            
    '''
    else:

        
        divisor_x = []
        for a in range(x):
            if x % (a+1) == 0:
                divisor_x.append(a+1)

        for a in divisor_x[::-1]:
            if y % a == 0:
                print(a)
                break
    '''

Solution (Python):

def gcd(x, y):
    if x < y:
        x, y = y, x
    while y > 0:
        x, y = y, x%y
    return x


x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
a, b = map(int, input().split())
def gcd(n, m):
  c = n % m
  if c ==0:
    return m
  else:
    return gcd(m, c)

if b > a:
  a, b = b, a
print(gcd(a, b))

Solution (Python):
li = list(map(int,input().split()))
li.sort(reverse=True)
while li[0] % li[1] != 0:
  temp = li[1]
  li[1] = li[0] % li[1]
  li[0] = temp
print(li[1])

Solution (Python):
import sys
import math
import itertools

def gcd(x,y):
  if x < y:
    tmp = x
    x = y
    y = tmp

  rem = x % y
  if rem == 0:
    return y
  else:
    return gcd(y, rem)

def main():
  x,y = map(int, input().split())

  print(gcd(x,y))


if __name__ == '__main__':
  main()

Solution (Python):
import math 
num_list = list(map(int,input().split())) 
print(math.gcd(num_list[0],num_list[1]))

Solution (Python):
x, y = map(int, input().split())

while x != y:
    if x < y:
        w = x
        x = y
        y = w
    x = x % y
    if x == 0:
        break

print(y)

Solution (Python):
x,y=map(int,input().split())
if x<y:
    x,y=y,x
while x%y!=0:
    x,y=y,x%y

print(y)

Solution (Python):
inparray = list(map(int, input().split()))
inparray.sort(reverse=True)
a, b = inparray[0], inparray[1]

while True:

	if a % b == 0:
		print(b)
		exit(0)
	else:
		a, b = b, a % b

Solution (Python):
a, b = map(int, input().split())

while b > 0:
    if a < b:
        a, b = b, a
    a, b = b, a % b
print(a)

Solution (Python):
def gcd(a,b):
    while b != 0:
        a,b = b,a % b
    return a

x,y = map(int,input().split())    
x,y = max(x,y),min(x,y)
print(gcd(x,y))

Solution (Python):
def gcd(x,y):
    return x if y == 0 else gcd(y, x % y)
    

x,y = map(int, input().split())
print(gcd(x,y))

Solution (Python):
import math

x, y = map(int, input().split())

print(math.gcd(x, y))

Solution (Python):
def gcd(x, y):
    return x if y == 0 else gcd(y, x%y)

x, y = [int(x) for x in input().split()]
ans = gcd(x, y)
print(ans)

Solution (Python):
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a%b
    return b
x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
x,y=map(int,input().split())
if x<y:
    x,y=y,x
while y>0:
    v=y
    y=x%y
    x=v
print(x)

Solution (Python):
def gcd(x,y):
    if x < y:
        x,y = y,x
    while y > 0:
        r = x % y
        x = y
        y = r
    print(x)

x,y = map(int,input().split())
gcd(x,y)

Solution (Python):
def gcd(x, y):
    a = x
    b = y
    if(y > x):
        a = y
        b = x
    mod = a % b
    if (mod == 0):
        return b
    else:
        return gcd(b, mod)

def main():
    x, y = map(int, input().split())
    print(gcd(x, y))

main()

Solution (Python):

import sys
x, y = map(int, sys.stdin.readline().strip().split())


def gcd(x, y):
    if x <= y:  
        x, y = y, x

    r = -1
    while r != 0:
        r = x % y
        x = y
        y = r
    return x


print(gcd(x, y))

Solution (Python):

x,y = map(int,input().split())

while y != 0:
    if x >= y:
        x,y = y,x%y
    else:
        x,y = y,x

print(x)

Solution (Python):

def generate_number(a, b):
  if b == 0:
    return a
  else:
    return generate_number(b, a % b)


num = input("")
lst_num = num.split()
print(generate_number(int(lst_num[0]),int(lst_num[1])))

Solution (Python):
def sub_GCD(x, y):
    if x > y:
        return y, x % y
    else:
        return x, y % x

def GCD(x, y):
    while not (x==0 or y==0):
        x, y = sub_GCD(x, y)
    print(x)

x, y = map(int, input().split())
GCD(x, y)

Solution (Python):
x,y = map(int,input().split())

def divs(n:int):
    divs = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    return divs

print (max(set(divs(x))&set(divs(y))))

Solution (Python):

def gcd(a,b):
  if a % b == 0:
    return b
  else:
    return gcd(b,a % b)
    
x, y = map(int,input().split())
print(gcd(x, y))

Solution (Python):
from fractions import gcd
x,y = map(int,input().split())
print(gcd(x,y))

Solution (Python):
import math
a,b = map(int, input().split())
print(math.gcd(a,b))

Solution (Python):
a, b = map(int, input().split())

if b > a:
    a, b = b, a

mod = 1
while mod > 0:
    mod = a % b
    
    a = b
    b = mod

print(a)

Solution (Python):
def gcd(a, b):
    if b == 0:
        return a
    else:
        x, y = b, a%b
        return gcd(x, y)

a, b = map(int, input().split())
print(gcd(a, b))

Solution (Python):
x, y = map(int, input().split())

from math import gcd

print(gcd(x, y))

Solution (Python):
x,y = map(int, input().split())
b = min((x, y))
a = max((x, y)) % b
if a == 0:
    print(b)
else:
    for i in range(1, a + 1):
        if a % i == 0 and b % (a / i) == 0:
            print(int(a / i))
            break

Solution (Python):
x, y = map(int,input().split())

if x < y:
    temp = x
    x = y
    y = temp

while x > 0 and y > 0:
    temp = x % y

    if temp == 0:
        break
    x = y
    y = temp

print(str(y))

Solution (Python):


def gcd(a, b):
    if a<b:
        tmp = a
        a = b
        b = tmp
    while b>0:
        r = a % b
        a = b
        b = r
    return a


a, b = map(int, input().split())


print(gcd(a, b))

Solution (Python):
from math import gcd

n, m = map(int, input().split())
print(gcd(n, m))

Solution (Python):
def gcd(x, y):
    if x < y:
        x, y = y, x
    
    if(x == 0 or y == 0):
        if(x == 0):
            return y
        elif(y == 0):
            return x
    
    return gcd(y,x%y)
    
x,y = map(int, input().split())
print(gcd(x,y))

Solution (Python):
from math import gcd

n, m = map(int, input().split())
print(gcd(n, m))

Solution (Python):
import math
x,y = map(int,input().split())
ans = math.gcd(x,y)
print(ans)

Solution (Python):
from math import gcd
a, b = map(int, input().split())
print(gcd(a, b))

Solution (Python):
a, b = map(int, input().split())

def gcd(x, y):
                if y == 0:
                                return x
                else:
                                x %= y  
                                x, y = y, x  
                                return gcd(x, y)
print(gcd(a, b))

Solution (Python):
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if y == 0:
        return x
    else:
        return gcd(y, x%y)

if __name__ == "__main__":
    import sys
    input = sys.stdin.readline 

    a, b = list(map(int, input().split()))
    print(gcd(a, b))

Solution (Python):
x,y = map(int,input().split())
if x < y:
    x,y = y,x
while x%y != 0:
    z = x%y
    x = y
    y = z
print(y)

Solution (Python):
x, y = map(int, input().split())
if x < y:
    x, y = y, x

while True:
    x, y = y, x % y
    if y == 0:
        break
print(x)

Solution (Python):
a,b = map(int,input().split())

bigger = max(a,b)
smaller = min(a,b)
resid = smaller
while resid != 0:
    smaller = resid
    resid = bigger%smaller
    bigger = smaller
print(smaller)

Solution (Python):
x, y = sorted(list(map(int, input().split())))

while x:
    y, x = x, y%x
print(y)

Solution (Python):
def euclid(x,y):
    x = x % y
    if x == 0:
        return y
    else:
        return euclid(y,x)

x, y = map(int, input().split())
print(euclid(x,y))

Solution (Python):
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


def main():
    a, b = map(int,input().split())
    print(gcd(a,b))

main()

Solution (Python):
def gcd(x, y):
    if x < y: x, y = y, x
    while y != 0:
        x, y = y, x % y
    return x
x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

a,b = map(int,input().split())
print(gcd(a,b))

Solution (Python):
import fractions
x, y = map(int, input().split())
print(fractions.gcd(x, y))

Solution (Python):
x,y=map(int,input().split())
while(y>0):
    a=x
    x=y
    y=a%y
    
print(x)

Solution (Python):
def gcd(x, y):
  if x < y:
    x, y = y, x
  while y > 0:
    r = x % y
    x = y
    y = r

  return x

x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
def gcd(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp
    if y == 0:
        return x
    return gcd(y, x%y)

x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
x=[int(x) for x in input().split()]
if x[0] >x[1]:
    a, b = x[0], x[1]
else:
    a, b = x[1], x[0]
while(True):
    c=a%b
    if c==0:
        print(b)
        break
    a=b
    b=c

Solution (Python):
a = list(map(int, input().split()))
a = [min(a), max(a)]

while True:
    if a[0] % a[1] == 0:break
    a = [min(a), max(a) % min(a)]
print(a[1])

Solution (Python):
def gcd(a,b):
    if b == 0:return a
    return gcd(b,a%b)

def main():
    a,b = map(int,input().split())
    if a<b:a,b = b,a
    print (gcd(a,b))

if __name__ == '__main__':
    main()

Solution (Python):
x,y=map(int,input().split())
if x<y:
	t=x
	x=y
	y=t
r=x%y
while r!=0:
	x=y
	y=r
	r=x%y
print(y)

Solution (Python):
x,y = map(int,input().split())
while x%y != 0: x,y = y,x%y
print(y)

Solution (Python):
def calc_gcd(a,b):
    if a < b:
        a,b = b,a
    if b == 0:
        return a
    return calc_gcd(b,a%b)

A,B = map(int,input().split())
print(calc_gcd(A,B))

Solution (Python):
x,y=map(int,input().split())
initx=x
inity=y
while True:
    if x<y:
        x,y=y,x
    pre_gcd=x%y
    if pre_gcd==0:
        print(y)
        break
    elif initx%pre_gcd==0 and inity%pre_gcd==0:
        print(pre_gcd)
        break
    x=pre_gcd

Solution (Python):
a,b = map(int,input().split())
if a > b:
    a,b = b,a
while b%a != 0:
    a,b = b%a,a
print(a)

Solution (Python):
def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a % b)

x, y = map(int,raw_input().split())
print gcd(x,y)

Solution (Python):
def gcd(x, y):
    if x < y:
        x, y = y, x
    if x % y == 0:
        return y
    return gcd(y, x % y)
    
x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
def gcd(x, y):
    if x%y:
        return gcd(y, x%y)
    return y
    
a, b = map(int, input().split())
print(gcd(a, b))

Solution (Python):
a,b=list(map(int,input().split()))

while True:
    if a > b:
        a=a%b
    else:
        b=b%a
        
    if a==0 :
        print(b)
        break
    elif b==0:
        print(a)
        break

Solution (Python):
import math
x, y = map(int, input().split())





print(math.gcd(x, y))

Solution (Python):
def gcd(a,b):
    if a%b==0:
        return b
    if a<b:
        a,b=b,a
    return gcd(b,a%b)
x,y=map(int,input().split())
print(gcd(x,y))

Solution (Python):

x, y = map(int, input().split())


def gcd(x, y):
    if x < y:
        t = x
        x = y
        y = t
    while y > 0:
        r = x % y
        x = y
        y = r
    return x


print(gcd(x, y))

Solution (Python):
n,m = map(int,input().split())

def gcd(a,b):
    if b == 0:
        print(a)
    else:
        return gcd(b,a%b)

gcd(n,m)

Solution (Python):
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

a, b = map(int, input().split())
if a < b:
    a, b = b, a
print(gcd(a, b))

Solution (Python):
def gojo(x,y):
    if x < y:
        x , y = y, x
    while y > 0:
        r = x % y
        x = y
        y = r
    return x
x,y = map(int,input().split())
print(gojo(x,y))

Solution (Python):
def find_gcd(a, b):
    '''
    a >= b
    '''
    if a % b == 0:
        return b
    else:
        return find_gcd(b, a % b)


li = list(map(int, input().split()))

a = max(li)
b = min(li)

div = find_gcd(a, b)
print(div)

Solution (Python):

import math

a,b = list(map(int, input().split()))

print(math.gcd(a, b))

Solution (Python):
def gcd(x, y):
  if x < y: x, y = y, x
  if y <= 0: return x
  return gcd(y, x % y)  

print(gcd(*map(int, input().split())))

Solution (Python):
x,y = map(int,input().split())
if y>x:
    x,y = y,x
r = x-y
b = 0
while True:
    b = abs(y-r)
    y = r
    r = b
    if r ==y:
        break
print(y)

Solution (Python):
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while b:
        a, b = b, a % b
    return a


x, y = map(int, input().split())
print(gcd(x, y))

Solution (Python):
x,y=[int(i) for i in input().split()]

def gcd(x,y):
    if x<y:
        x,y=y,x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

print(gcd(x,y))

Solution (Python):
import fractions
x, y = map(int, input().split())
print(fractions.gcd(x, y))

Solution (Python):
import sys
input = sys.stdin.readline

x, y = sorted(map(int, input().split()))

gcd = x
while(y % x != 0):
    gcd = y % x
    y = x
    x = gcd
print(gcd)

Solution (Python):
from math import gcd

a, b = map(int, input().split())
print(gcd(a, b))

Solution (Python):
x, y = map(int, input().split())
if x < y:
    x, y = y, x
    
while x % y != 0:
    tmp = y
    y = x % y
    x = tmp
    
print(y)

Solution (Python):
a, b = map(int, input().split())

def gcd(a,b):
    if b>a:
        a, b = b, a
    
    while b>0:
        mod = a%b
        a = b
        b = mod
    
    return a

print(gcd(a,b))

Solution (Python):
def calc_gcd(a,b):
    if a < b:
        a,b = b,a
    if b == 0:
        return a
    return calc_gcd(b,a%b)
    
a,b = map(int,input().split())
print(calc_gcd(a,b))

Solution (Python):
def get_input():
    return map(lambda s: int(s), input().split(' '))

def swap(a, b):
    if a < b:
        return (a, b)
    else:
        return (b, a)

def gcd(a, b):
    while a > 0:
        r = b % a
        b = a
        a = r

    return b

print(gcd(*swap(*get_input())))

Solution (Python):
a, b = [int(item) for item in input().split()]

def gcd(a, b):
    
    while b > 0:
        a, b = b, a%b
        
    return a

print(gcd(a, b))

Solution (Python):
def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x%y)

x, y = map(int, input().split())
if y > x:
    x, y = y, x

print(gcd(x, y))