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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s172190495 | p02256 | u175707104 | 1587996220 | Python | Python3 | py | Accepted | 20 | 5600 | 137 | 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)
| 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
| 32,382 |
s404389046 | p02256 | u720435112 | 1587796925 | Python | Python3 | py | Accepted | 20 | 5600 | 155 | 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))
| 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
| 32,383 |
s663779631 | p02256 | u219141430 | 1587794071 | Python | Python3 | py | Accepted | 20 | 5652 | 73 | x, y = map(int, input().split())
from math import gcd
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
| 32,384 |
s989203911 | p02256 | u758426656 | 1587707596 | Python | Python3 | py | Accepted | 20 | 5592 | 192 | 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))
| 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
| 32,385 |
s953443192 | p02256 | u700896293 | 1587553870 | Python | Python3 | py | Accepted | 20 | 5600 | 248 | # Problem 1 - 最大公約数
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
# input
a, b = map(int, input().split())
# output
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
| 32,386 |
s110345738 | p02256 | u177415284 | 1587538130 | Python | Python3 | py | Accepted | 20 | 5656 | 72 | from math import gcd
n, m = map(int, input().split())
print(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
| 32,387 |
s071244351 | p02256 | u019170748 | 1587533510 | Python | Python3 | py | Accepted | 20 | 5600 | 244 | 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))
| 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
| 32,388 |
s494224803 | p02256 | u544050664 | 1587531483 | Python | Python3 | py | Accepted | 20 | 5656 | 72 | from math import gcd
n, m = map(int, input().split())
print(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
| 32,389 |
s115939568 | p02256 | u353888999 | 1587444575 | Python | Python3 | py | Accepted | 20 | 5656 | 74 | import math
x,y = map(int,input().split())
ans = math.gcd(x,y)
print(ans)
| 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
| 32,390 |
s995619921 | p02256 | u636645824 | 1587405277 | Python | Python3 | py | Accepted | 20 | 5652 | 71 | from math import gcd
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
| 32,391 |
s333630428 | p02256 | u411092946 | 1587380125 | Python | Python3 | py | Accepted | 20 | 5596 | 367 | a, b = map(int, input().split())
def gcd(x, y):
if y == 0:
return x
else:
x %= y # xをyで割った余りをxに代入。
x, y = y, x # xとyの中身を入れ換え。
return gcd(x, y)
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
| 32,392 |
s960112152 | p02256 | u837597523 | 1587352544 | Python | Python3 | py | Accepted | 20 | 5604 | 277 | 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 # faster input
a, b = list(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
| 32,393 |
s290117605 | p02256 | u354055348 | 1587181799 | Python | Python3 | py | Accepted | 20 | 5596 | 112 | 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)
| 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
| 32,394 |
s434529182 | p02256 | u811841526 | 1586672410 | Python | Python3 | py | Accepted | 20 | 5600 | 131 | 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)
| 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
| 32,395 |
s332096288 | p02256 | u525049397 | 1586635420 | Python | Python3 | py | Accepted | 20 | 5596 | 186 | 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)
| 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
| 32,396 |
s342768842 | p02256 | u208167569 | 1586586260 | Python | Python3 | py | Accepted | 20 | 5592 | 84 | x, y = sorted(list(map(int, input().split())))
while x:
y, x = x, y%x
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
| 32,397 |
s703732363 | p02256 | u021005365 | 1586515079 | Python | Python3 | py | Accepted | 20 | 5600 | 153 | 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))
| 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
| 32,398 |
s893144669 | p02256 | u870017782 | 1586482423 | Python | Python3 | py | Accepted | 20 | 5600 | 162 | 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()
| 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
| 32,399 |
s943468308 | p02256 | u142111310 | 1586345758 | Python | Python3 | py | Accepted | 20 | 5600 | 146 | 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))
| 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
| 32,400 |
s219999686 | p02256 | u713172874 | 1586341620 | Python | Python3 | py | Accepted | 20 | 5600 | 109 | 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
| 32,401 |
s736690077 | p02256 | u763745464 | 1586148638 | Python | Python3 | py | Accepted | 40 | 6956 | 77 | import fractions
x, y = map(int, input().split())
print(fractions.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
| 32,402 |
s462170153 | p02256 | u587528376 | 1586106974 | Python | Python3 | py | Accepted | 20 | 5592 | 108 | x,y=map(int,input().split())
while(y>0):
a=x
x=y
y=a%y
#print("{},{}".format(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
| 32,403 |
s045531977 | p02256 | u672903396 | 1586094285 | Python | Python3 | py | Accepted | 20 | 5600 | 156 | 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))
| 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
| 32,404 |
s880790001 | p02256 | u592742011 | 1586089486 | Python | Python3 | py | Accepted | 20 | 5600 | 181 | 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))
| 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
| 32,405 |
s212001078 | p02256 | u798363880 | 1585828619 | Python | Python3 | py | Accepted | 20 | 5604 | 184 | 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
| 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
| 32,406 |
s707836953 | p02256 | u220079276 | 1585547751 | Python | Python3 | py | Accepted | 20 | 5600 | 146 | 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])
| 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
| 32,407 |
s702675739 | p02256 | u838900850 | 1585211834 | Python | Python3 | py | Accepted | 20 | 5600 | 189 | 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()
| 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
| 32,408 |
s356374951 | p02256 | u440695009 | 1584943137 | Python | Python3 | py | Accepted | 20 | 5596 | 98 | 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)
| 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
| 32,409 |
s185913751 | p02256 | u258049727 | 1584875112 | Python | Python3 | py | Accepted | 20 | 5592 | 68 | x,y = map(int,input().split())
while x%y != 0: x,y = y,x%y
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
| 32,410 |
s620903539 | p02256 | u957585260 | 1584774553 | Python | Python3 | py | Accepted | 20 | 5600 | 163 | 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))
| 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
| 32,411 |
s645347232 | p02256 | u329630166 | 1584696606 | Python | Python3 | py | Accepted | 20 | 5600 | 277 | x,y=map(int,input().split())
initx=x
inity=y
while True:
if x<y:
x,y=y,x#常にx>yにしたい
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
| 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
| 32,412 |
s290038818 | p02256 | u176870835 | 1584337642 | Python | Python3 | py | Accepted | 20 | 5600 | 96 | a,b = map(int,input().split())
if a > b:
a,b = b,a
while b%a != 0:
a,b = b%a,a
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
| 32,413 |
s834976162 | p02256 | u954858867 | 1584262253 | Python | Python | py | Accepted | 10 | 4632 | 126 | 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)
| 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
| 32,414 |
s206144174 | p02256 | u835794786 | 1584202298 | Python | Python3 | py | Accepted | 20 | 5600 | 165 | 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))
| 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
| 32,415 |
s759793218 | p02256 | u240839092 | 1584038437 | Python | Python3 | py | Accepted | 20 | 5596 | 122 | def gcd(x, y):
if x%y:
return gcd(y, x%y)
return 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
| 32,416 |
s028033086 | p02256 | u119355204 | 1583837557 | Python | Python3 | py | Accepted | 30 | 5596 | 200 | 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
| 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
| 32,417 |
s826945998 | p02256 | u493208426 | 1583731672 | Python | Python3 | py | Accepted | 20 | 5656 | 156 | import math
x, y = map(int, input().split())
# if (x < y):
# x, y = y, x
# while (x % y != 0):
# x, y = y, x % y
print(math.gcd(x, y))
# 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
| 32,418 |
s183680309 | p02256 | u907647136 | 1583556374 | Python | Python3 | py | Accepted | 20 | 5600 | 141 | 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))
| 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
| 32,419 |
s917712060 | p02256 | u350924040 | 1583477553 | Python | Python3 | py | Accepted | 20 | 5600 | 203 |
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))
| 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
| 32,420 |
s189811829 | p02256 | u773266448 | 1583454881 | Python | Python3 | py | Accepted | 20 | 5600 | 126 | n,m = map(int,input().split())
def gcd(a,b):
if b == 0:
print(a)
else:
return gcd(b,a%b)
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
| 32,421 |
s891078111 | p02256 | u415118689 | 1583423953 | Python | Python3 | py | Accepted | 20 | 5600 | 147 | 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))
| 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
| 32,422 |
s265846532 | p02256 | u859384502 | 1583412134 | Python | Python3 | py | Accepted | 20 | 5600 | 174 | 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))
| 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
| 32,423 |
s351320599 | p02256 | u112247126 | 1583243203 | Python | Python3 | py | Accepted | 20 | 5604 | 225 | 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)
| 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
| 32,424 |
s379452398 | p02256 | u581890166 | 1583163677 | Python | Python3 | py | Accepted | 20 | 5656 | 75 |
import math
a,b = list(map(int, input().split()))
print(math.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
| 32,425 |
s950407369 | p02256 | u328186352 | 1583151752 | Python | Python3 | py | Accepted | 20 | 5596 | 127 | 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())))
| 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
| 32,426 |
s808637228 | p02256 | u808372529 | 1583125786 | Python | Python3 | py | Accepted | 20 | 5600 | 153 | 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)
| 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
| 32,427 |
s932195316 | p02256 | u800532528 | 1583116759 | Python | Python3 | py | Accepted | 20 | 5600 | 150 | 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))
| 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
| 32,428 |
s493811880 | p02256 | u178746564 | 1582999663 | Python | Python3 | py | Accepted | 20 | 5604 | 166 | 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))
| 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
| 32,429 |
s437055648 | p02256 | u127335036 | 1582990751 | Python | Python3 | py | Accepted | 40 | 6956 | 77 | import fractions
x, y = map(int, input().split())
print(fractions.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
| 32,430 |
s547934904 | p02256 | u392923641 | 1582921370 | Python | Python3 | py | Accepted | 20 | 5600 | 158 | 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)
| 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
| 32,431 |
s532241667 | p02256 | u185907219 | 1582702400 | Python | Python3 | py | Accepted | 20 | 5656 | 72 | from math import gcd
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
| 32,432 |
s933818965 | p02256 | u230072054 | 1582621363 | Python | Python3 | py | Accepted | 20 | 5600 | 134 | 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)
| 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
| 32,433 |
s770143083 | p02256 | u920279959 | 1582598445 | Python | Python3 | py | Accepted | 20 | 5600 | 184 | 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))
| 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
| 32,434 |
s172072557 | p02256 | u476408985 | 1582508229 | Python | Python3 | py | Accepted | 20 | 5600 | 169 | 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))
| 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
| 32,435 |
s501162497 | p02256 | u474015156 | 1582464973 | Python | Python3 | py | Accepted | 20 | 5596 | 282 | 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())))
| 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
| 32,436 |
s358395212 | p02256 | u891183253 | 1582448108 | Python | Python3 | py | Accepted | 20 | 5604 | 160 | a, b = [int(item) for item in input().split()]
def gcd(a, b):
while b > 0:
a, b = b, a%b
# print(a, b)
return a
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
| 32,437 |
s820936118 | p02256 | u805852387 | 1582368433 | Python | Python3 | py | Accepted | 20 | 5600 | 149 | 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))
| 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
| 32,438 |
s545768616 | p02256 | u992758171 | 1582250634 | Python | Python3 | py | Accepted | 20 | 5604 | 112 | a, b = [int(i) for i in input().split(" ")]
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
| 32,439 |
s882039971 | p02256 | u823642749 | 1582227077 | Python | Python3 | py | Accepted | 20 | 5656 | 76 | import math
n,m = map(int, input().split())
ans = math.gcd(n,m)
print(ans)
| 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
| 32,440 |
s176309883 | p02256 | u823228864 | 1582186216 | Python | Python3 | py | Accepted | 50 | 6956 | 78 | from fractions import gcd
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
| 32,441 |
s150152396 | p02256 | u222861595 | 1582167301 | Python | Python3 | py | Accepted | 20 | 5592 | 73 | A, B = map(int, input().split())
while B > 0:
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
| 32,442 |
s382683133 | p02256 | u951508466 | 1582014028 | Python | Python3 | py | Accepted | 20 | 5624 | 71 | import math
print(eval("math.gcd(" + ",".join(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
| 32,443 |
s951104797 | p02256 | u123017074 | 1581648786 | Python | Python3 | py | Accepted | 20 | 5656 | 74 | import math
x, y = list(map(int, input().split()))
print(math.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
| 32,444 |
s927121480 | p02256 | u924587741 | 1581593702 | Python | Python3 | py | Accepted | 20 | 5600 | 95 | 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)
| 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
| 32,445 |
s892122532 | p02256 | u674150838 | 1581580006 | Python | Python3 | py | Accepted | 20 | 5600 | 197 | def GCD(x,y):
a = x%y
while a != 0:
x = y
y = a
a = x%y
return y
L = input().split()
L = [int(L[0]),int(L[1])]
L = sorted(L)
x = L[0]
y = L[1]
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
| 32,446 |
s318364293 | p02256 | u481775069 | 1581505337 | Python | Python3 | py | Accepted | 20 | 5596 | 210 | A = list(map(int,input().split()))
a = 1
k = 0
b = 0
if A[0]>A[1]:
k = A[1]
A[1] = A[0]
A[0] = k
while a != 0:
a = A[1]%A[0]
if a==0:
print(A[0])
A[1] = A[0]
A[0] = 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
| 32,447 |
s208886863 | p02256 | u715809280 | 1581503080 | Python | Python3 | py | Accepted | 20 | 5600 | 182 | def GreatestCommonDivisor(x,y):
while y:
x, y = y, x % y
return x
x, y = map(int, input().split())
if x < y:
x, y = y, x
gcd = GreatestCommonDivisor(x, y)
print(gcd)
| 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
| 32,448 |
s981912212 | p02256 | u357050809 | 1581346499 | Python | Python3 | py | Accepted | 30 | 5604 | 604 | # 2つの整数 x と y について、x ÷ d と y ÷ d の余りがともに 0 となる d のうち最大のものを、x と y の最大公約数(Greatest Common Divisor)と言います。
# 例えば、35 と14 の最大公約数 gcd (35, 14) は 7 となります。これは、35 の約数{1, 5, 7, 35}、14 の約数 {1, 2, 7, 14} の公約数 {1, 7} の最大値となります。
x, y = [ int(i) for i in input().split() ]
# 147 % 105 = 42
# 105 % 42 = 21
# 42 % 21 = 2
mod = 0
whi... | 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
| 32,449 |
s730458978 | p02256 | u194673654 | 1581049504 | Python | Python3 | py | Accepted | 30 | 5604 | 145 | def GCD(x, y):
if y != 0:
return GCD(y, x % y)
else:
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
| 32,450 |
s548373979 | p02256 | u747586296 | 1581049408 | Python | Python3 | py | Accepted | 20 | 5604 | 158 | # ユークリッドの互除法
def euclid(x, y):
return y if not x%y else euclid(y, x%y)
x, y = [int(i) for i in input().split()]
print(euclid(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
| 32,451 |
s862144790 | p02256 | u237184581 | 1581049124 | Python | Python3 | py | Accepted | 20 | 5604 | 264 | import sys
sys.setrecursionlimit(10**7)
def gcd(a, b):
while b:
a, b = b, a % b
return a
def gcd2(a, b):
if b == 0:
return a
else:
return gcd2(b, a % b)
x, y = map(int, input().split())
#print(gcd(x,y))
print(gcd2(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
| 32,452 |
s587742610 | p02256 | u820842907 | 1581043217 | Python | Python3 | py | Accepted | 20 | 5600 | 254 | def gcd(x, y):
a, b = x, y
while True:
r = a % b
if r == 0:
print(b)
break
a, b = b, r
def main():
a, b = map(int, input().split())
if a < b:
a, b = b, a
gcd(a, b)
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
| 32,453 |
s153091233 | p02256 | u642827960 | 1580998182 | Python | Python3 | py | Accepted | 20 | 5600 | 493 | #アルゴリズムの実装
def greatest_common_divisor(x, y):
if x == y:
return x
elif x > y:
while True:
x, y = y, x % y
if y == 0: break
return x
else:
x, y = y, x
while True:
x, y = y, x % y
if y == 0: break
return x
#入力data... | 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
| 32,454 |
s282044358 | p02256 | u182719622 | 1580962006 | Python | Python3 | py | Accepted | 20 | 5668 | 81 | from math import gcd
a, b = [int(i) for i in 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
| 32,455 |
s045032774 | p02256 | u220403312 | 1580934663 | Python | Python3 | py | Accepted | 20 | 5604 | 314 | # Algorithms and Data Structures 1
# Greatest Common Divisor
# Name: Ryuya Asada
# ID: s1260064
def gcd(a: int, b: int) -> int:
if b == 0:
return a
return gcd(b, a%b)
def main():
a, b = (int(e) for e in input().split(" "))
print(gcd(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
| 32,456 |
s128818565 | p02256 | u514854274 | 1580883986 | Python | Python3 | py | Accepted | 20 | 5596 | 280 | # 入力
data = list(map(int, input().split()))
# 大きい方を判別
max_i = 0
min_i = 1
if data[0] < data[1]:
max_i = 1
min_i = 0
a = data[min_i]
# 大きい数を小さい数で悪る
b = data[max_i] % a
while b != 0:
c = b
b = a % b
a = 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
| 32,457 |
s642782677 | p02256 | u953620631 | 1580397585 | Python | Python3 | py | Accepted | 30 | 5600 | 110 | x, y = [int(i) for i in input().split()]
if y > x:
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
| 32,458 |
s384598331 | p02256 | u990721773 | 1580397290 | Python | Python3 | py | Accepted | 20 | 5596 | 369 | x, y = map(int, input().split())
if x >= y:
while True:
a,b = divmod(x,y)
if b == 0:
print(y)
break
else:
x = y
y = b
elif x < y:
while True:
a,b = divmod(y,x)
if b == 0:
print(x)
break
else:
... | 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
| 32,459 |
s108850054 | p02256 | u432267158 | 1580375091 | Python | Python3 | py | Accepted | 20 | 5600 | 184 | #GCD
x,y = list(map(int,input().split()))
# xの方が大きくなくてはならない
if x < y:
x,y = y,x
r = x % y
while r != 0:
x = y
y = r
r = x % y
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
| 32,460 |
s693803171 | p02256 | u703180049 | 1580372612 | Python | Python3 | py | Accepted | 20 | 5600 | 185 | def gcd(x, y):
if x < y:
gcd(y, x)
return
while y > 0:
m = x % y
x = y
y = m
print(x)
x, y = map(int, input().split())
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
| 32,461 |
s889206080 | p02256 | u363751425 | 1580314048 | Python | Python3 | py | Accepted | 20 | 5592 | 75 | x, y = map(int, input().split())
while x > 0:
x, y = y % x, x
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
| 32,462 |
s823257269 | p02256 | u622912304 | 1580136759 | Python | Python3 | py | Accepted | 20 | 5592 | 179 | x, y = map(int, input().split())
if x < y:
tmp = x
x = y
y = tmp
while x % y != 0:
div = x % y
x = y
y = div
# print('{} {}'.format(x, y))
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
| 32,463 |
s924092347 | p02256 | u655589806 | 1579747704 | Python | Python3 | py | Accepted | 20 | 5600 | 150 | def gcd(a,b):
if b == 0:
return a
while b:
a,b = b,a%b
return gcd(a,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
| 32,464 |
s763030344 | p02256 | u363619128 | 1579515817 | Python | Python3 | py | Accepted | 20 | 5600 | 225 | def gcd(x, y):
if x < y:
x, y = y, x
else:
pass
while y > 0:
r = x % y
x = y
y = r
return x
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
| 32,465 |
s815033167 | p02256 | u403179723 | 1579313087 | Python | Python3 | py | Accepted | 20 | 5600 | 265 | def euclidean_algorithm(x, y):
if x < y:
x, y = y, x
while y > 0:
r = x % y
x, y = y, r
return x
def main():
x, y = map(int, input().split(' '))
print(euclidean_algorithm(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
| 32,466 |
s895874133 | p02256 | u675149350 | 1579293259 | Python | Python3 | py | Accepted | 20 | 5592 | 149 | a, b = map(int,(input().split()))
if a < b:
x = b
y = a
else:
x = a
y = b
while y > 0:
z = x % y
x = y
y = z
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
| 32,467 |
s755182013 | p02256 | u644946737 | 1579194894 | Python | Python3 | py | Accepted | 30 | 5600 | 142 | def gcd(x,y):
if x < y:
y,x = x,y
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
| 32,468 |
s880190257 | p02256 | u473265737 | 1579012501 | Python | Python3 | py | Accepted | 20 | 5596 | 116 | x, y = list(map(int, input().split()))
while not x == 0:
m = min(x, y)
x = max(x, y) % m
y = m
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
| 32,469 |
s591216521 | p02256 | u839237319 | 1578834269 | Python | Python3 | py | Accepted | 20 | 5600 | 249 | def help(a):
x = a[0] % a[1]
a[0] = a[1]
a[1] = x
return a
a = list(map(int, input().split()))
if a[0]<a[1]:
tmp = a[0]
a[0] = a[1]
a[1] = tmp
while a[1]>1:
help(a)
if a[1]==0:
print(a[0])
else:
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
| 32,470 |
s409481063 | p02256 | u456283783 | 1578737040 | Python | Python3 | py | Accepted | 20 | 5600 | 124 | a, b = map(int, input().split())
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
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
| 32,471 |
s771818697 | p02256 | u853741520 | 1578567765 | Python | Python3 | py | Accepted | 20 | 5600 | 119 | def f(a, b):
if a % b == 0:
return b
return f(b, a%b)
a, b = map(int, input().split())
print(f(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
| 32,472 |
s914425270 | p02256 | u469572282 | 1578325971 | Python | Python3 | py | Accepted | 20 | 5600 | 188 | x, y = map(int, input().split())
def euclid(x, y):
if x < y:
x, y = y, x
while y > 0:
r = x % y
x = y
y = r
return x
r = euclid(x,y)
print(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
| 32,473 |
s754654754 | p02256 | u153447291 | 1577959244 | Python | Python3 | py | Accepted | 40 | 6956 | 74 | import fractions
a,b = map(int,input().split())
print(fractions.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
| 32,474 |
s901367385 | p02256 | u634409340 | 1577722628 | Python | Python3 | py | Accepted | 20 | 5668 | 79 | from math import gcd
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
| 32,475 |
s617200656 | p02256 | u957523223 | 1577713251 | Python | Python3 | py | Accepted | 20 | 5600 | 211 | def gcd(x, y):
if x % y == 0:
return y
elif x >= y:
return gcd(y, x%y)
else:
return 1
x, y = map(int, input().split())
if y > x:
x, y = y, x
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
| 32,476 |
s401047748 | p02256 | u531262486 | 1577605875 | Python | Python3 | py | Accepted | 20 | 5588 | 70 | 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
| 32,477 |
s694605367 | p02256 | u617002940 | 1577443994 | Python | Python3 | py | Accepted | 20 | 5600 | 224 | def gcd(a, b):
r1 = a
r2 = b
while True:
r = r1 % r2
if r == 0:
return r2
else:
r1 = r2
r2 = r
a, b = list(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
| 32,478 |
s094577097 | p02256 | u132187835 | 1577263160 | Python | Python3 | py | Accepted | 20 | 5600 | 83 | a,b = [int(i) for i in 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
| 32,479 |
s039813641 | p02256 | u258369794 | 1577261184 | Python | Python3 | py | Accepted | 20 | 5596 | 176 | def gcd(x,y):
if x%y == 0:
return y
else:
return gcd(y,x%y)
if __name__ == '__main__':
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
| 32,480 |
s751063162 | p02256 | u902441873 | 1577186855 | Python | Python3 | py | Accepted | 20 | 5600 | 84 | x,y=map(int,input().split())
x,y=max(x,y),min(x,y)
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
| 32,481 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.