Problem:
Problem A: Greatest Common Divisor Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task. Input The input file consists of several lines with pairs of two natural numbers in each line. The numbers do not exceed 100000. The number of pairs (datasets) is less than 50. Output Your program has to print the greatest common divisor for each pair of input numbers. Print each result on a new line. Sample Input 57 38
60 84 Output for the Sample Input 19
12

Solution (Python):
def gcd(m,n):  
    while m%n>0:
        m,n=n,m%n
    else:
        return n
        
while True:
    try:
        m,n = map(int,raw_input().split())
        print gcd(m,n)
    except EOFError:
        break

Solution (Python):
from fractions import gcd
while 1:
    try:
        a, b = map(int, raw_input().split())
        print gcd(a, b)
    except:
        break

Solution (Python):
def greatestCommonDivisor(num1, num2):
	if num1 % num2 == 0 : return num2
	return num1 % num2

while True:
	try:
		a,b = map(int,raw_input().split())
	except EOFError:
		break
	
	while a != b:
		if a > b:
			a = greatestCommonDivisor(a, b)
		elif b > a:
			b = greatestCommonDivisor(b, a)
			
	print a

Solution (Python):
while True:
    try:
        a, b= map(int, input().split())
        while b!= 0:
            a, b= b, a%b
        print(a)
    except:
        break

Solution (Python):
while 1:
    try:a,b=map(int,input().split())
    except:break
    while b:a,b=b,a%b
    print(a)

Solution (Python):
import fileinput

for a, b in (map(int, line.split()) for line in fileinput.input()):
    if a > b:
        a, b = b, a
    while a:
        a, b = b % a, a
    print(b)

Solution (Python):
def gcd(x, y):
    if y==0: return x
    z = x % y
    return gcd(y, z)
        
while True:
    try:
        a, b = (int(i) for i in input().split())
    except EOFError:
        break
    if a<b: print(gcd(b,a))
    else: print(gcd(a,b))

Solution (Python):

"""


"""
import sys
from sys import stdin
import fractions
input = stdin.readline


def main(args):
    for line in stdin:
        n, m = map(int, line.split())
        print(fractions.gcd(n, m))



if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
from math import gcd
from sys import stdin

for line in stdin:
    a,b = [int(i) for i in line.split()]
    print(gcd(a,b))

Solution (Python):
import sys

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

List = []
for i in sys.stdin:
    List.append(i)

for data in List:
    print(gcd(int(data.split()[0]),int(data.split()[1])))

Solution (Python):
import math

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(len(N)):
    a,b = [int(i) for i in N[l].split()]
    print(math.gcd(a, b))

Solution (Python):
import sys
for e in sys.stdin:
    p, q = map(int, e.split())
    if p < q:p, q = q, p
    while True:
        if p % q == 0:
            print(q)
            break
        else:
            p, q = q, p % q

Solution (Python):



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

while True:
	try: a, b = map(int, input().split())
	except: break
	print(gcd(a, b))

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

def lcm(a,b):
  return a*b / gcd(a,b)

while True:
  try:
    a = map(int,raw_input().split())
    a,b = a[0],a[1]
    print gcd(a,b)
  except EOFError:
    break

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

def lcm(a,b):
  return a*b / gcd(a,b)

while True:
  try:
    a = map(int,raw_input().split())
    a,b = a[0],a[1]
    print gcd(a,b)
  except EOFError:
    break

Solution (Python):
import fractions                                                                 
while True:
    try:
        a,b=map(int,raw_input().split())
    except EOFError:
	break
    print fractions.gcd(a,b)

Solution (Python):
import sys
for s in sys.stdin.readlines():
    m,n = map(int, s.split())
    if n>m: n,m=m,n
    while 1:
        r = m%n
        if r==0: break
        m,n = n,r
    print n

Solution (Python):

while True:
  try:
    a, b = sorted(map(int, raw_input().split()))
    while a:
      tmp = a
      a = b % a;
      b = tmp
    print b
  except EOFError:
    break

Solution (Python):
def gmd(x, y):
    if y == 0:
        return x
    else:
        return gmd(y, x%y)
        
while True:
    try:
        a, b = map(int, raw_input().split())
        print gmd(a,b)
    except:
        break

Solution (Python):
def main():

    while True:
        try:

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

        except EOFError as e:
            break

def euclid_algorithm(a, b):

    while a and b:

        if a > b:
            a = a - b
        else:
            b = b - a

    return a if a else b

if __name__ == '__main__':
    main()

Solution (Python):
import math
while 1:
    try:
        a,b = map(int,input().split())
        print(math.gcd(a,b))
    except:
        break

Solution (Python):
import math
try:
    while True:
        a,b = input().split(" ")
        print(math.gcd(int(a),int(b)))
except EOFError:
    m = 0

Solution (Python):
import math
while True:
    try:print(math.gcd(*map(int,input().split(" "))))
    except:break