s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s122313074
p02256
u092047183
1471576283
Python
Python3
py
Accepted
20
7712
138
# coding: utf-8 def gcd(a, b): while b: a, b = b, a % b return a n, m = map(int, input().split()) print(int(gcd(n, m)))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,882
s338373859
p02256
u231136358
1471774023
Python
Python3
py
Accepted
30
7780
326
import sys import math (a, b) = tuple([int(s) for s in input().split()]) if a==b: print(a) sys.exit(0) min = a if a < b else b divisor = 1 i = 2 while i < math.sqrt(min): if a % i == 0 and b % i == 0: a = a / i b = b / i divisor = divisor * i else: i = i + 1 print(di...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,883
s228733924
p02256
u231136358
1471774872
Python
Python3
py
Accepted
20
7656
129
# 1_1_B def gcd(x, y): while x%y != 0: x, y = y, x%y return y x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,884
s589445164
p02256
u798803522
1471919248
Python
Python3
py
Accepted
30
7712
168
targ = [int(n) for n in input().split(' ')] big,small = max(targ),min(targ) while big % small != 0: disp = small small = big % small big = disp print(small)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,885
s607443886
p02256
u510829608
1472048202
Python
Python3
py
Accepted
50
7648
73
a,b = map(int,input().split()) while a % b != 0: a,b = b, a % b print(b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,886
s406662275
p02256
u811773570
1473840544
Python
Python3
py
Accepted
30
7660
125
x, y = map(int, input(). split()) while True: if x % y == 0: break tmp = x % y x = y y = tmp print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,887
s744204225
p02256
u890722286
1473973756
Python
Python3
py
Accepted
20
7660
142
a, b = map(int, input().split()) if a < b: t = a a = b b = t while b != 0 and b <= a: t = a % b a = b b = t print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,888
s341221550
p02256
u058433718
1474027836
Python
Python3
py
Accepted
20
7760
367
import sys def get_gcd(x, y): if x < y: x, y = y, x if x % y == 0: return y # ?°??????????????????§??¬?´???° else: return get_gcd(y, x % y) if __name__ == '__main__': data = sys.stdin.readline().strip().split(' ') x = int(data[0]) y = int(data[1]) ...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,889
s023221213
p02256
u327125861
1474126361
Python
Python3
py
Accepted
20
7680
151
n = input().split() x = int(n[0]) y = int(n[1]) if x < y: bf = x x = y y = bf while y > 0: r = x % y x = y y = r print(str(x))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,890
s976995550
p02256
u685815919
1474340540
Python
Python
py
Accepted
10
6448
111
x, y = map(int, raw_input().split()) while True: z = x % y if z == 0: print y break x = y y = z
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,891
s490117822
p02256
u391228754
1476179711
Python
Python3
py
Accepted
30
7636
120
a, b = map(int, input().split()) c =1 if b > a: a, b = b, a while c != 0: c = a % b a = b b = c print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,892
s294878279
p02256
u159356473
1476324536
Python
Python3
py
Accepted
20
7720
250
#coding:UTF-8 def GCD(x,y): d=0 if x < y: d=y y=x x=d if y==0: print(x) else: GCD(y,x%y) if __name__=="__main__": a=input() x=int(a.split(" ")[0]) y=int(a.split(" ")[1]) GCD(x,y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,893
s802091317
p02256
u534156032
1476661676
Python
Python3
py
Accepted
30
7648
108
a, b = map(int, input().split()) if a < b: a, b = b, a while a % b != 0: a, b = b, a % b print(b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,894
s946984096
p02256
u500396695
1476711429
Python
Python3
py
Accepted
50
7672
109
x, y = sorted([int(i) for i in input().split()]) while x > 0: z = x x = y % x y = z print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,895
s156981466
p02256
u979507074
1476888352
Python
Python
py
Accepted
10
6448
176
b, a = map(int, raw_input().split(" ")) if a >= b: temp = b b = a a = temp while 1: r = b % a if r == 0: print(a) break b = a a = r
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,896
s837745946
p02256
u813534019
1477270758
Python
Python
py
Accepted
20
6424
95
x,y=a,b=map(int,raw_input().split()) while True: if x%y==0:break x,y=(y,x%y) print "%d" % y
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,897
s909008552
p02256
u831244171
1477797431
Python
Python
py
Accepted
10
6420
199
import time x,y = map(int,raw_input().split()) b = int(min(x,y)) a = int(max(x,y)) def gcd(a,b): if a % b != 0: r = a % b return gcd(b,r) else: print(b) gcd(a,b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,898
s126722953
p02256
u996758922
1477812262
Python
Python3
py
Accepted
30
7608
125
a = list(map(int, input().split())) a.sort() while a[0] > 0: b = a[1]%a[0] a[1] = a[0] a[0] = b print(a[1])
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,899
s540027918
p02256
u175111751
1478031811
Python
Python3
py
Accepted
30
7724
169
def gcd(x, y): if x < y: x, y = y, x if y == 0: return x else: return gcd(y, x%y) x, y = (map(int, input().split())) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,900
s327380837
p02256
u554572515
1478482834
Python
Python
py
Accepted
10
6432
187
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, raw_input().split()) print gcd(x, y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,901
s141765232
p02256
u922871577
1478933995
Python
Python
py
Accepted
50
7952
78
from fractions import gcd a, b = map(int, raw_input().split()) print gcd(a, b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,902
s290595354
p02256
u082526811
1479006914
Python
Python3
py
Accepted
20
7732
197
def gcd(b, s): mod = b % s if mod != 0: return gcd(s, mod) else: return s x, y = map(int, input().split()) b = max(x, y) s = min(x, y) a = gcd(b, s) print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,903
s028364639
p02256
u428229577
1479181587
Python
Python3
py
Accepted
20
7628
126
natural = list(map(int, input().split())) natural.sort x = natural[1] y = natural[0] while (y != 0): x, y = y, x % y print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,904
s640589637
p02256
u742013327
1479194087
Python
Python3
py
Accepted
30
7744
495
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_B&lang=jp #?????????????????????????????? #?????§??¬?´???°???????????????????????????????????¨????????¨?¨???????????????? def gcd(x,y): tmp = y if y > x: y = x x = tmp while not y == 0: y = x % y x = tmp ...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,905
s974680292
p02256
u742013327
1479194222
Python
Python3
py
Accepted
20
7716
451
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_B&lang=jp #?????????????????????????????? #?????§??¬?´???°???????????????????????????????????¨????????¨?¨???????????????? def gcd(x,y): if y > x: x, y = y, x while not y == 0: x, y = y, x % y return x def main(): ...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,906
s421987141
p02256
u660912567
1480193484
Python
Python3
py
Accepted
20
7632
87
x,y = list(map(int,input().split())) if x<y: x,y = y,x while y!=0: x,y = y,x%y print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,907
s644012971
p02256
u119456964
1480256245
Python
Python
py
Accepted
10
6408
261
def gcd(x, y): if x == y: return x while(1): if x < y: temp = x x = y y = temp x = x%y if x == 0: return y x, y = map(int, raw_input().split()) print gcd(x, y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,908
s052730811
p02256
u811733736
1480430174
Python
Python3
py
Accepted
70
7704
385
def calc_gcd(x, y): """ math.gcd()????????¨??§????????????python3.5??\??????AOJ???python?????????????????????3.4????????§?????¨??§????????? """ if y == 0: return x else: return calc_gcd(y, x % y) if __name__ == '__main__': data = [int(x) for x in input().split(' ')] result ...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,909
s558171659
p02256
u089830331
1480441670
Python
Python3
py
Accepted
40
7724
217
def greatest_common_divisor(a, b): if a == 0 or b == 0: return max(a, b) return greatest_common_divisor(max(a, b) - min(a, b), min(a, b)) a, b = map(int, input().split()) print(greatest_common_divisor(a, b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,910
s645736253
p02256
u022407960
1481048625
Python
Python3
py
Accepted
20
7716
350
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 147 105 output: 21 """ import sys def gcd(x, y): if x < y: x, y = y, x while y > 0: r = x % y x = y y = r return x if __name__ == '__main__': _input = sys.stdin.readlines() n1, n2 = map(int, _input[0].s...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,911
s656691341
p02256
u022407960
1481087245
Python
Python3
py
Accepted
20
7632
288
#!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 147 105 output: 21 """ import sys def gcd(a, b): while b: a, b = b, a % b return a if __name__ == '__main__': _input = sys.stdin.readlines() n1, n2 = map(int, _input[0].split()) print(gcd(n1, n2))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,912
s359596552
p02256
u494314211
1481217121
Python
Python3
py
Accepted
30
7644
114
A,B=list(map(int,input().split())) def gcd(A, B): if B==0: return(A) else: return(gcd(B, A%B)) print(gcd(A,B))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,913
s930841608
p02256
u908984540
1481645372
Python
Python3
py
Accepted
30
7692
343
# -*- coding : utf-8 -*- def gcd(num_a, num_b): if num_b == 0: return num_a elif num_a == 0: return num_b if num_a < num_b: return gcd(num_a, num_b % num_a) else: return gcd(num_b, num_a % num_b) num_a, num_b = [int(x) for i, x in enumerate(input().split()) if i < 2] p...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,914
s738108202
p02256
u941958472
1482076699
Python
Python3
py
Accepted
20
7696
119
def gcd(a, b): while b > 0: a, b = b, a % b return a a, b = map(int, input().split()) print(gcd(a, b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,915
s450248175
p02256
u923668099
1482621174
Python
Python3
py
Accepted
20
7656
134
data = list(map(int, input().split())) a,b = max(data), min(data) r = a % b while r != 0: a = b b = r r = a % b print(b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,916
s902845672
p02256
u475480520
1483538268
Python
Python
py
Accepted
10
6396
276
def gcd(x, y): if x < y: tmp = y y = x x = tmp if x % y == 0: return y else: return gcd(y, x % y) #input number l = raw_input() x, y = [int(e) for e in l.split()] if x < 1 and x > 10000000000: exit() if y < 1 and y > 10000000000: exit() print gcd(x, y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,917
s644628074
p02256
u935329231
1483677846
Python
Python3
py
Accepted
20
7740
311
# -*- coding: utf-8 -*- def gcd(x, y): # GCD(Greatest Common Divisor) if x < y: x, y = y, x while y > 0: r = x % y x = y y = r print(x) def to_xy(v): return [int(c) for c in v.split()] if __name__ == '__main__': x, y = to_xy(input()) gcd(x, y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,918
s121712902
p02256
u546285759
1483680167
Python
Python3
py
Accepted
20
7652
66
x, y = map(int, input().split()) while y>0: x, y = y, x%y print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,919
s223100404
p02256
u078042885
1483680758
Python
Python3
py
Accepted
20
7644
56
a,b=map(int,input().split()) while b: a,b=b,a%b print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,920
s452961179
p02256
u852745524
1483944389
Python
Python3
py
Accepted
20
7660
123
a,b = map(int,input().split()) while True: r=a%b if r==0: break else: a=b b=r print(b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,921
s178779192
p02256
u547492399
1483959667
Python
Python3
py
Accepted
20
7740
281
#Greatest Common Diveser def gcd(x, y): if x >= y: x = x % y if x == 0: return y return gcd(x, y) else: y = y % x if y == 0: return x return gcd(x, y) x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,922
s748547096
p02256
u547492399
1483960587
Python
Python3
py
Accepted
20
7716
168
#Greatest Common Diveser def gcd(a, b): while a > 0: if a < b: a, b = b, a a = a % b return b x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,923
s791450275
p02256
u711765449
1484226105
Python
Python3
py
Accepted
20
7720
225
# -*- coding:utf-8 -*- def gcd(n,m): if n < m: tmp = m m = n n = tmp while m > 0: r = n % m n = m m = r return n x, y = map(int,input().split()) print(gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,924
s166943544
p02256
u867503285
1484393594
Python
Python3
py
Accepted
30
7724
160
def gcd(x, y): x, y = max(x, y), min(x, y) while y != 0: x, y = y, x % y return x X, Y = (int(s) for s in input().split()) print(gcd(X, Y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,925
s434060990
p02256
u303093818
1484415774
Python
Python3
py
Accepted
30
7728
127
def gcd(x, y): while y != 0: x,y = y, x % y return x A = list(map(int,input().split())) print(gcd(A[0], A[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,926
s556299542
p02256
u918276501
1484596573
Python
Python3
py
Accepted
30
7660
93
x, y = map(int, input().split()) if x < y: x,y = y,x while y: x,y = y, x%y print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,927
s463289787
p02256
u918276501
1484596838
Python
Python3
py
Accepted
20
7660
57
a,b=map(int,input().split()) while b: a,b=b,a%b print(a)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,928
s402104301
p02256
u656153606
1485053357
Python
Python3
py
Accepted
20
7748
245
x, y = [int(i) for i in input().split()] if x < y: a = x x = y y = a def kouyakusu(x,y): yakusu = x % y if yakusu == 0: print(y) return y else: kouyakusu(y,yakusu) max_kouyakusu = kouyakusu(x,y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,929
s224152369
p02256
u771917453
1485596034
Python
Python
py
Accepted
10
6424
189
def gcd (x , y): sur = x % y while sur != 0: x = y y = sur sur = x % y return y a,b = map(int,raw_input().split()) if a < b : temp = a a = b b = temp print gcd(a,b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,930
s505928942
p02256
u519227872
1486565836
Python
Python3
py
Accepted
30
7672
134
x, y = map(int,input().split()) while True: if x >= y: x %= y else: y %= x if x == 0 or y == 0: print(x+y) break
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,931
s992253438
p02256
u144068724
1487082942
Python
Python3
py
Accepted
30
7608
65
x,y = map(int,input().split()) while y: x,y = y, x%y print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,932
s974217174
p02256
u831244171
1487159750
Python
Python3
py
Accepted
20
7648
199
a,b = map(int,input().split()) if a<b: ret = a a = b b = ret def gcd(a,b): c = a % b if c == 0: return b else: return gcd(b,c) print(str(gcd(a,b)))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,933
s164213900
p02256
u548155360
1487384456
Python
Python3
py
Accepted
20
7656
101
x, y = map(int, input().split()) if x < y: x, y = y, x while y > 0: x, y = y, (x%y) print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,934
s442257288
p02256
u661290476
1487498273
Python
Python3
py
Accepted
30
7744
122
def gcd(x, y): if y == 0: return x return gcd(y, x % y) x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,935
s202451471
p02256
u227438830
1487955198
Python
Python3
py
Accepted
20
7716
124
def gcd(x, y): while y != 0: (x, y) = (y, x % y) return x x, y = map(int, input().split()) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,936
s479551486
p02256
u086566114
1488114554
Python
Python
py
Accepted
10
6432
362
# -*- coding: utf-8 -*- def converter(a, b): larger = max(a, b) smaller = min(a, b) if larger == 0 or smaller == 0: return larger else: return converter(smaller, larger % smaller) def main(): a, b = [int(x) for x in raw_input().strip().split(' ')] print converter(a, b...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,937
s185327012
p02256
u086566114
1488114616
Python
Python
py
Accepted
10
6432
347
# -*- coding: utf-8 -*- def converter(a, b): larger = max(a, b) smaller = min(a, b) if smaller == 0: return larger else: return converter(smaller, larger % smaller) def main(): a, b = [int(x) for x in raw_input().strip().split(' ')] print converter(a, b) if __name_...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,938
s427965745
p02256
u086566114
1488114646
Python
Python
py
Accepted
10
6432
347
# -*- coding: utf-8 -*- def converter(a, b): larger = max(a, b) smaller = min(a, b) if smaller == 0: return larger else: return converter(smaller, larger % smaller) def main(): a, b = [int(x) for x in raw_input().strip().split(' ')] print converter(a, b) if __name_...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,939
s659724088
p02256
u086566114
1488114720
Python
Python
py
Accepted
10
6424
272
# -*- coding: utf-8 -*- def converter(a, b): if a == 0: return b else: return converter(b % a, a) def main(): a, b = sorted([int(x) for x in raw_input().strip().split(' ')]) print converter(a, b) if __name__ == '__main__': main()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,940
s134877606
p02256
u086566114
1488114761
Python
Python
py
Accepted
10
6428
248
def converter(a, b): if b%a == 0: return a else: return converter(b % a, a) def main(): a, b = sorted([int(x) for x in raw_input().strip().split(' ')]) print converter(a, b) if __name__ == '__main__': main()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,941
s821704379
p02256
u086566114
1488114826
Python
Python
py
Accepted
10
6424
188
def converter(a, b): if b%a == 0: return a else: return converter(b % a, a) a, b = sorted([int(x) for x in raw_input().strip().split(' ')]) print converter(a, b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,942
s556571139
p02256
u086566114
1488114845
Python
Python
py
Accepted
10
6428
180
def converter(a, b): if b%a == 0: return a else: return converter(b % a, a) a, b = sorted([int(x) for x in raw_input().split(' ')]) print converter(a, b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,943
s324343938
p02256
u301461168
1488565381
Python
Python3
py
Accepted
20
7664
194
a, b = map(int, input().rstrip().split(" ")) if a > b: A = a B = b else: A = b B = a GCD = 1 while True: A, B = B, A%B if B == 0: break print (str(A))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,944
s637481876
p02256
u825178626
1489140413
Python
Python3
py
Accepted
20
7676
267
# coding: utf-8 # Here your code ! def mcg(a,b): if a==b: return a else: while a%b !=0: x = a%b a = b b = x return x num =sorted(list(map(int,input().split(" ")))) print(mcg(num[0],num[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,945
s837091886
p02256
u197615397
1489236173
Python
Python3
py
Accepted
30
7676
209
def gdc(a,b): #print("%d, %d"%(a,b)) if min(a,b) == 0: return a else: return gdc(min(a,b), max(a,b)%min(a,b)) a = [int(s) for s in input().split(" ")] print(gdc(a[0],a[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,946
s952753548
p02256
u130834228
1489318652
Python
Python3
py
Accepted
20
7660
215
def gcd(a, b): if b>a: b, a = a, b d = 1 while True: d = a % b if d == 0: break a, b = b, d return b a, b = map(int, input().split()) print(gcd(a, b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,947
s121048440
p02256
u804019169
1490034718
Python
Python3
py
Accepted
30
7684
238
import sys def gcd(a, b): while b: a, b = b, a%b return a # print(gcd(54, 20)) # print(gcd(147, 105)) input = sys.stdin.readline() input = input.split(" ") input = [int(i) for i in input] print(gcd(input[0], input[1]))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,948
s287757464
p02256
u868716420
1490909096
Python
Python3
py
Accepted
20
7736
221
a, b = [int(tem) for tem in input().split()] def mak(A, B) : while B != 0 : q, r = divmod(A, B) A = int((A - r) / q) B = r return A if a > b : print(mak(a, b)) else : print(mak(b, a))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,949
s396025049
p02256
u462831976
1491133666
Python
Python3
py
Accepted
20
7788
277
# -*- coding: utf-8 -*- import sys import os import math a, b = list(map(int, input().split())) # a?????§????????????????????? if b > a: a, b = b, a def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) result = gcd(a, b) print(result)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,950
s608111710
p02256
u382692819
1491368123
Python
Python3
py
Accepted
20
7576
118
def gcd(a, b): while b: a, b = b, a % b return a s=input().split() a=int(s[0]) b=int(s[1]) y = gcd(a,b) print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,951
s410788625
p02256
u371539389
1492059059
Python
Python3
py
Accepted
20
7548
208
def gcd(a,b): if a>b: x=a y=b else: x=b y=a if y==0: return x else: return gcd(y,x%y) p,q=[int(i) for i in input().split(" ")] print(gcd(p,q))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,952
s074357245
p02256
u744977632
1492208693
Python
Python3
py
Accepted
30
7472
122
tmp=input().split() m=int(tmp[0]) n=int(tmp[1]) while(m!=n): if(m>n): m=m-n else: n=n-m print(m)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,953
s830190566
p02256
u810591206
1492783772
Python
Python3
py
Accepted
20
7708
147
def gcd(x, y): if x % y == 0: return y else: return gcd(y, x % y) x, y = list(map(int, input().split())) print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,954
s432582243
p02256
u286589639
1493086432
Python
Python3
py
Accepted
20
7652
125
x, y = map(int, input().split()) a = max(x, y) b = min(x, y) while a%b != 0: temp = a a = b b = temp%b print(b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,955
s055285460
p02256
u782850499
1493482083
Python
Python3
py
Accepted
30
7612
230
def gcd(a,b): x = max(a,b) y = min(a,b) while True: n = x%y if n == 0: print(y) break else: x = y y = n a,b = map(int,input().split()) gcd(a,b)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,956
s024919628
p02256
u591232952
1493620750
Python
Python3
py
Accepted
20
7676
171
def gcd(a,b): x,y = (a,b) if a>b else (b,a) if x % y == 0: return y else: return gcd(y, x % y) a,b = map(int, input().split()) print(gcd(a,b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,957
s264021908
p02256
u923668099
1493775208
Python
Python3
py
Accepted
20
7688
189
import sys def solve(): a, b = map(int, input().split()) ans = gcd(a, b) print(ans) def gcd(a, b): return gcd(b, a % b) if b else a if __name__ == '__main__': solve()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,958
s970042755
p02256
u831244171
1493827379
Python
Python3
py
Accepted
20
7680
219
def lcd(a,b): ##return least common multiple of a and b if a > b: return lcd(a-b,b) elif a < b: return lcd(b-a,a) elif a == b: return a a,b = map(int,input().split()) print(lcd(a,b))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,959
s762789539
p02256
u213265973
1494486014
Python
Python3
py
Accepted
20
7684
185
def gdc(x, y): if x % y == 0: return y else: return gdc(y, x%y) if __name__ == '__main__': x, y = [int(i) for i in input().split(" ")] print(gdc(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,960
s975597062
p02256
u939814144
1494905667
Python
Python3
py
Accepted
20
7696
463
def gcd(x, y): '''?????????????????????????????? x>=y?????¨??????gcd(x, y)??¨gcd(y, x%y)?????????????????¨????????¨??????''' if x < y: tmp = x x = y y = tmp while y > 0: tmp = x % y x = y y = tmp return x def test(): '''??? input = 147 ...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,961
s320379050
p02256
u939814144
1494906221
Python
Python3
py
Accepted
20
7692
411
def gcd(x, y): '''?????????????????????????????? x>=y?????¨??????gcd(x, y)??¨gcd(y, x%y)?????????????????¨????????¨??????''' if x < y: x, y = y, x while y > 0: x, y = y, x % y return x def test(): '''??? input = 147 105 -> 21''' x, y = map(int, input().sp...
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,962
s028205311
p02256
u939814144
1494906440
Python
Python3
py
Accepted
20
7684
215
def gcd(x, y): if x < y: x, y = y, x while y > 0: x, y = y, x % y return x if __name__ == '__main__': x, y = map(int, input().split()) result = gcd(x, y) print(result)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,963
s031471183
p02256
u279605379
1495261163
Python
Python3
py
Accepted
30
7620
192
#ALDS1_1-B Greatest Common Divisor def gcd(x,y): if x%y == 0: print(y) else: gcd(y,x%y) x,y = [int(x) for x in input().split()] if x>y: gcd(x,y) else: gcd(y,x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,964
s690678122
p02256
u362104929
1495293492
Python
Python3
py
Accepted
20
7692
238
def gcd(x, y): if x > y: return gcd(y, x) if y % x == 0: return x else: return gcd(y % x, x) def main(): x, y = map(int, input().split()) print(gcd(x,y)) if __name__ == "__main__": main()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,965
s561085013
p02256
u905808447
1495551502
Python
Python
py
Accepted
10
6404
538
import re def gcd(x, y): if x == y: return x if x < y and y % x == 0: return x if x > y and x % y == 0: return y if x <= y: m = y % x return gcd(x, m) if x >= y: m = x % y return gcd(y, m) l = list(range(1, int(min(x, y) / 2) + 1)) l....
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,966
s680616866
p02256
u905808447
1495551631
Python
Python
py
Accepted
10
6404
490
import re def gcd(x, y): if x == y: return x if x < y and y % x == 0: return x if x > y and x % y == 0: return y if x <= y: m = y % x return gcd(x, m) if x >= y: m = x % y return gcd(y, m) l = list(range(1, int(min(x, y) / 2) + 1)) l....
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,967
s816624250
p02256
u301824566
1495597320
Python
Python3
py
Accepted
30
7624
292
x, y = map(int, input().split()) if x > y: larger = x smaller = y else: larger = y smaller = x while True: quot, rem = divmod(larger, smaller) # a > b ????????? larger = smaller smaller = rem if rem == 0: gcd = larger break print(gcd) pass
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,968
s995314139
p02256
u780342333
1495637552
Python
Python3
py
Accepted
20
7688
188
def gcd(x, y): if y > x: x, y = y, x if y == 0: return x if x >= y: return gcd(y, x % y) x, y = [int(i) for i in input().split()] print(gcd(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,969
s966648177
p02256
u625806423
1495814703
Python
Python3
py
Accepted
20
7632
195
x,y = map(int,input().split()) while True: if x >= y: x = x % y else: y = y % x if x % y == 0: print(y) break elif y % x == 0: print(x) break
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,970
s163494721
p02256
u603049633
1495849800
Python
Python3
py
Accepted
20
7684
141
x,y=map(int, input().split()) def gcd(x,y): if x < y: x,y = y,x while y > 0: r = x % y x = y y = r return x print(str(gcd(x,y)))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,971
s766974314
p02256
u905313459
1496139916
Python
Python3
py
Accepted
60
10176
73
from fractions import gcd print(gcd(*list(map(int, input().split(" ")))))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,972
s608920058
p02256
u821624310
1496655738
Python
Python3
py
Accepted
30
7652
195
x, y = input().split() x = int(x) y = int(y) r = 1 while r > 0: if x >= y: r = x % y else: r = y % x if r != 0: x = y y = r else: print(y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,973
s186813175
p02256
u650790815
1496730331
Python
Python3
py
Accepted
30
7648
111
x,y = map(int,input().split()) def gcd(x,y): if y == 0:return x else:return gcd(y,x%y) print(gcd(x,y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,974
s655107672
p02256
u256678932
1496735043
Python
Python3
py
Accepted
20
7660
222
def main(): x, y = map(int, input().split(' ')) print(gcd(x, y)) def gcd(x, y): if x < y: x, y = y, x if x % y == 0: return y return gcd(y, x%y) if __name__ == '__main__': main()
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,975
s406210862
p02256
u533883485
1496850440
Python
Python3
py
Accepted
30
7628
286
# coding=utf-8 a, b = map(int, input().split()) if a > b: big_num = a sml_num = b else: big_num = b sml_num = a while True: diviser = big_num % sml_num if diviser == 0: break else: big_num = sml_num sml_num = diviser print(sml_num)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,976
s399449821
p02256
u533883485
1496850478
Python
Python3
py
Accepted
20
7624
286
# coding=utf-8 a, b = map(int, input().split()) if a > b: big_num = a sml_num = b else: big_num = b sml_num = a while True: diviser = big_num % sml_num if diviser == 0: break else: big_num = sml_num sml_num = diviser print(sml_num)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,977
s745742435
p02256
u591588652
1497272838
Python
Python3
py
Accepted
30
7624
179
s = input().split(" ") x = int(s[0]) y = int(s[1]) while x != 0 and y != 0: if x >= y: x = x % y else: y = y % x if x == 0: print(y) else: print(x)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,978
s699688834
p02256
u091533407
1497845715
Python
Python3
py
Accepted
20
7716
185
def eucli(a, b): r = a % b if r != 0: return eucli(b, r) else: return b if __name__=="__main__": x, y = map(int, input().split()) print(eucli(x, y))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,979
s911242250
p02256
u821624310
1498380846
Python
Python3
py
Accepted
20
7668
170
def gcd(x, y): if y == 0: print(x) return x return gcd(y, x%y) x, y = map(int, input().split()) if y > x: t = y y = x x = t gcd(x, y)
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,980
s807059012
p02256
u278938795
1498725972
Python
Python
py
Accepted
10
6440
206
import sys def gcd(a,b): temp = a if a<b: a=b b=temp if b==0: return a c = a%b return gcd(b,c) line = sys.stdin.readline().strip().split(" ") A = int(line[0]) B = int(line[1]) print(gcd(A,B))
p02256
<H1>Greatest Common Divisor</H1> <p> Write a program which finds the greatest common divisor of two natural numbers <i>a</i> and <i>b</i> </p> <H2>Input</H2> <p> <i>a</i> and <i>b</i> are given in a line sparated by a single space. </p> <H2>Output</H2> <p> Output the greatest common divisor of <i>a</i> and <i>b</...
54 20
2
31,981