Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02831 (python)

Fixed submission:
#https://note.nkmk.me/python-gcd-lcm/
#lcm(a, b) = a * b / gcd(a, b)
import fractions

a, b = map(int, input().split(' '))

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

print(int(lcm(a, b)))

Buggy submission (verdict: Runtime Error):
#https://note.nkmk.me/python-gcd-lcm/
#lcm(a, b) = a * b / gcd(a, b)
import math

a, b = map(int, input().split(' '))

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

print(int(lcm(a, b)))
Problem p02831 (python)

Fixed submission:
from fractions import gcd

A, B = map(int, input().split())

print(A * B // gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return int((x * y) / math.gcd(x, y))
  

A, B = map(int, input().split())
print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A, B = map(int, input().split())
print(lcm(A, B))
Problem p02915 (python)

Fixed submission:
n = int(input())
print(n*n*n)

Buggy submission (verdict: Runtime Error):
N = input()

print(N*N*N)
Problem p02916 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

former = -10
satisfy = 0
for i in a:
    satisfy += b[i-1]
    if i == former + 1:
        satisfy += c[i-2]
    former = i
print(satisfy)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())
b = map(int, input().split())
c = map(int, input().split())  

former = -10
satisfy = 0
for i in a:
    satisfy += b[i-1]
    if i == former + 1:
        satisfy += c[i-2]
    former = i
print(satisfy)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int, input.split())
b = map(int, input.split())
c = map(int, input.split())  

former = -10
satisfy = 0
for i in a:
    satisfy += b[i-1]
    if i == former + 1:
        satisfy += c[i-2]
    former = i
print(satisfy)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int, input.split())
b = map(int, input.split())
c = map(int, input.split()) 
former = -10
satisfy = 0
for i in a:
    print(i)
    satisfy += b[i-1]
    if i == former + 1:
        satisfy += c[i-2]
    former = i
print(satisfy)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int, input.split())
b = map(int, input.split())
c = map(int, input.split())  

former = -10
satisfy = 0
for i in a:
    satisfy += b[i-1]
    if i == former + 1:
        satisfy += c[i-1]
    former = i
print(satisfy)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)

if a < 3200:
    print('red')

Buggy submission (verdict: Runtime Error):
a,s = int(input())

if a >= 3200:
    print('s')

else:a < 3200
    print('red')
Problem p02819 (python)

Fixed submission:
def isPrime(n):
  if n == 2:
    return True
  for p in range(2, n):
      if n % p == 0:
        return False
  return True
 
x = int(input())
while True:
  if isPrime(x):
    print(x)
    break
  x = x+1

Buggy submission (verdict: Runtime Error):
def isPrime(n):
  if n == 2:
    return True
  for p in range(2, n):
      if n % p == 0:
        return False
  return True

x = float(input())
while True:
  if isPrime(x):
    print(x)
    break
  x = x+1

Buggy submission (verdict: Runtime Error):
x = int(input())
while True:
  if isPrime(x):
    print(x)
    break
  x = x+1
  
def isPrime(n):
  if n < 2:
    return False
  if n == 2:
    return True
  for p in range(2, n):
      if n % p == 0:
        return False
  return True
Problem p02819 (python)

Fixed submission:
def is_prime(num):
  for i in range(2, num):
    if num % i == 0:
      return False
 
  return True

x = int(input())

for i in range(x, 100004):
  if is_prime(i):
    print(i)
    break

Buggy submission (verdict: Runtime Error):
def is_prime(num):
  for i in range(num):
    if num % i == 0:
      return False
  return True

x = int(input())

for i in range(x, 10000+4):
  if is_prime(i):
    print(i)
    break
Problem p02860 (python)

Fixed submission:
n = int(input())
s = [i for i in input()]

if n%2 == 1:
  print("No")
else:
  if s[:int(n/2)] == s[int(n/2):]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

