buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
N = int(input()) A = list(map(int, input().split(" "))) def print_list(A): for a in A[:-1]: print (a, end="") print(A[-1]) def InsertionSort(A, N): print_list(A) for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j ...
N = int(input()) A = list(map(int, input().split(" "))) def print_list(A): for a in A[:-1]: print ("%d "%a, end="") print(A[-1]) def InsertionSort(A, N): print_list(A) for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] ...
[["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 654], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 655], ["+", 0, 1, 0, 652, 3, 4, 0, 657, 17, 109]]
5
138
4
N = int(input()) A = list(map(int, input().split())) for i in range(1, N): # ?????????????±? v = A[i] # ????????????????????????????????¨??? j = i - 1 # ?????????????????¨????????????????????§???????????? # ????±? > ??????????±????????????????????±???????????????????1?????????????????? j ??????...
N = int(input()) A = list(map(int, input().split())) for i in range(N): # ?????????????±? v = A[i] # ????????????????????????????????¨??? j = i - 1 # ?????????????????¨????????????????????§???????????? # ????±? > ??????????±????????????????????±???????????????????1?????????????????? j ?????????...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
101
2
n=int(input()) A=list(map(int,input().split())) for i in range(n): v=A[i] j=i-1 while j>=0 and A[j]>v: A[j+1]=A[j] j-=1 A[j+1]=v print(A)
n=int(input()) A=list(map(int,input().split())) for i in range(n): v=A[i] j=i-1 while j>=0 and A[j]>v: A[j+1]=A[j] j-=1 A[j+1]=v print(*A)
[["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]]
5
82
1
n = int(eval(input())) lst = list(map(int,input().split())) for i in range(1,n): v = lst[i] j = i - 1 while j >= 0 and lst[j] > v: lst[j+1] = lst[j] j -= 1 lst[j+1] = v print(' '.join(map(str, lst)))
n = int(eval(input())) lst = list(map(int,input().split())) for i in range(len(lst)): v = lst[i] j = i - 1 while j >= 0 and lst[j] > v: lst[j+1] = lst[j] j -= 1 lst[j+1] = v print(' '.join(map(str, lst)))
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
99
7
N = int(input()) A = list(map(int, input().split())) if __name__ == '__main__': print("".join(map(str, A))) for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v print("".join(map(str, A)))
N = int(input()) A = list(map(int, input().split())) if __name__ == '__main__': print(" ".join(map(str, A))) for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v print(" ".join(map(str, A)))
[["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
117
2
n = int(input()) a = [int(x) for x in input().split()] for i in range(1, n): k, j = a[i], i-1 while j >= 0 and a[j] > k: a[j+1], j = a[j], j-1 a[j+1] = k print(*a)
n = int(input()) a = [int(x) for x in input().split()] print(*a) for i in range(1, n): k, j = a[i], i-1 while j >= 0 and a[j] > k: a[j+1], j = a[j], j-1 a[j+1] = k print(*a)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
90
2
n = int(input()) a = [int(x) for x in input().split()] for i in range(1, n): k, j = a[i], i-1 while j >= 0 and a[j] > k: a[j+1], j = a[j], j-1 a[j+1] = k print(*a)
n = int(input()) a = [int(x) for x in input().split()] for i in range(n): k, j = a[i], i-1 while j >= 0 and a[j] > k: a[j+1], j = a[j], j-1 a[j+1] = k print(*a)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
90
2
n = int(input()) a = list(map(int,input().split())) for i in range(1,n): v = a[i] j = i-1 while j >= 0 and a[j] > v: a[j+1] = a[j] j = j-1 a[j+1] = v for k in range(n): if k == n-1: print(a[k],end='') else: print(a[k],end=' ') print()
n = int(input()) a = list(map(int,input().split())) for i in range(n): v = a[i] j = i-1 while j >= 0 and a[j] > v: a[j+1] = a[j] j = j-1 a[j+1] = v for k in range(n): if k == n-1: print(a[k],end='') else: print(a[k],end=' ') print()
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
127
2
kazu=int(input()) A=[int(i) for i in range(kazu)] # kazu=6 # A=[5,2,4,6,1,3] j=0 for i in range(kazu - 1): print(A[i], end=" ") print(A[kazu-1]) for i in range(1,kazu): v=A[i] j=i-1 while j>=0 and A[j] >v: A[j+1]=A[j] j =j -1 A[j+1]=v for i in range(kazu-1): print(...
kazu=int(input()) A=[int(i) for i in input().split()] # kazu=6 # A=[5,2,4,6,1,3] j=0 for i in range(kazu - 1): print(A[i], end=" ") print(A[kazu-1]) for i in range(1,kazu): v=A[i] j=i-1 while j>=0 and A[j] >v: A[j+1]=A[j] j =j -1 A[j+1]=v for i in range(kazu-1): pr...
[["-", 0, 662, 12, 658, 0, 659, 12, 652, 63, 22], ["+", 0, 659, 12, 652, 63, 319, 500, 652, 63, 22], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 12, 658, 0, 659, 12, 652, 63, 319, 0, 131], ["+", 12, 658, 0, 659, 12, 652, 63, 319, 319, 22], ["+", 12, 658, 0, 659, 1...
5
149
7
n=int(input()) l=list(map(int, input().split())) for i in range(n): l[0:i]=sorted(l[0:i]) print(l)
n=int(input()) l=list(map(int, input().split())) for i in range(1,n+1): l[0:i]=sorted(l[0:i]) print(*l)
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48]]
5
53
5
n = int(input()) x = list(map(int,input().split())) for i in range(1,n): v = x[i] j = i - 1 while j >= 0: if x[j] > v: x[j + 1] = x[j] x[j] = v j += -1 print (*x)
n = int(input()) x = list(map(int,input().split())) print (*x) for i in range(1,n): v = x[i] j = i - 1 while j >= 0: if x[j] > v: x[j + 1] = x[j] x[j] = v j += -1 print (*x)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
85
5
n = int(input()) a = list(map(int, input().split())) print(n,a) def insertionSort(a,n): for i in range(n): v = a[i] j = i - 1 while j >= 0 and a[j] > v: a[j + 1] = a[j] j -= 1 a[j + 1] = v print(" ".join(map(str, a))) insertionSort(a,n) ...
n = int(input()) a = list(map(int, input().split())) def insertionSort(a,n): for i in range(n): v = a[i] j = i - 1 while j >= 0 and a[j] > v: a[j + 1] = a[j] j -= 1 a[j + 1] = v print(" ".join(map(str, a))) insertionSort(a,n)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
114
6
N = int(input()) A = list(map(int,input().split())) for i in range(1,N): print(*A) v = A[i] j = i-1 while j >= 0 and A[j] > v: A[j+1] = A[j] j = j-1 A[j+1]=v
N = int(input()) A = list(map(int,input().split())) for i in range(1,N): print(*A) v = A[i] j = i-1 while j >= 0 and A[j] > v: A[j+1] = A[j] j = j-1 A[j+1]=v print(*A)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
87
5
def insertionSort(A,N): for i in range(1,N): v = A[i] j=i-1 while(j>=0 and A[j] > v): A[j+1] = A[j] j-=1 A[j+1]=v print(*A) if __name__ == '__main__': N = int(input()) A = [int(i) for i in input().split()] print(*insertionSort(A,N))
def insertionSort(A,N): for i in range(1,N): v = A[i] j=i-1 while(j>=0 and A[j] > v): A[j+1] = A[j] j-=1 A[j+1]=v print(*A) if __name__ == '__main__': N = int(input()) A = [int(i) for i in input().split()] print(*A) insertionSort(A,N)
[["+", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
113
3
N = int(input()) A_str = input() A = [] for s in A_str.split(): A.append(int(s)) print(",".join(map(str, A))) for i in range(1, len(A)): key = A[i] j = i - 1 while j >= 0 and A[j] > key: A[j + 1] = A[j] j -= 1 A[j + 1] = key print(",".join(map(str, A)))
N = int(input()) A_str = input() A = [] for s in A_str.split(): A.append(int(s)) print(" ".join(map(str, A))) for i in range(1, len(A)): key = A[i] j = i - 1 while j >= 0 and A[j] > key: A[j + 1] = A[j] j -= 1 A[j + 1] = key print(" ".join(map(str, A)))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
125
4
N = int(input()) A = map(int, input().split()) print(" ".join(map(str, A))) for i in range(1, len(A)): key = A[i] j = i - 1 while j >= 0 and A[j] > key: A[j + 1] = A[j] j -= 1 A[j + 1] = key print(" ".join(map(str, A)))
N = int(input()) A = list(map(int, input().split())) print(" ".join(map(str, A))) for i in range(1, len(A)): key = A[i] j = i - 1 while j >= 0 and A[j] > key: A[j + 1] = A[j] j -= 1 A[j + 1] = key print(" ".join(map(str, A)))
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
112
3
def show(array): for i in range(len(array)): if i != len(array) - 1: print(array[i], end=' ') else: print(array[i]) length = int(input()) array = [int(x) for x in input().split()] for i in range(1, length): v = array[i] j = i-1 while j >= 0 and array[j] > v: ...
def show(array): for i in range(len(array)): if i != len(array) - 1: print(array[i], end=' ') else: print(array[i]) length = int(input()) array = [int(x) for x in input().split()] for i in range(length): v = array[i] j = i-1 while j >= 0 and array[j] > v: ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
134
2
n=int(input()) a=list(map(int,input().split())) for i in range(1,n): v=a[i] j=i-1 while j>=0 and a[j]>v: a[j+1]=a[j] j-=1 a[j+1]=v print(*a)
n=int(input()) a=list(map(int,input().split())) for i in range(n): v=a[i] j=i-1 while j>=0 and a[j]>v: a[j+1]=a[j] j-=1 a[j+1]=v print(*a)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
85
7
def insertionSort(A,N): for i in range(1,len(A)): j = i while (j > 0) and (A[j-1] > A[j]) : tmp = A[j-1] A[j-1] = A[j] A[j] = tmp j -= 1 print(' '.join(map(str, A))) N = input() N = int(N) A = input() A = list(map(int, A.split())) insertionSort(A,N)
def insertionSort(A,N): for i in range(N): j = i while (j > 0) and (A[j-1] > A[j]) : tmp = A[j-1] A[j-1] = A[j] A[j] = tmp j -= 1 print(' '.join(map(str, A))) N = input() N = int(N) A = input() A = list(map(int, A.split())) insertionSort(A,N)
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
126
7
def Insertion_Sort(A, N): A = list(map(int, A.split())) for i in range(1,N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v print(" ".join(map(str,A))) N = int(input()) A = input() Insertion_Sort(A, N)
def Insertion_Sort(A, N): print(A) A = list(map(int, A.split())) for i in range(1,N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v print(" ".join(map(str,A))) N = int(input()) A = input() Insertion_Sort(A, N)...
[["+", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
113
4
def pr(A,n): for i in range(n): if i!=n-1: print(A[i],end=" ") else: print(A[i]) def insertionSort(A,N): for i in range(1,N): v=A[i] j=i-1 while j>=0 and A[j]>v: A[j+1]=A[j] j-=1 A[j+1]=v pr(A,n) n=int(inpu...
def pr(A,n): for i in range(n): if i!=n-1: print(A[i],end=" ") else: print(A[i]) def insertionSort(A,N): for i in range(1,N): v=A[i] j=i-1 while j>=0 and A[j]>v: A[j+1]=A[j] j-=1 A[j+1]=v pr(A,n) n=int(inpu...
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 21], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
149
6
N = int(input()) A = list(map(int, input().split())) print(" ".join(list(map(str, A)))) for i in range(1, N-1): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v print(" ".join(list(map(str, A))))
N = int(input()) A = list(map(int, input().split())) print(" ".join(list(map(str, A)))) for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v print(" ".join(list(map(str, A))))
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
120
2
n=int(input()) l=list(map(int,input().split())) print(*l) for i in range(len(l)): v=l[i] j=i-1 while j>=0 and l[j]>v: l[j+1]=l[j] j=j-1 l[j+1]=v print(*l)
n=int(input()) l=list(map(int,input().split())) for i in range(len(l)): v=l[i] j=i-1 while j>=0 and l[j]>v: l[j+1]=l[j] j=j-1 l[j+1]=v print(*l)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 48], ["-", 0, 1, 0, 652, 3, 4, 0, 661, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
93
5
n=int(input()) a=list(map(int,input(),split())) print(' '.join(map(str,a))) for i in range(1,n): v=a[i] j=i-1 while j>=0 and a[j]>v: a[j+1]=a[j] j=j-1 a[j+1]=v print(' '.join(map(str,a)))
n=int(input()) a=list(map(int,input().split())) print(' '.join(map(str,a))) for i in range(1,n): v=a[i] j=i-1 while j>=0 and a[j]>v: a[j+1]=a[j] j=j-1 a[j+1]=v print(' '.join(map(str,a)))
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
114
2
n=int(input()) a=list(map(int,input(),split())) for i in range(n): v=a[i] j=i-1 while j>=0 and a[j]>v: a[j+1]=a[j] j=j-1 a[j+1]=v print(' '.join(map(str,a)))
n=int(input()) a=list(map(int,input().split())) for i in range(n): v=a[i] j=i-1 while j>=0 and a[j]>v: a[j+1]=a[j] j=j-1 a[j+1]=v print(' '.join(map(str,a)))
[["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
96
2
def print_tmp(a_li): s = [str(a) for a in a_li] t = ' '.join(s) print(t) n = int(input()) a = input() A = [int(i) for i in a.split(' ')] # print_tmp(A) for i in range(1, n): v = A[i] j = i -1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v print_tmp(A) # prin...
def print_tmp(a_li): s = [str(a) for a in a_li] t = ' '.join(s) print(t) n = int(input()) a = input() A = [int(i) for i in a.split(' ')] print_tmp(A) for i in range(1, n): v = A[i] j = i -1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v print_tmp(A)
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
125
4
def print_A(): for i, n in enumerate(A): if i == N - 1: print(n) else: print(n, end=' ') def insert(): for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v prin...
def print_A(): for i, n in enumerate(A): if i == N - 1: print(n) else: print(n, end=' ') def insert(): for i in range(1, N): v = A[i] j = i - 1 while j >= 0 and A[j] > v: A[j+1] = A[j] j -= 1 A[j+1] = v prin...
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
129
3
from sys import stdin def stdinput(): return stdin.readline().strip() def main(): n = int(stdinput()) a = list(map(int, stdinput().split())) for i in range(1, n): v = a[i] j = i - 1 while j >= 0 and a[j] > v: a[j+1] = a[j] j -= 1 a[j + 1] = v ...
from sys import stdin def stdinput(): return stdin.readline().strip() def main(): n = int(stdinput()) a = list(map(int, stdinput().split())) for i in range(0, n): v = a[i] j = i - 1 while j >= 0 and a[j] > v: a[j+1] = a[j] j -= 1 a[j + 1] = v ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
130
2
#include <bits/stdc++.h> #define GET_MACRO(_1, _2, _3, _4, _5, _6, NAME, ...) NAME #define pr(...) \ cerr << GET_MACRO(__VA_ARGS__, pr6, pr5, pr4, pr3, pr2, pr1)(__VA_ARGS__) \ << endl #define pr1(a) (#a) << "=" << (a) << " " #define pr2(a, b) p...
#include <bits/stdc++.h> #define GET_MACRO(_1, _2, _3, _4, _5, _6, NAME, ...) NAME #define pr(...) \ cerr << GET_MACRO(__VA_ARGS__, pr6, pr5, pr4, pr3, pr2, pr1)(__VA_ARGS__) \ << endl #define pr1(a) (#a) << "=" << (a) << " " #define pr2(a, b) p...
[["-", 8, 9, 0, 37, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 37, 0, 2, 3, 4, 0, 22]]
1
612
2
#include <algorithm> #include <iostream> using namespace std; int gcd(int a, int b) { if (a == 1 || b == 1) return max(a, b); else if (max(a, b) % min(a, b) == 0) return min(a, b); else return gcd(min(a, b), (max(a, b)) % (min(a, b))); } int main() { // your code goes here int a, b; cin >> a >...
#include <algorithm> #include <iostream> using namespace std; int gcd(int a, int b) { if (a == 1 || b == 1) return 1; else if (max(a, b) % min(a, b) == 0) return min(a, b); else return gcd(min(a, b), (max(a, b)) % (min(a, b))); } int main() { // your code goes here int a, b; cin >> a >> b; c...
[["-", 8, 9, 0, 57, 64, 37, 0, 2, 63, 22], ["-", 0, 57, 64, 37, 0, 2, 3, 4, 0, 24], ["-", 0, 57, 64, 37, 0, 2, 3, 4, 0, 22], ["-", 0, 57, 64, 37, 0, 2, 3, 4, 0, 21], ["-", 0, 57, 64, 37, 0, 2, 3, 4, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13]]
1
126
7
#include <iostream> using namespace std; int main() { long long x, y, c; cin >> x >> y; if (x < y) { c = y; y = x; x = c; } c = 0; while (!x == 0 || y == 0) { if (c % 2 == 0) { x = x % y; } else { y = y % x; } ++c; } cout << x + y << endl; return 0; }
#include <iostream> using namespace std; int main() { long long x, y, c; cin >> x >> y; if (x < y) { c = y; y = x; x = c; } c = 0; while (x != 0 && y != 0) { if (c % 2 == 0) { x = x % y; } else { y = y % x; } ++c; } cout << x + y << endl; return 0; }
[["-", 15, 339, 51, 16, 31, 16, 31, 91, 17, 111], ["-", 0, 52, 15, 339, 51, 16, 31, 16, 17, 60], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 17, 79], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 106], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 98], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 17, 60], ["+", 0, 52, 15, 339, 51, 16, 12, 16, ...
1
102
7
#include <iostream> #include <stdio.h> using namespace std; int main() { int x, y; int p = 1; int dx; cin >> x >> y; while (1) { dx = x; x = y; y = dx % y; if (y == 0) break; } cout << y << endl; return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main() { int x, y; int p = 1; int dx; cin >> x >> y; while (1) { dx = x; x = y; y = dx % y; if (y == 0) break; } cout << x << endl; return 0; }
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
70
2
#include <algorithm> #include <iostream> #include <stdio.h> using namespace std; int num = 0; int uclide(int x, int y) { if (y == 0) return x; else { num = x; x = y; y = x % y; uclide(x, y); } } int main() { int x, y; int a = 0; cin >> x; cin >> y; if (x < y) { num = x; x = y...
#include <algorithm> #include <iostream> #include <stdio.h> using namespace std; int num = 0; int uclide(int x, int y) { if (y == 0) return x; else { num = x; x = y; y = num % y; uclide(x, y); } } int main() { int x, y; int a = 0; cin >> x; cin >> y; if (x < y) { num = x; x =...
[["-", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
121
2
#include <iostream> using namespace std; int gcd(int n, int m) { if (n % m == 0) return m; else gcd(m, n & m); } int main() { int x, y, g; cin >> x >> y; if (x == y) g = x; else if (x > y) g = gcd(x, y); else g = gcd(y, x); cout << g << endl; return 0; }
#include <iostream> using namespace std; int gcd(int n, int m) { if (n % m == 0) return m; else gcd(m, n % m); } int main() { int x, y, g; cin >> x >> y; if (x == y) g = x; else if (x > y) g = gcd(x, y); else g = gcd(y, x); cout << g << endl; return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 67], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 109]]
1
102
2
#include <algorithm> #include <stdio.h> int gcd(int, int); int main() { int x, y, z; scanf("%d %d\n", x, y); z = gcd(x, y); printf("%d\n", z); return 0; } int gcd(int x, int y) { int r; while (y > 0) { r = x % y; x = y; y = r; } return x; }
#include <algorithm> #include <stdio.h> int gcd(int, int); int main() { int x, y, z; scanf("%d %d", &x, &y); z = gcd(x, y); printf("%d\n", z); return 0; } int gcd(int x, int y) { int r; while (y > 0) { r = x % y; x = y; y = r; } return x; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
98
3
#include <stdio.h> int main(void) { int x, y, r; scanf("%d %d", &x, &y); if (x > y) { while (y > 0) { r = x % y; x = y; y = r; } printf("%d\n", x); } if (y > x) { while (x > 0) { r = y % x; y = x; x = r; } printf("%d\n", y); } return 0; }
#include <stdio.h> int main(void) { int x, y, r; scanf("%d %d", &x, &y); if (x > y) { while (y > 0) { r = x % y; x = y; y = r; } printf("%d\n", x); } if (y >= x) { while (x > 0) { r = y % x; y = x; x = r; } printf("%d\n", y); } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
112
2
#include <iostream> using namespace std; long int gcd(int a, int b) { if (b == 1) return a; return gcd(b, a % b); } int main() { long int x, y; cin >> x >> y; cout << gcd(x, y) << endl; return 0; }
#include <iostream> using namespace std; long int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { long int x, y; cin >> x >> y; cout << gcd(x, y) << endl; return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
69
2
#include <iostream> #include <stdio.h> using namespace std; int gcd(int, int); int main() { int x, y; cin >> x >> y; cout << gcd(x, y) << endl; return 0; } int gcd(int n, int m) { int q, r; if (n < m) { q = n; n = m; m = r; } while (m > 0) { r = n % m; n = m; m = r; } ret...
#include <iostream> #include <stdio.h> using namespace std; int gcd(int, int); int main() { int x, y; cin >> x >> y; cout << gcd(x, y) << endl; return 0; } int gcd(int n, int m) { int q, r; if (n < m) { q = n; n = m; m = q; } while (m > 0) { r = n % m; n = m; m = r; } ret...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
108
2
#include <algorithm> #include <iostream> using namespace std; int calc_gcd(int x, int y) { int r = x % y; if (r <= 1) { return y; } else { return calc_gcd(y, r); } } int main() { int a, b; cin >> a >> b; if (a < b) swap(a, b); int answer; answer = calc_gcd(a, b); cout << answer << e...
#include <algorithm> #include <iostream> using namespace std; int calc_gcd(int x, int y) { int r = x % y; if (r <= 0) { return y; } else { return calc_gcd(y, r); } } int main() { int a, b; cin >> a >> b; if (a < b) swap(a, b); int answer; answer = calc_gcd(a, b); cout << answer << e...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
99
2
#include <iostream> #define INPUT_FROM_FILE (1) #if INPUT_FROM_FILE #include <fstream> #endif int gcd(int a, int b) { if (a % b == 0) { return b; } return gcd(b, a % b); } int main(int argc, char **argv) { #if INPUT_FROM_FILE std::ifstream ifs("test.txt"); #endif int a = 0; int b = 0; #if INPUT_FROM...
#include <iostream> #define INPUT_FROM_FILE (0) #if INPUT_FROM_FILE #include <fstream> #endif int gcd(int a, int b) { if (a % b == 0) { return b; } return gcd(b, a % b); } int main(int argc, char **argv) { #if INPUT_FROM_FILE std::ifstream ifs("test.txt"); #endif int a = 0; int b = 0; #if INPUT_FROM...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
136
2
#include <iostream> int main() { int x, y, p, q; bool switching = true; std::cin >> x >> y; if (x > y) { while (true) { if (switching) { p = y; q = x % y; switching = false; if (q == 0) { std::cout << y << "\n"; return 0; } } else { ...
#include <iostream> int main() { int x, y, p, q; bool switching = true; std::cin >> x >> y; if (x >= y) { while (true) { if (switching) { p = y; q = x % y; switching = false; if (q == 0) { std::cout << y << "\n"; return 0; } } else { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
219
2
#include <stdio.h> int gcd(int x, int y) { return (x % y > 0 || x > y) ? gcd(y, x % y) : y; } int main() { int x, y; int w; scanf("%d %d", &x, &y); w = gcd(x, y); printf("%d\n", w); }
#include <stdio.h> int gcd(int x, int y) { return (x % y > 0) ? gcd(y, x % y) : y; } int main() { int x, y; int w; scanf("%d %d", &x, &y); w = gcd(x, y); printf("%d\n", w); }
[["-", 0, 37, 0, 41, 15, 23, 0, 16, 17, 106], ["-", 0, 41, 15, 23, 0, 16, 12, 16, 31, 22], ["-", 0, 41, 15, 23, 0, 16, 12, 16, 17, 47], ["-", 0, 41, 15, 23, 0, 16, 12, 16, 12, 22]]
1
83
4
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b; while (a % b != 0) { a = a % b; a = b; b = c; } cout << c << "\n"; }
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b; while (a % b != 0) { c = a % b; a = b; b = c; } cout << b << "\n"; }
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
57
4
#include <iostream> class CommonDivisor { private: unsigned int x; unsigned int y; public: CommonDivisor(int x, int y); int getMaxCommonDivisor(); }; CommonDivisor::CommonDivisor(int x, int y) { this->x = x; this->y = y; } int CommonDivisor::getMaxCommonDivisor() { if (x < y) { unsigned int tmp =...
#include <iostream> class CommonDivisor { private: unsigned int x; unsigned int y; public: CommonDivisor(int x, int y); int getMaxCommonDivisor(); }; CommonDivisor::CommonDivisor(int x, int y) { this->x = x; this->y = y; } int CommonDivisor::getMaxCommonDivisor() { if (x < y) { unsigned int tmp =...
[["-", 0, 57, 64, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 51, 22]]
1
174
2
#include <iostream> int gcd(int x, int y) { if (x % y == 0) { return y; } else { gcd(y, x % y); } } int main() { int x, y, swp; std::cin >> x >> y; if (x < y) { swp = x; x = y; y = x; } std::cout << gcd(x, y) << std::endl; return 0; }
#include <iostream> int gcd(int x, int y) { if (x % y == 0) { return y; } else { gcd(y, x % y); } } int main() { int x, y, swp; std::cin >> x >> y; if (x < y) { swp = x; x = y; y = swp; } std::cout << gcd(x, y) << std::endl; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
97
2
#include <stdio.h> int small(int, int); int large(int, int); int main() { int a, b, c; scanf("%d%d", &a, &b); if (b > a) { c = b; a = b; b = c; } while (1) { if (a % b == 0) break; c = b; b = a % b; a = c; } printf("%d\n", b); return 0; }
#include <stdio.h> int small(int, int); int large(int, int); int main() { int a, b, c; scanf("%d%d", &a, &b); if (b > a) { c = a; a = b; b = c; } while (1) { if (a % b == 0) break; c = b; b = a % b; a = c; } printf("%d\n", b); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
107
2
#include <stdio.h> main() { int x, y, c; scanf("%d %d", &x, &y); do { if (x < y) { c = x; x = y; y = c; } if (x % y == 0) { break; } x = x % y; } while (x % y != 0); printf("%d\n", x); return 0; }
#include <stdio.h> main() { int x, y, c; scanf("%d %d", &x, &y); do { if (x < y) { c = x; x = y; y = c; } if (x % y == 0) { break; } x = x % y; } while (x % y != 0); printf("%d\n", y); return 0; }
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
91
2
#include <stdio.h> int main(void) { int x, y; int tmp1, tmp2; scanf("%d %d", &x, &y); if (y >= x) { tmp1 = y; y = x; x = tmp1; } while (1) { tmp2 = x % y; x = y; y = tmp2; if (x % y == 0) { break; } } printf("%d\n", y); return 0; }
#include <stdio.h> int main(void) { int x, y; int tmp1, tmp2; scanf("%d %d", &x, &y); if (y > x) { tmp1 = y; y = x; x = tmp1; } while (1) { tmp2 = x % y; x = y; y = tmp2; if (tmp2 == 0) { break; } } printf("%d\n", x); return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1...
0
97
8
#include <stdio.h> int main() { int x, y, r, i, b; scanf("%d", &x); scanf("%d", &y); if (x < y) { b = x; x = y; y = b; } for (; y > 0;) { r = x % y; x = y; y = r; } printf("%d\n", y); return 0; }
#include <stdio.h> int main() { int x, y, r, i, b; scanf("%d", &x); scanf("%d", &y); if (x < y) { b = x; x = y; y = b; } for (; y > 0;) { r = x % y; x = y; y = r; } printf("%d\n", x); return 0; }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
96
2
#include <stdio.h> int main(void) { int x, y, r, tmp; scanf("%d %d", &x, &y); if (y > x) { tmp = x; x = y; y = tmp; } while (y > 0) { r = x % y; x = y; y = r; } printf("%d\n", r); return 0; }
#include <stdio.h> int main(void) { int x, y, r, tmp; scanf("%d %d", &x, &y); if (y > x) { tmp = x; x = y; y = tmp; } while (y > 0) { r = x % y; x = y; y = r; } printf("%d\n", x); return 0; }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
86
2
#include <stdio.h> int gcd(int x, int y) { int t; while (1 < y) { t = y; y = x % y; x = t; } return x; } int main() { int x, y; scanf("%d%d", &x, &y); int t; if (y < x) { t = x; x = y; y = t; } printf("%d\n", gcd(x, y)); return 0; }
#include <stdio.h> int gcd(int x, int y) { int t; while (0 < y) { t = y; y = x % y; x = t; } return x; } int main() { int x, y; scanf("%d%d", &x, &y); int t; if (y < x) { t = x; x = y; y = t; } printf("%d\n", gcd(x, y)); return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 31, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 31, 13]]
0
106
2
#include <stdio.h> int gcd(int x, int y) { int t; while (1 < y) { t = y; y = x % y; x = t; } return x; } int main() { int x, y; scanf("%d%d", &x, &y); /* int t; if( y < x ) { t = x; x = y; y = t; } */ printf("%d\n", gcd(x, y)); ret...
#include <stdio.h> int gcd(int x, int y) { int t; while (0 < y) { t = y; y = x % y; x = t; } return x; } int main() { int x, y; scanf("%d%d", &x, &y); /* int t; if( y < x ) { t = x; x = y; y = t; } */ printf("%d\n", gcd(x, y)); return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 31, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 31, 13]]
0
84
2
#include <stdio.h> main() { int i, x, y, z; scanf("%d%d", &x, &y); if (x < y) z = y; y = x; x = z; while (y != 0) { z = x % y; x = y; y = z; } printf("%d\n", x); return 0; }
#include <stdio.h> main() { int x, y, z; scanf("%d%d", &x, &y); if (x < y) { z = y; y = x; x = z; } while (y != 0) { z = x % y; x = y; y = z; } printf("%d\n", x); return 0; }
[["-", 36, 36, 0, 30, 0, 9, 0, 43, 49, 22], ["-", 36, 36, 0, 30, 0, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 30, 0, 9, 0, 57, 64, 9, 0, 46]]
0
83
4
#include <stdio.h> int main() { int x, y, r = 0; scanf("%d &d", &x, &y); while (1) { if (x % y == 0) break; r = x % y; x = y; y = r; } printf("%d\n", y); return 0; }
#include <stdio.h> int main() { int x, y, r = 0; scanf("%d %d", &x, &y); while (1) { if (x % y == 0) break; r = x % y; x = y; y = r; } printf("%d\n", y); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
73
2
#include <stdio.h> main() { int a; int b; int c; scanf("%d%d", &a, &b); if (a >= b) { c = b; b = a; a = c; } while (c != 0) { c = b % a; if (c == 0) { printf("%d\n", a); } else { b = a; a = c; } } return 0; }
#include <stdio.h> main() { int a; int b; int c; scanf("%d%d", &a, &b); if (a >= b) { c = b; b = a; a = c; } while (1) { c = b % a; if (c == 0) { printf("%d\n", a); break; } else { b = a; a = c; } } return 0; }
[["-", 0, 9, 0, 52, 15, 23, 0, 16, 31, 22], ["-", 0, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["-", 0, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 0, 30, 0, 9, 0, 52, 15, 23, 0, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
0
96
6
#include <stdio.h> int main() { int x, y, d; scanf("%d%d", &x, &y); while ((x % y) != 0) { d = x % y; x = y; y = d; } printf("%d\n", d); return 0; }
#include <stdio.h> int main() { int x, y, d; scanf("%d%d", &x, &y); while ((x % y) != 0) { d = x % y; x = y; y = d; } printf("%d\n", y); return 0; }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
67
2
#include <stdio.h> main() { int x = 0, y = 0, z = 0; scanf("%d%d", &x, &y); while (1) { if (x % y == 0) { break; } if (x >= y) { z = x % y; x = y; y = z; continue; } if (x < y) { z = y; x = y; y = z; continue; } } printf("%d\n", y)...
#include <stdio.h> main() { int x = 0, y = 0, z = 0; scanf("%d%d", &x, &y); while (1) { if (x % y == 0) { break; } if (x >= y) { z = x % y; x = y; y = z; continue; } if (x < y) { z = x; x = y; y = z; continue; } } printf("%d\n", y)...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
111
5
#include <stdio.h> main() { int x = 0, y = 0, z = 0; scanf("%d%d", &x, &y); while (1) { if (x % y == 0) { break; } if (x >= y) { z = x % y; x = y; y = z; continue; } if (x < y) { z = y; x = y; y = z; continue; } } printf("%d\n", y)...
#include <stdio.h> int main(void) { int x = 0, y = 0, z = 0; scanf("%d%d", &x, &y); while (1) { if (x % y == 0) { break; } if (x >= y) { z = x % y; x = y; y = z; continue; } if (x < y) { z = x; x = y; y = z; continue; } } prin...
[["+", 36, 36, 36, 36, 0, 30, 0, 14, 39, 40], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["-", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
111
5
#include <stdio.h> int gcd(int x, int y) { int tmp; if (y == 0) return x; if (x < y) { tmp = y; y = x; x = tmp; } return gcd(y, x % y); } int main(int argc, const char *argv[]) { // Input int a, b; scanf("%d", &a); scanf("%d", &b); printf("%d/n", gcd(a, b)); return 0; }
// // main.c // ProgrammingContest_C // // Created by ?????? ?????? on 2016/01/03. // Copyright ?? 2016??´ Jiiko corp. All rights reserved. // #include <stdio.h> int gcd(int x, int y) { int tmp; if (y == 0) return x; if (x < y) { tmp = y; y = x; x = tmp; } return gcd(y, x % y); } int...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
113
3
#include <stdio.h> int main() { int a, b, r, tmp; scanf("%d %d", &a, &b); if (a < b) { tmp = a; a = b; b = tmp; } while (r != 0) { r = a % b; a = b; b = r; } printf("%d\n", a); return 0; }
#include <stdio.h> int main() { int a, b, r, tmp; scanf("%d %d", &a, &b); if (a < b) { tmp = a; a = b; b = tmp; } r = 1; while (r != 0) { r = a % b; a = b; b = r; } printf("%d\n", a); return 0; }
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
0
85
4
#include <stdio.h> int main() { int x, y, z; scanf("%d %d", &x, &y); if (x < y) { z = x; x = y; y = z; } while (1) { if (z == 0) break; z = x % y; x = y; if (z != 0) y = z; } printf("%d\n", y); return 0; }
#include <stdio.h> int main() { int x, y, z = 1; scanf("%d %d", &x, &y); if (x < y) { z = x; x = y; y = z; } while (1) { if (z == 0) break; z = x % y; x = y; if (z != 0) y = z; } printf("%d\n", y); return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
95
2
#include <stdio.h> int main() { int x, y, c, i; scanf("%d%d", &x, &y); if (x >= y) { while (x % y > 0) { c = x % y; x = y; y = c; } printf("%d\n", c); } if (x < y) { while (y % x > 0) { c = y % x; y = x; x = c; } printf("%d\n", y); } return ...
#include <stdio.h> int main() { int x, y, c, i; scanf("%d%d", &x, &y); if (x >= y) { while (x % y > 0) { c = x % y; x = y; y = c; } printf("%d\n", y); } if (x < y) { while (y % x > 0) { c = y % x; y = x; x = c; } printf("%d\n", x); } return ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 64, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
117
4
#include <stdio.h> int main() { int x, y, n, r; scanf("%d%d", &x, &y); if (y > x) { n = y; y = x; x = n; } else { while (1) { r = y; y = x % y; if (y == 0) break; x = r; } } printf("%d\n", r); return 0; }
#include <stdio.h> int main() { int x, y, n, r; scanf("%d%d", &x, &y); if (y > x) { n = y; y = x; x = n; } while (1) { r = y; y = x % y; if (y == 0) break; x = r; } printf("%d\n", r); return 0; }
[["-", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 75, 76, 0, 9, 0, 52, 8, 9, 0, 46]]
0
94
3
#include <stdio.h> int main() { int y, x, d; scanf("%d%d", &x, &y); while (d != 0) { d = x % y; x = y; y = d; } printf("%d\n", x); return 0; }
#include <stdio.h> int main() { int y, x, d = 1; scanf("%d%d", &x, &y); while (d != 0) { d = x % y; x = y; y = d; } printf("%d\n", x); return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
63
2
#include <stdio.h> int gcd(int x, int y); int main() { int x, y; scanf("%d%d", &x, &y); printf("%d\n", gcd(x, y)); return 0; } int gcd(int x, int y) { int tmp; if (x < y) { tmp = x; x = y; y = x; } while (y > 0) { tmp = x % y; x = y; y = tmp; } return x; }
#include <stdio.h> int gcd(int x, int y); int main() { int x, y; scanf("%d%d", &x, &y); printf("%d\n", gcd(x, y)); return 0; } int gcd(int x, int y) { int tmp; if (x < y) { tmp = x; x = y; y = tmp; } while (y > 0) { tmp = x % y; x = y; y = tmp; } return x; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
113
2
#include <stdio.h> int main() { int a, b, x, y, r, gcd; scanf("%d%d", &x, &y); if (x - y >= 0) { a = x; b = y; } else { b = x; a = y; } while (r != 0) { r = a % b; a = b; b = r; } gcd = a; printf("%d\n", gcd); return 0; }
#include <stdio.h> int main() { int a, b, x, y, r = 1, gcd; scanf("%d%d", &x, &y); if (x - y >= 0) { a = x; b = y; } else { b = x; a = y; } while (r != 0) { r = a % b; a = b; b = r; } gcd = a; printf("%d\n", gcd); return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
102
2
#include <stdio.h> int gcd(int, int); int main() { int x, y; scanf("%D%D", &x, &y); printf("%d\n", gcd(x, y)); return 0; } int gcd(x, y) { int r; if (x >= y) { while (y != 0) { r = y; y = x % y; x = r; } return x; } else { while (x != 0) { r = x; x ...
#include <stdio.h> int gcd(int, int); int main() { int x, y; scanf("%d%d", &x, &y); printf("%d\n", gcd(x, y)); return 0; } int gcd(x, y) { int r; if (x >= y) { while (y != 0) { r = y; y = x % y; x = r; } return x; } else { while (x != 0) { r = x; x ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
125
2
#include <stdio.h> int main() { int x, y, z, w, i; scanf("%d%d", &x, &y); if (x < y) { z = x; x = y; y = z; } z = x % y; if (z != 0) { while (1) { w = y % z; if (w == 0) { printf("%d\n", z); break; } y = z; z = w; } } else printf("...
#include <stdio.h> int main() { int x, y, z, w, i; scanf("%d%d", &x, &y); if (x < y) { z = x; x = y; y = z; } z = x % y; if (z != 0) { while (1) { w = y % z; if (w == 0) { printf("%d\n", z); break; } y = z; z = w; } } else printf("...
[["-", 75, 76, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 75, 76, 0, 1, 0, 2, 3, 4, 0, 22]]
0
120
2
#include <stdio.h> int main() { int a, b, tmp, r; scanf("%d%d", &a, &b); if (b > a) { b = tmp; b = a; a = tmp; } while (b != 0) { r = a % b; a = b; b = r; } printf("%d\n", a); return 0; }
#include <stdio.h> int main() { int a, b, tmp, r; scanf("%d%d", &a, &b); if (b > a) { tmp = b; b = a; a = tmp; } while (b != 0) { r = a % b; a = b; b = r; } printf("%d\n", a); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
85
4
#include <stdio.h> int main() { int x, y, i, r; scanf("%d%d", &x, &y); if (x >= y) { while (y != 0) { r = y; y = x % y; x = r; } printf("%d\n", x); } else { while (x != 0) { r = x; x = y % x; y = x; } printf("%d\n", y); } return 0; }
#include <stdio.h> int main() { int x, y, i, r; scanf("%d%d", &x, &y); if (x >= y) { while (y != 0) { r = y; y = x % y; x = r; } printf("%d\n", x); } else { while (x != 0) { r = x; x = y % x; y = r; } printf("%d\n", y); } return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
0
108
2
#include <stdio.h> int main() { int x, y, max, min, newmax; scanf("%d %d", &x, &y); if (x > y) { max = x; min = y; } else { max = y; min = x; } while (max != min) { newmax = min; min = max % min; max = newmax; } printf("%d\n", max); return 0; }
#include <stdio.h> int main() { int x, y, max, min, newmax; scanf("%d %d", &x, &y); if (x > y) { max = x; min = y; } else { max = y; min = x; } while (max != min && min != 0) { newmax = min; min = max % min; max = newmax; } printf("%d\n", max); return 0; }
[["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 98], ["+", 0, 52, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 52, 15, 23, 0, 16, 12, 16, 17, 79], ["+", 0, 52, 15, 23, 0, 16, 12, 16, 12, 13]]
0
94
4
#include <stdio.h> int main() { int x, y, d, r; scanf("%d %d", &x, &y); if (x < y) { r = x; x = y; y = r; } d = x % y; while (d != 0) { x = y; y = d; d = x % y; } printf("%d\n", d); return 0; }
#include <stdio.h> int main() { int x, y, d, r; scanf("%d %d", &x, &y); if (x < y) { r = x; x = y; y = r; } d = x % y; while (d != 0) { x = y; y = d; d = x % y; } printf("%d\n", y); return 0; }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
91
2
#include <stdio.h> int main() { int x[2]; int a, b, ans, temp; scanf("%d %d\n", &a, &b); if (a >= b) { x[0] = a; x[1] = b; } else if (a < b) { x[0] = b; x[1] = a; } while (x[0] > 0) { temp = x[1]; x[1] = x[0] % temp; x[0] = temp; } ans = x[0]; printf("%d\n", ans); ...
#include <stdio.h> int main() { int x[2]; int a, b, ans, temp; scanf("%d %d\n", &a, &b); if (a >= b) { x[0] = a; x[1] = b; } else if (a < b) { x[0] = b; x[1] = a; } while (x[1] > 0) { temp = x[1]; x[1] = x[0] % temp; x[0] = temp; } ans = x[0]; printf("%d\n", ans); ...
[["-", 0, 52, 15, 23, 0, 16, 31, 69, 71, 13], ["+", 0, 52, 15, 23, 0, 16, 31, 69, 71, 13]]
0
139
2
#include <stdio.h> int main() { int x[2]; int a, y, temp; scanf("%d %d\n", &x, &y); if (a >= y) { x[0] = a; x[1] = y; } else { x[0] = y; x[1] = a; } while (x[1] != 0) { temp = x[0]; x[0] = x[1]; x[1] = temp % x[0]; } printf("%d\n", x[0]); return 0; }
#include <stdio.h> int main() { int x[2]; int a, y, temp; scanf("%d %d\n", &a, &y); if (a >= y) { x[0] = a; x[1] = y; } else { x[0] = y; x[1] = a; } while (x[1] != 0) { temp = x[0]; x[0] = x[1]; x[1] = temp % x[0]; } printf("%d\n", x[0]); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 66, 28, 22]]
0
130
2
#include <stdio.h> int main(void) { int x, y; int d, temp; scanf("%d %d", &x, &y); if (y > x) { temp = x; x = y; y = temp; } d = x % y; while (d != 0) { x = y; y = d; d = x % y; } printf("%d\n", d); return 0; }
#include <stdio.h> int main(void) { int x, y; int d, temp; scanf("%d %d", &x, &y); if (y > x) { temp = x; x = y; y = temp; } d = x % y; while (d != 0) { x = y; y = d; d = x % y; } printf("%d\n", y); return 0; }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
93
2
#include <bits/stdc++.h> #include <ctype.h> #include <math.h> using namespace std; #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for (int i = 0; i < n; i++) struct omt { omt() { ios::sync_with_stdio(false); cin.tie(0); } } star; int main() { int x, y; cin >> x >> y; if (x < y) {...
#include <bits/stdc++.h> #include <ctype.h> #include <math.h> using namespace std; #define FOR(i, a, n) for (int i = a; i < n; i++) #define REP(i, n) for (int i = 0; i < n; i++) struct omt { omt() { ios::sync_with_stdio(false); cin.tie(0); } } star; int main() { int x, y; cin >> x >> y; if (x < y) {...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
140
2
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b; if (b > a) swap(a, b); while (a != b) { c = a - b; a = b; b = c; if (b > a) swap(a, b); } cout << c << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b; if (b > a) swap(a, b); while (a != b) { c = a - b; a = b; b = c; if (b > a) swap(a, b); } cout << b << endl; return 0; }
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
84
2
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b; if (b > a) swap(a, b); while (b > 0) { c = a % b; a = b; b = c; } cout << b << endl; return 0; }
#include <algorithm> #include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b; if (b > a) swap(a, b); while (b > 0) { c = a % b; a = b; b = c; } cout << a << endl; return 0; }
[["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
71
2
#include <stdio.h> int main(void) { int x; int y; int r; int tmp; scanf("%d %d", &x, &y); if (y >= x) { x = tmp; x = y; y = tmp; } while (1) { r = x % y; if (r == 0) { printf("%d\n", y); break; } x = y; y = r; } return 0; }
#include <stdio.h> int main(void) { int x; int y; int r; int tmp; scanf("%d %d", &x, &y); if (y >= x) { tmp = x; x = y; y = tmp; } while (1) { r = x % y; if (r == 0) { printf("%d\n", y); break; } x = y; y = r; } return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
97
4
#include <algorithm> #include <iostream> using namespace std; // x,yの最大公約数を求める int main() { int x, y, big, small, amari; cin >> x >> y; big = max(x, y), small = min(x, y); //ユークリッドの互除法 while (big % small != 0) { //余り0で終了 amari = big % small; big = move(small); small = move(amari); } cout ...
#include <algorithm> #include <iostream> using namespace std; // x,yの最大公約数を求める int main() { int x, y, big, small; cin >> x >> y; big = max(x, y), small = min(x, y); //ユークリッドの互除法 while (big % small != 0) { //余り0で終了 int amari = big % small; big = move(small); small = move(amari); } cout << ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["+", 8, 9, 0, 52, 8, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
91
5
#include <iostream> #include <vector> using namespace std; int main() { int a, b; cin >> a >> b; if (b > a) { auto tmp = a; a = b; b = a; } // post: a >= b while (b != 0) { auto tmp = a % b; a = b; b = tmp; } cout << a << endl; }
#include <iostream> #include <vector> using namespace std; int main() { int a, b; cin >> a >> b; if (b > a) { auto tmp = a; a = b; b = tmp; } // post: a >= b while (b != 0) { auto tmp = a % b; a = b; b = tmp; } cout << a << endl; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
76
2
#include <iostream> using namespace std; int gcd(int a, int b) { if (b == 0) return a; else return gcd(b, a % b); } int main(void) { int a, b, c; cin >> a >> b; if (a < b) { c = a; a = b; b = a; } cout << gcd(a, b) << endl; return 0; }
#include <iostream> using namespace std; int gcd(int a, int b) { if (b == 0) return a; else return gcd(b, a % b); } int main(void) { int a, b, c; cin >> a >> b; if (a < b) { c = a; a = b; b = c; } cout << gcd(a, b) << endl; return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
91
2
#include <stdio.h> int main() { int x, y, temp; scanf("%d %d", &x, &y); if (x < y) { temp = x; y = x; x = temp; } while ((x % y) != 0) { temp = y; y = x % y; x = temp; } printf("%d\n", y); return 0; }
#include <stdio.h> int main() { int x, y, temp; scanf("%d %d", &x, &y); if (x < y) { temp = y; y = x; x = temp; } while ((x % y) != 0) { temp = y; y = x % y; x = temp; } printf("%d\n", y); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
1
87
2
#include <stdio.h> main() { long d = 1; long a, b, c; scanf("%d %d", &a, &b); if (b > a) { c = a; a = b; b = c; } while (d != 0) { d = a % b; a = b; b = d; } printf("%ld", a); }
#include <stdio.h> main() { long d = 1; long a, b, c; scanf("%ld %ld", &a, &b); if (b > a) { c = a; a = b; b = c; } while (d != 0) { d = a % b; a = b; b = d; } printf("%ld\n", a); }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
83
3
#include <cmath> #include <cstdio> #include <iostream> using namespace std; long long solve(long long a, long long b) { while (a > 1 && b > 1) { if (a > b) swap(a, b); b %= a; } return a; } int main() { long long a, b; cin >> a >> b; cout << solve(a, b) << endl; }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; long long solve(long long a, long long b) { while (a > 0 && b > 0) { if (a > b) swap(a, b); b %= a; } return a; } int main() { long long a, b; cin >> a >> b; cout << solve(a, b) << endl; }
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 12, 13], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 0, 52, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 0, 52, 15, 339, 51, 16, 12, 16, 12, 13]]
1
85
4
#include <stdio.h> int main() { int a, b, c; scanf("%d%d", &a, &b); if (a > b) { while (b != 0) { c = a % b; a = b; b = c; } printf("%d\n", a); } if (b > a) { while (a != 0) { c = b % a; b = a; a = c; } printf("%d\n", b); } return 0; }
#include <stdio.h> int main() { int a, b, c; scanf("%d%d", &a, &b); if (a > b) { while (b != 0) { c = a % b; a = b; b = c; } printf("%d\n", a); } else { while (a != 0) { c = b % a; b = a; a = c; } printf("%d\n", b); } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 57, 0, 121], ["-", 0, 14, 8, 9, 0, 57, 15, 23, 0, 24], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 57, 15, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
0
111
7
#include <stdio.h> int main() { int a, b, x; scanf("%d%d", &a, &b); while (x = a % b != 0) { a = b; b = x; } printf("%d", a); return 0; }
#include <stdio.h> int main() { int a, b, x; scanf("%d%d", &a, &b); while ((x = a % b) != 0) { a = b; b = x; } printf("%d\n", b); return 0; }
[["+", 0, 52, 15, 23, 0, 16, 31, 23, 0, 24], ["+", 0, 52, 15, 23, 0, 16, 31, 23, 0, 25], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
60
5
#include <stdio.h> int main(void) { int a, b, r; scanf("%d %d", &a, &b); while (1) { r = a % b; a = b; b = r; if (r == 0) break; } printf("%d\n", r); return 0; }
#include <stdio.h> int main(void) { int a, b, r; scanf("%d %d", &a, &b); while (1) { r = a % b; a = b; b = r; if (r == 0) break; } printf("%d\n", a); return 0; }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
70
2
#include <stdio.h> void swap(long int *x, long int *y) { long int tmp; tmp = *x; *x = *y; *y = tmp; } long int gcd(long int x, long int y) { if (x < y) swap(&x, &y); if (x % y != 0) return gcd(y, x % y); return y; } int main() { long int a, b, c; scanf("%d %d", &a, &b); c = gcd(a, b); prin...
#include <stdio.h> void swap(long int *x, long int *y) { long int tmp; tmp = *x; *x = *y; *y = tmp; } long int gcd(long int x, long int y) { if (x < y) swap(&x, &y); if (x % y != 0) return gcd(y, x % y); return y; } int main() { long int a, b, c; scanf("%ld %ld", &a, &b); c = gcd(a, b); pr...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13]]
0
133
5
#include <stdio.h> int main(void) { int x, y, z; scanf("%d", &x); scanf("%d", &y); if (x < y) { z = x; x = y; y = z; } while (1) { z = x % y; if (z == 0) { printf("%d\n", y); break; } x = z; z = y % x; if (z == 0) { printf("%d\n", x); } y = z; ...
#include <stdio.h> int main(void) { int x, y, z; scanf("%d", &x); scanf("%d", &y); if (x < y) { z = x; x = y; y = z; } while (1) { z = x % y; if (z == 0) { printf("%d\n", y); break; } x = z; z = y % x; if (z == 0) { printf("%d\n", x); break; }...
[["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
0
123
2
#include <stdio.h> int main(void) { int x, y, res; scanf("%d", &x); scanf("%d", &y); if (y >= x) { res = x; x = y; y = res; } res = x % y; while (res != 0) { x = y; y = res; res = x % y; } printf("%d\n", res); return 0; }
#include <stdio.h> int main(void) { int x, y, res; scanf("%d", &x); scanf("%d", &y); if (y >= x) { res = x; x = y; y = res; } res = x % y; while (res != 0) { x = y; y = res; res = x % y; } printf("%d\n", y); return 0; }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
97
2
#include <stdio.h> int main(void) { int gcd, x, y, tmp; scanf("%d %d", &x, &y); if (x < y) { tmp = x; x = y; y = tmp; } while ((gcd = x % y) != 0) { x = y; y = gcd; } printf("%d\n", gcd); return 0; }
#include <stdio.h> int main(void) { int gcd, x, y, tmp; scanf("%d %d", &x, &y); if (x < y) { tmp = x; x = y; y = tmp; } while ((gcd = x % y) != 0) { x = y; y = gcd; } printf("%d\n", y); return 0; }
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
86
2
#include <stdio.h> int gcd(int x, int y); int main(void) { int x, y; scanf("%d %d", &x, &y); printf("%d\n", gcd(x, y)); return 0; } int gcd(int x, int y) { int a, r; if (x < y) { a = x; x = y; y = a; } for (;;) { r = x % y; if (r == 0) break; else { x = y; y...
#include <stdio.h> int gcd(int x, int y); int main(void) { int x, y; scanf("%d %d", &x, &y); printf("%d\n", gcd(x, y)); return 0; } int gcd(int x, int y) { int a, r; if (x < y) { a = x; x = y; y = a; } for (;;) { r = x % y; if (r == 0) break; else { x = y; y...
[["-", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 22]]
0
126
2
#include <stdio.h> int main() { int a, b; int i = 0; int r, tmp; scanf("%d%d", &a, &b); if (a < b) { tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while (r != 0) { a = b; b = r; r = a % b; } printf("%d", b); printf("\n"); return 0; }
#include <stdio.h> int main() { int a, b; int i = 0; int r, tmp; scanf("%d%d", &a, &b); if (a < b) { tmp = a; a = b; b = tmp; } /* ユークリッドの互除法 */ r = a % b; while (r != 0) { a = b; b = r; r = a % b; } printf("%d", b); printf("\n"); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
104
2
#include <stdio.h> int main() { int x, y, ans, swap; scanf("%d %d", &x, &y); if (x < y) { swap = x; y = x; x = swap; } while ((x % y) != 0) { swap = x % y; x = y; y = swap; } printf("%d\n", y); return 0; }
#include <stdio.h> int main() { int x, y, ans, swap; scanf("%d %d", &x, &y); if (x < y) { swap = y; y = x; x = swap; } while ((x % y) != 0) { swap = x % y; x = y; y = swap; } printf("%d\n", y); return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
89
2
#include <stdio.h> int main() { int x, y, i, n; scanf("%d %d", &x, &y); if (x < y) { n = x; y = x; x = n; } while (1) { n = y; y = x % y; if (y == 0) { printf("%d\n", n); break; } x = n; } return 0; }
#include <stdio.h> int main() { int x, y, i, n; scanf("%d %d", &x, &y); if (x < y) { n = y; y = x; x = n; } while (1) { n = y; y = x % y; if (y == 0) { printf("%d\n", n); break; } x = n; } return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
93
2
#include <stdio.h> int main() { int x, y, r; scanf("%d%d", &x, &y); if (x >= y) { while (r != 0) { r = x % y; x = y; y = r; } printf("%d\n", x); } else if (x < y) { while (r != 0) { r = y % x; y = x; x = r; } printf("%d\n", y); } return 0; }
#include <stdio.h> int main() { int x, y, r = 1; scanf("%d%d", &x, &y); if (x >= y) { while (r != 0) { r = x % y; x = y; y = r; } printf("%d\n", x); } else if (x < y) { while (r != 0) { r = y % x; y = x; x = r; } printf("%d\n", y); } return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
112
2
#include "stdio.h" int main() { int a, b; int num; scanf("%d%d", &a, &b); if (a < b) { num = b; a = b; b = num; } while (1) { num = a % b; if (num == 0) { printf("%d\n", b); break; } else { a = b; b = num; } } return 0; }
#include "stdio.h" int main() { int a, b; int num; scanf("%d%d", &a, &b); if (a < b) { num = a; a = b; b = num; } while (1) { num = a % b; if (num == 0) { printf("%d\n", b); break; } else { a = b; b = num; } } return 0; }
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 22]]
0
97
2
#include <stdio.h> int main() { int x, y, i, M; scanf("%d%d", &x, &y); while (M = x % y) { x = y; y = M; } printf("%d\n", M); return 0; }
#include <stdio.h> int main() { int x, y, M; scanf("%d%d", &x, &y); while (M = x % y) { x = y; y = M; } printf("%d\n", y); return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
61
4
#include <stdio.h> int main() { int x, y, r; scanf("%d%d", &x, &y); while (x % y != 0) { r = x % y; x = y; y = r; } printf("%d", r); return 0; }
#include <stdio.h> int main() { int x, y, r; scanf("%d%d", &x, &y); while (x % y != 0) { r = x % y; x = y; y = r; } printf("%d\n", y); return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
64
3