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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s496511016 | p02256 | u275486335 | 1594084905 | Python | Python3 | py | Accepted | 20 | 5656 | 68 | 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,282 |
s200947502 | p02256 | u705625724 | 1594082900 | Python | Python3 | py | Accepted | 20 | 5604 | 117 | # coding: utf-8
#77
x,y = map(int,input().split())
if x<y:
x,y = y,x
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,283 |
s849986630 | p02256 | u508539251 | 1594062521 | Python | Python3 | py | Accepted | 20 | 5592 | 101 | a,b = map(int, open(0).read().split())
a,b = max(a,b), min(a,b)
while b:
a,b = b,a%b
print(a)
| 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,284 |
s273927391 | p02256 | u177648086 | 1594044245 | Python | Python3 | py | Accepted | 20 | 5600 | 106 | 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
| 32,285 |
s453614804 | p02256 | u895962529 | 1594033923 | Python | Python3 | py | Accepted | 20 | 5656 | 64 | import math
x,y=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,286 |
s108159058 | p02256 | u506949161 | 1594015501 | Python | Python3 | py | Accepted | 40 | 6868 | 109 | import fractions
a,b=map(int,input().split())
if a<b:
a,b=b,a
while a%b !=0:
a,b =b,a%b
print(b)
| 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,287 |
s705819979 | p02256 | u253463111 | 1594013543 | Python | Python3 | py | Accepted | 40 | 6956 | 72 | 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,288 |
s989124418 | p02256 | u991830357 | 1593967102 | Python | Python3 | py | Accepted | 30 | 6336 | 199 | import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd,numbers)
x,y=map(int,input().split())
k=0
if x<y:
k=x
x=y
y=k
z=x%y
n=(gcd(y,z))
print(n)
| 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,289 |
s780982225 | p02256 | u437548816 | 1593940866 | Python | Python3 | py | Accepted | 20 | 5600 | 207 | x, y = map(int, input().split())
x, y = max(x, y), min(x, y)
# print(x, y)
while True:
if x % y == 0:
break
else:
x, y = max(y, x % y), min(y, x % y)
# print(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,290 |
s122737693 | p02256 | u286677087 | 1593877105 | Python | Python3 | py | Accepted | 20 | 5596 | 214 | x, y = map(int, input().split())
def gcd(a, b):
if a < b:
return gcd(b, a)
elif b == 0:
return a
elif b == 1:
return 1
else:
return gcd(b, a % b)
print(gcd(x, y))
| 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,291 |
s280991550 | p02256 | u229478139 | 1593772576 | Python | Python3 | py | Accepted | 20 | 5600 | 236 | def greatest_common_divisor(a, b):
a, b = max(a, b), min(a, b)
while b != 0:
a, b = b, a % b
return a
if __name__ == '__main__':
a, b = list(map(int, input().split()))
print(greatest_common_divisor(a, b))
| 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,292 |
s703580221 | p02256 | u541181365 | 1593769078 | Python | Python3 | py | Accepted | 20 | 5600 | 113 | 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,293 |
s876769721 | p02256 | u491441348 | 1593765900 | Python | Python3 | py | Accepted | 20 | 5600 | 158 | def gcd(x,y):
if x < y:
x,y = y,x
if y == 0:
return x
return gcd(y,x%y)
x,y = map(int,input().split())
ans = gcd(x,y)
print(ans)
| 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,294 |
s108178727 | p02256 | u940828136 | 1593707187 | Python | Python3 | py | Accepted | 50 | 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,295 |
s848486812 | p02256 | u057249340 | 1593675439 | Python | Python3 | py | Accepted | 20 | 5656 | 67 | import math
a, b =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,296 |
s983340994 | p02256 | u192469946 | 1593666431 | Python | Python3 | py | Accepted | 40 | 6956 | 87 | #ALDS1_1_B
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,297 |
s405193923 | p02256 | u075087498 | 1593509658 | Python | Python3 | py | Accepted | 50 | 6956 | 71 | from fractions 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,298 |
s950034808 | p02256 | u083394909 | 1593503626 | Python | Python3 | py | Accepted | 20 | 5596 | 159 | x,y = map(int, input().split())
if y > x:
tmp = y
y = x
x = tmp
r = y
i = x
while r != 0:
i = r
r = x % y
x = y
y = r
print(i)
| 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,299 |
s558126198 | p02256 | u922489088 | 1593408745 | Python | Python3 | py | Accepted | 20 | 5600 | 187 | def GCD(x, y):
if x < y:
x, y = y, x
rem = x % y
if rem == 0:
return y
else:
return GCD(rem, y)
data = map(int, input().strip().split())
ret = GCD(*data)
print(ret)
| 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,300 |
s477974196 | p02256 | u919959483 | 1593171697 | Python | Python3 | py | Accepted | 50 | 6876 | 195 | import math
import collections
import fractions
import itertools
def solve():
x, y = map(int, input().split())
print(math.gcd(x, y))
return 0
if __name__ == "__main__":
solve()
| 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,301 |
s971701449 | p02256 | u973203074 | 1593153191 | Python | Python3 | py | Accepted | 20 | 5600 | 377 | def gcd(a0, b0):
res = 1
a, b = min(a0, b0), max(a0, b0)
if b % a == 0:
res *= a
b //= a
a = 1
i = 2
while i**2 <= b0:
if a % i == 0 and b % i == 0:
res *= i
a //= i
b //= i
else:
i += 1
return res
a, b ... | 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,302 |
s974559826 | p02256 | u753534330 | 1593077660 | Python | Python3 | py | Accepted | 20 | 5600 | 171 | x, y = map(int,input().split())
if x < y:
(x, y) = (y, x)
while 1:
if y == 0:
print(x)
break
z = x % y
x = z
(x, y) = (y, x)
| 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,303 |
s702840331 | p02256 | u691985124 | 1592816057 | Python | Python3 | py | Accepted | 20 | 5600 | 147 | def gcd(x, y):
while y > 0:
tmp = x % y
x = y
y = tmp
return x
x, y = map(int, input().split())
print(gcd(x, y))
| 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,304 |
s527846987 | p02256 | u760323727 | 1592755392 | Python | Python3 | py | Accepted | 20 | 5600 | 159 | def gcd(a, b):
if a > b:
a, b = b, a
if a == 0:
return b
return gcd(b % a, a)
x, y = map(int, input().split())
print(gcd(x, y))
| 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,305 |
s854342843 | p02256 | u320921262 | 1592721272 | Python | Python3 | py | Accepted | 20 | 5656 | 62 | import math
x,y=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,306 |
s652612332 | p02256 | u677435639 | 1592630949 | Python | Python3 | py | Accepted | 20 | 5600 | 168 | def gcd(x,y):
if y==0:
return x
r=x%y
while r!=0:
x=y
y=r
r=x%y
return y
x,y=map(int,input().split())
print(gcd(x,y))
| 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,307 |
s130202253 | p02256 | u862272701 | 1592490779 | Python | Python3 | py | Accepted | 20 | 5652 | 72 | from math 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,308 |
s412347667 | p02256 | u350963229 | 1592446382 | 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,309 |
s381194546 | p02256 | u743876353 | 1592435655 | Python | Python3 | py | Accepted | 20 | 5604 | 202 | # coding: utf-8
# Your code here!
def gcd(x,y):
if x<y:
x,y=y,x
while y>0:
r=x%y
x=y
y=r
return x
a=list(map(int,input().split(" ")))
print(gcd(a[0],a[1]))
| 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,310 |
s038292175 | p02256 | u562926655 | 1592407136 | Python | Python3 | py | Accepted | 50 | 6960 | 194 | import sys
from fractions import gcd
input = sys.stdin.readline
def main():
x, y = map(int, input().split())
ans = gcd(x, y)
print(ans)
if __name__ == "__main__":
main()
| 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,311 |
s352657188 | p02256 | u560996731 | 1592375806 | Python | Python3 | py | Accepted | 20 | 5656 | 104 | #ALDS1_1_A: Greatest Common Driver
import math
x, y = 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,312 |
s103632269 | p02256 | u590535211 | 1592293949 | Python | Python3 | py | Accepted | 20 | 5600 | 128 | x,y = map(int,input().split())
if x < y:
x,y = y,x
while 1:
if y == 0:
print(x)
break
x,y = y,x%y
| 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,313 |
s831566193 | p02256 | u737337423 | 1592254312 | Python | Python3 | py | Accepted | 20 | 5656 | 70 | 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,314 |
s798905415 | p02256 | u128671689 | 1592235496 | Python | Python3 | py | Accepted | 20 | 5600 | 160 | 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,315 |
s729026567 | p02256 | u465743080 | 1592208358 | Python | Python3 | py | Accepted | 20 | 5596 | 182 | x, y = map(int, input().split())
if x - y < 0:
temp = x
x = y
y = temp
while True:
surplus = x % y
if surplus == 0:
break
x=y
y=surplus
print(y)
| 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,316 |
s801553266 | p02256 | u430753724 | 1592145779 | Python | Python3 | py | Accepted | 20 | 5608 | 376 | # -*- coding: utf-8 -*-
from sys import stdin
def greatest_common_divisor3(x, y):
xx = max(x, y)
yy = min(x, y)
v1 = xx % yy
#print("{} {}".format(yy, v1)) # TODO delete
if yy <= 0 or v1 <= 0:
return max(yy, v1)
else:
return greatest_common_divisor3(yy, v1)
x_y = list(map(int, stdin.readline().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
| 32,317 |
s720758724 | p02256 | u532816932 | 1592107681 | Python | Python3 | py | Accepted | 20 | 5604 | 265 | # coding: utf-8
# Your code here!
N,M = map(int,input().split())
#print(N,arr)
def euclid(N,M):
#print(N,M)
if M > N:
N,M = M,N
while M > 0:
r = N % M
N = M
M = r
return N
ans = euclid(N,M)
print(ans)
| 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,318 |
s669656881 | p02256 | u969835950 | 1592069601 | Python | Python3 | py | Accepted | 50 | 6956 | 71 | from fractions 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,319 |
s715169600 | p02256 | u171087702 | 1592058424 | Python | Python3 | py | Accepted | 20 | 5600 | 137 | x, y = map(int, input().split())
if x < y:
x, y = y, x
div = x % y
while div != 0:
x, y = y, div
div = x % y
print(y)
| 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,320 |
s007466860 | p02256 | u805969710 | 1592022463 | Python | Python3 | py | Accepted | 20 | 5596 | 126 | x,y=map(int,input().split())
if x>y:
a=x
b=y
else:
a=y
b=x
while 1:
t=a%b
if t==0:
break
a=b
b=t
print(b)
| 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,321 |
s267145374 | p02256 | u245986106 | 1592014846 | Python | Python3 | py | Accepted | 20 | 5656 | 97 | # 最大公約数を求める
import math
x, y = 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,322 |
s451955296 | p02256 | u228556128 | 1591787478 | Python | Python3 | py | Accepted | 20 | 5656 | 62 | import math
a,b=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,323 |
s543565363 | p02256 | u925888550 | 1591702061 | Python | Python3 | py | Accepted | 20 | 5612 | 231 | x, y = map(int,input().split())
"""
n = min(x,y)
for d in range(n, 0, -1):
if x % d == 0 and y % d == 0:
print(d)
break
"""
if x < y:
x, y = y, x
while y > 0:
r = x % y
x = y
y = r
print(x)
| 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,324 |
s740888410 | p02256 | u230966134 | 1591682295 | Python | Python3 | py | Accepted | 30 | 5600 | 172 | a, b = map(int,input().split())
def gcp(x, y):
while min(x, y) != 0:
if x < y:
x, y = y, x
x = x % y
return max(x, y)
print(gcp(a,b))
| 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,325 |
s069366328 | p02256 | u076766682 | 1591670396 | Python | Python3 | py | Accepted | 20 | 5600 | 91 | a,b=map(int,input().split())
while b>0:
if a<b:
a,b=b,a
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,326 |
s794109722 | p02256 | u994684803 | 1591430775 | Python | Python3 | py | Accepted | 20 | 5656 | 64 | import math
x,y=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,327 |
s374216703 | p02256 | u322107177 | 1591368195 | Python | Python3 | py | Accepted | 20 | 5596 | 273 | x, y = map(int, input().split())
def gcd(x, y):
lg = max(x, y)
sm = min(x, y)
div = True
while div:
lg_temp = sm
sm = lg % sm
lg = lg_temp
if sm == 0:
div = False
return lg_temp
print(gcd(x, y))
| 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,328 |
s054340208 | p02256 | u583329397 | 1591354780 | Python | Python3 | py | Accepted | 20 | 5600 | 153 | def gcd(a,b):
if a<b:
a,b=b,a
if b==0:
return a
return gcd(b,a%b)
a,b=map(int,input().split())
g=0
g=gcd(a,b)
print(g)
| 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,329 |
s663314240 | p02256 | u170051165 | 1591348942 | Python | Python3 | py | Accepted | 20 | 5604 | 211 | import sys
input = sys.stdin.readline
def gcd(x,y):
if y == 0:
return x
else:
return gcd(y,x % y)
if __name__ == "__main__":
x,y = map(int,input().split())
print(gcd(x,y))
| 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,330 |
s759059816 | p02256 | u266640508 | 1591239058 | Python | Python3 | py | Accepted | 20 | 5600 | 358 | def gcd(x, y):
z = max(x, y)
d = min(x, y)
i = 1
while z % d*i != 0:
# print('z, d = ', z, ",", d)
# print('i = ', i )
if z >= d*(i+1):
i += 1
continue
else:
z, d = d, z - d*i
i = 1
return d
x, y = map(in... | 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,331 |
s607810634 | p02256 | u390052013 | 1591175275 | Python | Python3 | py | Accepted | 20 | 5604 | 228 | def gcd(x, y):
m = max(x, y)
n = min(x, y)
while n != 0:
tmp = n
n = m % n
m = tmp
return m
def resolve():
x, y = [int(i) for i in input().split()]
print(gcd(x, y))
resolve()
| 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,332 |
s022022544 | p02256 | u395654950 | 1590994011 | Python | Python3 | py | Accepted | 20 | 5604 | 197 | # coding: utf-8
# Your code here!
def gcd(x, y):
if x % y == 0:
return y
else:
return gcd(y, x % y)
x, y = map(int, input().split())
if x < y:
x, y = y, x
print(gcd(x, y))
| 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,333 |
s301110051 | p02256 | u240091169 | 1590974155 | Python | Python3 | py | Accepted | 20 | 5600 | 177 | N, M = map(int, input().split())
while True :
if N < M :
N, M = M, N
amari = N % M
if amari == 0 :
break
else :
N, M = M, amari
print(M)
| 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,334 |
s388894293 | p02256 | u053277556 | 1590903909 | Python | Python3 | py | Accepted | 20 | 5600 | 111 | x,y = map(int, input().split())
while min(x,y)>0:
if x<y:
x,y = y,x
x = x%y
ans = y
print(y)
| 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,335 |
s321627728 | p02256 | u670406235 | 1590771122 | Python | Python3 | py | Accepted | 20 | 5604 | 112 | x,y = [int(i) for i in input().split()]
gcd = 1
while x % y != 0:
a = y
y = x % y
x = a
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,336 |
s251682140 | p02256 | u256637043 | 1590739154 | Python | Python3 | py | Accepted | 30 | 6332 | 229 | # ALDS1_1_B.py
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def gcd_list(numbers):
return reduce(math.gcd, numbers)
N, M = map(int, input().split())
print(gcd(N, M))
| 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,337 |
s139668573 | p02256 | u153034461 | 1590687249 | Python | Python3 | py | Accepted | 40 | 6356 | 250 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect
import functools
x,y = map(int,input().split())
a = math.gcd(x,y)
print(a)
| 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,338 |
s296231516 | p02256 | u275308599 | 1590584147 | Python | Python3 | py | Accepted | 40 | 6960 | 93 | from fractions import gcd
a,b = (int(x) for x in input().split())
ans = gcd(a,b)
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,339 |
s068577283 | p02256 | u662073530 | 1590315806 | Python | Python3 | py | Accepted | 20 | 5600 | 196 | x,y = map(int, input().split())
mx = max(x,y)
mn = min(x,y)
def GCD(large, small):
if small == 0:
return large;
else:
return GCD(small, large%small)
print(GCD(mx, mn))
| 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,340 |
s602592993 | p02256 | u822440951 | 1590315658 | Python | Python3 | py | Accepted | 20 | 5600 | 124 | def gcd(a, b):
while b > 0:
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,341 |
s070166861 | p02256 | u592859274 | 1590299961 | Python | Python3 | py | Accepted | 20 | 5600 | 260 | def gcd(x: int, y: int) -> int:
if x % y == 0:
return y
return gcd(y, x % y)
def main():
x, y = map(int, input().split())
if x < y:
x, y = y, x
result = gcd(x, y)
print(result)
if __name__ == "__main__":
main()
| 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,342 |
s877340428 | p02256 | u512884261 | 1590246646 | Python | Python3 | py | Accepted | 20 | 5608 | 618 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for... | 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,343 |
s136633781 | p02256 | u787512063 | 1590244216 | Python | Python3 | py | Accepted | 20 | 5600 | 217 | x, y = map(int,input().split(' '))
def gcd(x, y):
new_x = max(x, y)
new_y = min(x, y)
while new_y > 0:
r = new_x % new_y
new_x = new_y
new_y = r
return new_x
print(gcd(x, y))
| 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,344 |
s040594040 | p02256 | u747915832 | 1590168329 | Python | Python3 | py | Accepted | 20 | 5656 | 67 | import math
x, y = 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,345 |
s515643974 | p02256 | u647921435 | 1590109967 | Python | Python3 | py | Accepted | 20 | 5600 | 155 | x,y=map(int,input().split())
if y>x:
x,y=y,x
while True:
z=x%y
if z==0:
break
else:
x=y
y=z
print(y)
| 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,346 |
s818775970 | p02256 | u795389818 | 1590042555 | Python | Python3 | py | Accepted | 20 | 5600 | 216 | def gcd(a,b):
if a<b:
a,b=b,a#swap(最初に確認のswap)
while b>0:
a=a%b
a,b=b,a#(毎回入れ替えるawap)
return a
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
| 32,347 |
s151895191 | p02256 | u849026497 | 1589962864 | Python | Python3 | py | Accepted | 20 | 5656 | 67 |
import math
a,b = 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,348 |
s079589443 | p02256 | u483082413 | 1589814345 | Python | Python3 | py | Accepted | 20 | 5600 | 170 | x, y = map(int, input().split())
def gcd(x, y):
if x < y:
return gcd(y, x)
if x % y == 0:
return y
return gcd(y, x % y)
print(gcd(x, y))
| 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,349 |
s281198070 | p02256 | u486183171 | 1589795506 | Python | Python3 | py | Accepted | 20 | 5600 | 161 | def gcd(x, y):
if x < y:
x, y = y, x
while 0 < y:
x, y = y, x % y
return x
X, Y = map(int, input().split())
print(gcd(X, Y))
| 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,350 |
s519268320 | p02256 | u124936061 | 1589704699 | Python | Python3 | py | Accepted | 20 | 5652 | 63 | import math
x,y=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,351 |
s625689156 | p02256 | u189869226 | 1589694251 | Python | Python3 | py | Accepted | 20 | 5600 | 179 | def gcd(a, b):
if b > a:
a, b = b, a
if a%b != 0:
return gcd(b, a%b)
else:
return b
x, y = map(int, input().split())
print(gcd(x, y))
| 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,352 |
s789892258 | p02256 | u864060739 | 1589606760 | Python | Python3 | py | Accepted | 20 | 5600 | 103 | x,y = map(int, input().split())
a,b = max(x,y), min(x,y)
while a % b != 0:
a,b = b, a % b
print(b)
| 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,353 |
s826520293 | p02256 | u765637740 | 1589426188 | Python | Python3 | py | Accepted | 20 | 5596 | 141 | x,y = list(map(int,input().split()))
if x < y:
dummy = x
x=y
y=dummy
while x % y != 0:
z = x%y
x = y
y = z
print(y)
| 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,354 |
s667708812 | p02256 | u951109227 | 1589419163 | Python | Python3 | py | Accepted | 20 | 5600 | 199 | def euclid(x : int , y : int):
if y > x:
x , y = y , x
while y > 0:
r = x % y
x = y
y = r
return x
a , b = map(int,input().split(' '))
print(euclid(a,b))
| 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,355 |
s357313943 | p02256 | u818861195 | 1589288670 | Python | Python3 | py | Accepted | 20 | 5608 | 669 | x,y = map(int,input().split())
if x == y:
print(x)
else:
while not (x == 1 and y == 1):
if x > y:
x = x % y
if x == 0:
print(y)
break
# print(f'{x} {y}')
elif x < y:
y = y % x
if y == 0:
... | 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,356 |
s757702689 | p02256 | u217435805 | 1589249297 | Python | Python3 | py | Accepted | 20 | 5600 | 186 | # ユークリッドの互除法
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,357 |
s603929814 | p02256 | u970213677 | 1589178022 | Python | Python3 | py | Accepted | 20 | 5600 | 156 | a, b = map(int, input().split())
def gcd(n, m):
c = n % m
if c ==0:
return m
else:
return gcd(m, c)
if b > a:
a, b = b, a
print(gcd(a, b))
| 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,358 |
s419446987 | p02256 | u716887178 | 1589170577 | Python | Python3 | py | Accepted | 20 | 5592 | 151 | li = list(map(int,input().split()))
li.sort(reverse=True)
while li[0] % li[1] != 0:
temp = li[1]
li[1] = li[0] % li[1]
li[0] = temp
print(li[1])
| 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,359 |
s661903335 | p02256 | u090815677 | 1589112012 | Python | Python3 | py | Accepted | 20 | 5688 | 279 | import sys
import math
import itertools
def gcd(x,y):
if x < y:
tmp = x
x = y
y = tmp
rem = x % y
if rem == 0:
return y
else:
return gcd(y, rem)
def main():
x,y = map(int, input().split())
print(gcd(x,y))
if __name__ == '__main__':
main()
| 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,360 |
s376257070 | p02256 | u842461513 | 1589088523 | Python | Python3 | py | Accepted | 20 | 5652 | 245 | import math #mathモジュールをインポートする。
num_list = list(map(int,input().split())) #2の数をint型にしてリストのにインプットする
print(math.gcd(num_list[0],num_list[1])) #2つの数の最大公約数をとる
| 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,361 |
s127565791 | p02256 | u357747289 | 1589011176 | Python | Python3 | py | Accepted | 20 | 5596 | 158 | x, y = map(int, input().split())
while x != y:
if x < y:
w = x
x = y
y = w
x = x % y
if x == 0:
break
print(y)
| 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,362 |
s095548047 | p02256 | u014861569 | 1588956740 | Python | Python3 | py | Accepted | 20 | 5600 | 87 | x,y=map(int,input().split())
if x<y:
x,y=y,x
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,363 |
s212751866 | p02256 | u548184870 | 1588910316 | Python | Python3 | py | Accepted | 20 | 5600 | 210 | inparray = list(map(int, input().split()))
inparray.sort(reverse=True)
a, b = inparray[0], inparray[1]
while True:
# print(' {0} {1}'.format(a,b))
if a % b == 0:
print(b)
exit(0)
else:
a, b = b, 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,364 |
s776469972 | p02256 | u280197618 | 1588894872 | Python | Python3 | py | Accepted | 20 | 5600 | 111 | a, b = map(int, input().split())
while b > 0:
if a < b:
a, b = b, a
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,365 |
s058186590 | p02256 | u814278309 | 1588858824 | Python | Python3 | py | Accepted | 20 | 5600 | 143 | def gcd(a,b):
while b != 0:
a,b = b,a % b
return a
x,y = map(int,input().split())
x,y = max(x,y),min(x,y)
print(gcd(x,y))
| 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,366 |
s774060870 | p02256 | u131892700 | 1588846841 | Python | Python3 | py | Accepted | 20 | 5596 | 110 | def gcd(x,y):
return x if y == 0 else 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,367 |
s162089705 | p02256 | u037441960 | 1588840767 | Python | Python3 | py | Accepted | 20 | 5656 | 69 | import math
x, y = 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,368 |
s205250433 | p02256 | u736320234 | 1588804780 | Python | Python3 | py | Accepted | 20 | 5600 | 126 | def gcd(x, y):
return x if y == 0 else gcd(y, x%y)
x, y = [int(x) for x in input().split()]
ans = gcd(x, y)
print(ans)
| 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,369 |
s225334024 | p02256 | u327396500 | 1588758834 | Python | Python3 | py | Accepted | 20 | 5600 | 156 | def gcd(a, b):
if a < b:
a, b = b, a
while a % b != 0:
a, b = b, a%b
return b
x, y = map(int, input().split())
print(gcd(x, y))
| 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,370 |
s004490756 | p02256 | u500034977 | 1588598688 | Python | Python3 | py | Accepted | 20 | 5600 | 95 | x,y=map(int,input().split())
if x<y:
x,y=y,x
while y>0:
v=y
y=x%y
x=v
print(x)
| 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,371 |
s472860460 | p02256 | u286298310 | 1588592266 | Python | Python3 | py | Accepted | 20 | 5600 | 164 | def gcd(x,y):
if x < y:
x,y = y,x
while y > 0:
r = x % y
x = y
y = r
print(x)
x,y = map(int,input().split())
gcd(x,y)
| 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,372 |
s347246464 | p02256 | u560578228 | 1588467176 | Python | Python3 | py | Accepted | 20 | 5600 | 246 | def gcd(x, y):
a = x
b = y
if(y > x):
a = y
b = x
mod = a % b
if (mod == 0):
return b
else:
return gcd(b, mod)
def main():
x, y = map(int, input().split())
print(gcd(x, y))
main()
| 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,373 |
s169509119 | p02256 | u367619546 | 1588392969 | Python | Python3 | py | Accepted | 20 | 5604 | 281 | # ALDS1_1_B: Greatest Common Divisor
import sys
x, y = map(int, sys.stdin.readline().strip().split())
def gcd(x, y):
if x <= y: # x のほうが
x, y = y, x
r = -1
while r != 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,374 |
s931951245 | p02256 | u347281577 | 1588238644 | Python | Python3 | py | Accepted | 20 | 5600 | 120 |
x,y = map(int,input().split())
while y != 0:
if x >= y:
x,y = y,x%y
else:
x,y = y,x
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,375 |
s228385519 | p02256 | u064851531 | 1588222059 | Python | Python3 | py | Accepted | 20 | 5604 | 195 |
def generate_number(a, b):
if b == 0:
return a
else:
return generate_number(b, a % b)
num = input("")
lst_num = num.split()
print(generate_number(int(lst_num[0]),int(lst_num[1])))
| 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,376 |
s126870344 | p02256 | u065951775 | 1588166236 | Python | Python3 | py | Accepted | 20 | 5600 | 223 | def sub_GCD(x, y):
if x > y:
return y, x % y
else:
return x, y % x
def GCD(x, y):
while not (x==0 or y==0):
x, y = sub_GCD(x, y)
print(x)
x, y = map(int, input().split())
GCD(x, y)
| 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,377 |
s452821993 | p02256 | u556600138 | 1588165064 | Python | Python3 | py | Accepted | 20 | 5652 | 270 | x,y = map(int,input().split())
def divs(n:int):
divs = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divs.append(i)
if i != n // i:
divs.append(n//i)
return divs
print (max(set(divs(x))&set(divs(y))))
| 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,378 |
s971283570 | p02256 | u514127623 | 1588079596 | Python | Python3 | py | Accepted | 20 | 5600 | 131 |
def gcd(a,b):
if a % b == 0:
return b
else:
return gcd(b,a % b)
x, y = map(int,input().split())
print(gcd(x, y))
| 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,379 |
s377401454 | p02256 | u374037476 | 1588074846 | Python | Python3 | py | Accepted | 50 | 6956 | 73 | 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,380 |
s626317026 | p02256 | u945415253 | 1588057355 | Python | Python3 | py | Accepted | 20 | 5656 | 66 | import math
a,b = 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,381 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.