v = [S[i:i+N//2] for i in range(0, len(S), 2)]


if N/2!=N//2:
  print("No")

if v[0] == v[1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

v = [S[i:i+N//2] for i in range(0, len(S), 2)]

if v[0] == v[1]:
  print("Yes")
else:
  print("No")
Problem p02897 (python)

Fixed submission:
N = int(input())

if N == 1:
  print(1)
elif N % 2 == 1:
  print(((N-1)/2+1)/N)
elif N % 2 == 0:
  print(1/2)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
List = []

for i in range(N):
  print(str(A.index(i+1)+1), end=" ")

Buggy submission (verdict: Runtime Error):
N = int(input())

if N % 2 == 1:
  print(((N-1)/2+1)/N/)
else:
  print(N/2)
Problem p03012 (python)

Fixed submission:
n = int(input())
w = list(map(int, input().split()))
l = []

for i in range(1, n):
  l.append(abs( sum(w[:i]) -sum(w[i:]) ))
  
print(min(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
w = list(map(int, input().split()))
l = []

for i in range(1, n):
  l.append(abs( sum(w[:t]) -sum(w[t:]) ))
  
print(min(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
w = list(map(int, input().split()))
l = []

for i in range(1, n):
  l.append(abs(sum(w[i:]) - sum(w[:t])))
  
print(min(l))
Problem p03036 (python)

Fixed submission:
r,d,x = map(int, input().split())

count = 0
while count < 10:
  x = r*x-d
  print(x)
  count += 1

Buggy submission (verdict: Runtime Error):
r,d,x = map(int, input().split())

for i in range(10):
  x += r*x - d
  printx(x)

Buggy submission (verdict: Runtime Error):
r,d,x = map(int, input().split())

for i in range(10):
  x += r*x - D
  printx(x)
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()

s[k-1] = s[k-1].lower()

print("".join(s))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()

print(s.replace(s[k], s[k].lower()))
Problem p03042 (python)

Fixed submission:
a,b,c,d = str(input())

if 1<=int(a+b)<=12 and 1<=int(c+d)<=12:
  print("AMBIGUOUS")
elif 1<=int(a+b)<=12: 
  print("MMYY")
elif 1<=int(c+d)<=12: 
  print("YYMM")
else:
  print("NA")

Buggy submission (verdict: Runtime Error):
a,b,c,d = str(input())

if 1<=int(a+b)<=12 and 1<=int(c+d)<=12:
  print("AMBIGUOUS")
elif 1<=int(a+b)<=12 
  print("MMYY")
elif 1<=int(c+d)<=12 
  print("YYMM")
else:
  print("NA")
Problem p03835 (python)

Fixed submission:
k,s = map(int, input().split())

count = 0

for x in range(k+1):
  for y in range(k+1):
    z = s - (x + y)
    
    if 0 <= z <= k:
      count += 1
      
print(count)

Buggy submission (verdict: Runtime Error):
k,s = map(int, input().split())

count = 0

for x in range(k+1):
  for y in range(k+1):
    z = S - (x + y)
    
    if 0 <= z <= k:
      count += 1
      
print(count)

Buggy submission (verdict: Runtime Error):
k,s = map(int, input().split())

count = 0

for x in range(k+1):
  for i in range(k+1):
    z = S - (x + y)
    
    if 0 <= z <= k:
      count += 1
      
print(count)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()

if N%2 == 0:
    jdg_1 = S[0:int(N/2)]
    jdg_2 = S[int(N/2):int(N)]
    if jdg_1==jdg_2:
      out = 'Yes'
    else:
      out = 'No'
else:
  out = 'No'

print(out)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

if N%2 == 0:
    jdg_1 = S[0:N/2]
    jdg_2 = S[N/2:N]
    if jdg_1==jdg_2:
      out = 'Yes'
    else:
      out = 'No'
else:
  out = 'No'

print(out)
Problem p02862 (python)

Fixed submission:

def num_combinations_mod(n, r, mod, num_max=10**6):
    # if this functions is called twice or more, init process should be placed before calling this function to
    # save time.
    if r > n:
        return 0
    elif r == n:
        return 1
    elif r < 0 or n < 0:
        return 0
    f_mod, f_mod_inv = num_combinations_mod_init(num_max, mod)
    return f_mod[n] * (f_mod_inv[r] * f_mod_inv[n-r] % mod) % mod


def num_combinations_mod_init(num_max, mod):
    factorials_mod = dict()
    factorials_mod_inv = dict()
    factorials_mod[0] = 1
    factorials_mod[1] = 1
    factorials_mod_inv[0] = 1
    factorials_mod_inv[1] = 1
    mod_inv = dict()
    mod_inv[1] = 1
    for i in range(2, num_max):
        factorials_mod[i] = factorials_mod[i - 1] * i % mod
        mod_inv[i] = mod - mod_inv[mod % i] * (mod // i) % mod
        factorials_mod_inv[i] = factorials_mod_inv[i - 1] * mod_inv[i] % mod
    return factorials_mod, factorials_mod_inv


def get(num1, num2):
    if num1 > num2:
        num = num2
    else:
        num = num1
    return num_combinations_mod(num1+num2, num, 10**9+7)


def main(X, Y):
    if (X + Y) % 3 != 0:
        return 0

    total = (X + Y) // 3
    n_moveB = (2 * X - Y) // 3
    n_moveA = total - n_moveB
    answer = get(n_moveA, n_moveB)

    return answer


X, Y = map(int, input().split(" "))
print(main(X, Y))

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split(" "))


def num_combinations_mod(n, r, mod, num_max=10**6):
    # if this functions is called twice or more, init process should be placed before calling this function to
    # save time.
    f_mod, f_mod_inv = num_combinations_mod_init(num_max, mod)
    return f_mod[n] * (f_mod_inv[r] * f_mod_inv[n-r] % mod) % mod


def num_combinations_mod_init(num_max, mod):
    factorials_mod = dict()
    factorials_mod_inv = dict()
    factorials_mod[0] = 1
    factorials_mod[1] = 1
    factorials_mod_inv[0] = 1
    factorials_mod_inv[1] = 1
    mod_inv = dict()
    mod_inv[1] = 1
    for i in range(2, num_max):
        factorials_mod[i] = factorials_mod[i - 1] * i % mod
        mod_inv[i] = mod - mod_inv[mod % i] * (mod // i) % mod
        factorials_mod_inv[i] = factorials_mod_inv[i - 1] * mod_inv[i] % mod
    return factorials_mod, factorials_mod_inv


def get(num1, num2):
    if num1 > num2:
        num = num2
    else:
        num = num1
    return num_combinations_mod(num1+num2, num, 10**9+7)


answer = 0
if (X + Y) % 3 != 0:
    print(0)
    exit()

total = (X + Y) // 3
n_moveB = (2 * X - Y) // 3
n_moveA = total - n_moveB
answer = get(n_moveA, n_moveB)

print(answer)
Problem p02819 (python)

Fixed submission:
# -*- Coding: utf-8 -*-

x = int(input())
min_sosu = x
flg_found = False

for i in range(x, 1000000):
    for j in range(2, i*i):
        if i%j == 0 and j < x:
            break
        if i%j == 0 and j >= x and i == j:
            min_sosu = i
            flg_found = True
            print(min_sosu)
            break
    if flg_found:
        break

Buggy submission (verdict: Runtime Error):
# -*- Coding: utf-8 -*-

x = int(input())
min_sosu = x


for i in range(x, 100000):
    for j in range(2, 100000):
        if i%j == 0 and j < x:
            break
        if i%j == 0 and j >= x and i == j:
            min_sosu = i
            print(min_sosu)
            exit(1)

if min_sosu == x:
    print(min_sosu)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
if a >= 3200:
    print(s)
elif a<3200:
    print("red")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=str(input())
if a=>3200:
    print(s)
elif a<3200:
    print("red")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=str(input())
if a=>3200:
    print(s)
elif a<3200:
    print("red")
Problem p02880 (python)

Fixed submission:
import sys
N = int(input())

for i in range(1, 10):
  for k in range(1,10):
    if N == i * k:
      print("Yes")
      sys.exit()

print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())

for i in range(1, 10):
  for k in range(1,10):
    if N == i * k:
      print("Yes")
      sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
for i in range(1, 10):
  for k in range(1,10):
    if N == i * k:
      print("Yes")
      sys.exit()
print("No")
Problem p02897 (python)

Fixed submission:
a = int(input())

i = 1
odds = 0
while i <= a:
    if i % 2 == 1:
        odds = odds + 1
        i = i +1
    else:
        i = i + 1

print(odds/a)

Buggy submission (verdict: Runtime Error):
num = int(input())
each_num = list(map(int, input().split(" ")))

ans = []

i = 1
for k in range(1, num+1):
    ans.append(each_num.index(k) + 1)
print(*ans)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = str(input())

if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a = int(input())
s = int(input())

if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a = input()
s = input()

if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a = input()
s = input()

if a <= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
if a <= 3200:
    print(s)
else:
    print("red")
Problem p02879 (python)

Fixed submission:
a, b = map(int, input().split())
if 1<= a <= 9 and 1<= b <= 9:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if 1<= a <= 9 and 1<= b <= 9:
    print(a*b)
else:
    print(-1
Problem p03075 (python)

Fixed submission:
def solve():
  ABCDEF = [int(input()) for i in range(5)]
  K = int(input())
  return ':(' if max(ABCDEF) - min(ABCDEF) > K else 'Yay!'

print(solve())

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = []
for a in A:
  for b in B:
    AB.append(a + b)

AB.sort(reverse=True)
AB = AB[:min(3001, X * Y * Z + 1)]
ABC = []
for ab in AB:
  for c in C:
    ABC.append(ab + c)
ABC.sort(reverse=True)
print(*ABC[:K], sep='\n')
Problem p03135 (python)

Fixed submission:
def solve():
  A, B = map(int, input().split())
  return A / B

print(solve())

Buggy submission (verdict: Runtime Error):
def solve(N):
  A, B = map(int, input().split())
  return A / B

print(solve())
Problem p03242 (python)

Fixed submission:
print(1110-int(input()))

Buggy submission (verdict: Runtime Error):
print(1110-input())
Problem p02970 (python)

Fixed submission:
inputs = [int(x) for x in input().split()]

N = inputs[0]
D = inputs[1]
answer = 0
if N > (D*2) + 1:
  check = N % ((D*2) + 1)
  answer = N / ((D*2) + 1) 
  answer = int(answer)
  if check != 0:
    answer += 1
  
else:
  answer = 1
  
print(answer)

Buggy submission (verdict: Runtime Error):
inputs = [int(x) for x in input().split()]

N = inputs[0]
D = inputs[1]
answer = 0
if N < (D*2) + 1:
  answer = 1
else:
  check = N % ((D*2) + 1)
  answer = N / ((D*2) + 1) 
  answer = int(answer)
if check != 0:
  answer += 1
  
print(answer)
Problem p02831 (python)

Fixed submission:
def gcd(x,y):
  while y:
    x,y = y,x%y
  return x

A,B = map(int,input().split())
gd = gcd(A,B)
hf = A*B//gd
print(hf)

Buggy submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
gd = math.gcd(A,B)
hf = A*B//gd
print(hf)
Problem p02851 (python)

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
for i in range(N):
  A[i] -= 1
  A[i] %= K

hm = {}
hm[A[0]] = 1
out = 0
for i in range(1,N):
  A[i] += A[i-1]
  A[i] %= K

for i in range(min(K-1,N)):
  if A[i]==0 and K != 1:
    out+=1
    
for i in range(1,min(N,K)):
  if A[i] in hm:
    hm[A[i]]+=1
  else:
    hm[A[i]]=1
  out += hm[A[i]]-1
  
for i in range(min(K,N),N):
  if A[i] in hm:
    hm[A[i]]+=1
  else:
    hm[A[i]]=1
  hm[A[i-K]] -= 1
  out += hm[A[i]]-1

print(int(out))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
for i in range(N):
  A[i] -= 1
  A[i] %= K

hm = {}
hm[A[0]] = 1
out = 0
for i in range(1,N):
  A[i] += A[i-1]
  A[i] %= K

for i in range(K-1):
  if A[i]==0:
    out+=1
    
for i in range(1,K-1):
  if A[i] in hm:
    hm[A[i]]+=1
  else:
    hm[A[i]]=1
  out += hm[A[i]]-1
  
for i in range(K-1,N):
  if A[i] in hm:
    hm[A[i]]+=1
  else:
    hm[A[i]]=1
  hm[A[i-K+1]] -= 1
  out += hm[A[i]]-1

print(int(out))
Problem p03315 (python)

Fixed submission:
s = input()
n = 0
for i in range(len(s)):
    if s[i] == '+':
        n = n + 1
    else:
        n = n - 1
print(n)

Buggy submission (verdict: Runtime Error):
s = input().split('')
n = 0
for si in s:
    if si == '+':
        n = n + 1
    else:
        n = n - 1
print(n)
Problem p03326 (python)

Fixed submission:
nm = [int(ai) for ai in input().split(' ')]
N = nm[0]
M = nm[1]
cakes = [[int(si) for si in input().split(' ')] for i in range(N)]
signs = [[(-1)**i, (-1)**j, (-1)**k] for i in range(2)
                                     for j in range(2)
                                     for k in range(2)]
answer = 0
for sign in signs:
    values = [sum([cake[i] * sign[i] for i in range(3)]) for cake in cakes]
    answer = max(sum(sorted(values, reverse=True)[:M]), answer)
print(answer)

Buggy submission (verdict: Runtime Error):
nm = [int(ai) for ai in input().split(' ')]
N = nm[0]
M = nm[1]
cakes = [[int(si) for si in input().split(' ')] for i in range(a[0])]
signs = [[(-1)**i, (-1)**j, (-1)**k] for i in range(2)
                                     for j in range(2)
                                     for k in range(2)]
answer = 0
for sign in signs:
    values = [[cake[i] * sign[i] for i in range(3)] for cake, sign in zip(cakes, signs)]
    answer = max(max(values), answer)
print(answer)

Buggy submission (verdict: Runtime Error):
a = [int(ai) for ai in input().split(' ')]
n = a[1]
s = [input().split(' ') for i in range(a[0])]

points = []
for si in s:
    p = 0
    for sij in si:
        p += int(sij)
    points.append(p)

points = sorted(points, reverse=True)
max_point = points[0] + points[1] + points[2]
print(max_points)
Problem p02832 (python)

Fixed submission:
import sys

n = int(input())
numbers = list(map(int, sys.stdin.readline().split()))

if 1 not in numbers:
    print(-1)
    sys.exit(0)

breaks = 0
current = 1
for i in range(n):
    if numbers[i] == current:
        current += 1
    else:
        breaks += 1
print(breaks)

Buggy submission (verdict: Runtime Error):
import sys

n = int(input())
numbers = list(map(int, input().split()))

if numbers == []:
    print(-1)
    sys.exit(0)

index = 0
value = 1
breaks = 0
while True:
    while numbers[index] != value:
        if index >= len(numbers):
            print(-1)
            sys.exit(0)
        numbers.pop(index)
        breaks += 1
    index += 1
    value += 1
    if index >= len(numbers):
        print(breaks)
        sys.exit(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
numbers = list(map(int, input().split()))


def destroy(ns):
    if len(ns) == 0:
        return None
    if len(ns) == 1:
        return 0 if ns[0] == 1 else None
    satisfies = True
    for i, s in enumerate(ns):
        if i + 1 != s:
            satisfies = False
            break
    if satisfies:
        return 0
    min_breaks = None
    if ns[0] != 1:
        ans = destroy(ns[1:])
        if ans is None:
            return None
        return 1 + ans
    for i in range(len(ns) - 1):
        breaks = destroy(ns[:i] + ns[i+1:])
        if breaks is None:
            continue
        breaks += 1
        if min_breaks is None:
            min_breaks = breaks
            continue
        if breaks < min_breaks:
            min_breaks = breaks
    return min_breaks

ans = destroy(numbers)
print(-1 if ans is None else ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
numbers = list(map(int, input().split()))


def destroy(ns):
    if len(ns) == 0:
        return None
    satisfies = True
    for i, s in enumerate(ns):
        if i + 1 != s:
            satisfies = False
            break
    if satisfies:
        return 0
    min_breaks = None
    if ns[0] != 1:
        ans = destroy(ns[1:])
        if ans is None:
            return None
        return 1 + ans
    for i in range(len(ns) - 1):
        breaks = destroy(ns[:i] + ns[i+1:])
        if breaks is None:
            continue
        breaks += 1
        if min_breaks is None:
            min_breaks = breaks
            continue
        if breaks < min_breaks:
            min_breaks = breaks
    return min_breaks

ans = destroy(numbers)
print(-1 if ans is None else ans)
Problem p02897 (python)

Fixed submission:
n = int(input())
if n % 2 == 0:
	print(0.5)
else:
	print((1 + n//2) / n)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

divisors = []
for i in range(1, min(A,B) + 1):
	if A % i == 0 and B % i == 0:
		divisors.append(i)


done = {}
def is_coprime(a,b):
	if (a,b) in done:
		return done[a,b]
	if b == 1:
		return True
	for i in range(2, min(A,B)):
		if a % i == 0 and b % i == 0:
			done[(a,b)] = False
			return False
	done[(a,b)] = True
	return True


def getMaxLen(sofar, divisors):
	if len(divisors) == 0:
		return len(sofar)
	curr_max = getMaxLen(sofar,divisors[1:])
	for i in range(len(divisors)):
		d = divisors[i]
		flag = False
		for s in sofar:
			if not is_coprime(d,s):
				flag = True
				break
		if flag:
			continue
		new = sofar.copy()
		
		new.append(d)
		curr_max = max(curr_max, getMaxLen(new, divisors[i+1:]))
	return curr_max

print(getMaxLen([], divisors))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

divisors = []
for i in range(1, min(A,B) + 1):
	if A % i == 0 and B % i == 0:
		divisors.append(i)

def is_coprime(a,b):
	for i in range(2, min(A,B)):
		if a % i == 0 and b % i == 0:
			return False
	return True

def getMaxLen(sofar, divisors):
	if len(divisors) == 0:
		return len(sofar)
	curr_max = getMaxLen(sofar,divisors[1:])
	for i in range(len(divisors)):
		d = divisors[i]
		flag = False
		for s in sofar:
			if not is_coprime(d,s):
				flag = True
				break
		if flag:
			continue
		new = sofar.copy()
		
		new.append(d)
		curr_max = max(curr_max, getMaxLen(new, divisors[i+1:]))
	return curr_max

print(getMaxLen([], divisors))