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):
def gcn(a,b):
    if a == 0:
        return b
    else:
        return gcn(b%a,a)
dat = input()
dat = dat.split(" ")
print(gcn(int(dat[0]),int(dat[1])))

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

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

Solution (Python):

def gcd(m,n):
	while not n == 0:
		tmp = n
		n = m % n
		m = tmp
	return m
x,y = map(int, tuple(input().split(' ')))
print(gcd(x,y))

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

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