Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
h,w = tuple(map(int,input().split()))

a = [[int(t)for t in input().split()]for _ in [0]*h]

steps = []
for i in range(h):
  for j in range(w-1):
    if a[i][j]%2==1:
      steps.append((i,j,i,j+1))
      a[i][j+1]+=1

for i in range(h-1):
  if a[i][w-1]%2==1:
    steps.append((i,j,i+1,j))
    
print(len(steps))
for s in steps:
  print(*s)
      
      



Fixed submission:
h,w = tuple(map(int,input().split()))

a = [[int(t)for t in input().split()]for _ in [0]*h]

steps = []
for i in range(h):
  if i%2==0:
    for j in range(w-1):
      if a[i][j]%2==1:
        steps.append((i+1,j+1,i+1,j+2))
        a[i][j+1]+=1
    if i!=h-1 and a[i][-1]%2==1:
      steps.append((i+1,w,i+2,w))
      a[i+1][-1] +=1
  else:
    for j in range(1,w)[::-1]:
      if a[i][j]%2==1:
        steps.append((i+1,j+1,i+1,j))
        a[i][j-1]+=1
    if i!=h-1 and a[i][0]%2==1:
      steps.append((i+1,1,i+2,1))
      a[i+1][0] +=1

    
print(len(steps))
for s in steps:
  print(*s)
Buggy python submission (verdict: Runtime Error):
s = list(input())

k = int(input())

p = -1
for i in range(len(s)):
  if s[i]!='1':
    p=i+1

if p=-1:
  print(1)
else:
  if k<p:
    print(1)
  else:
    print(s[p])

Fixed submission:
s = list(input())

k = int(input())

p = -1
for i in range(len(s)):
  if s[i]!='1':
    p=i
    break

if p==-1:
  print(1)
else:
  if k<p+1:
    print(1)
  else:
    print(s[p])
Buggy python submission (verdict: Runtime Error):
s = list(input())

if s[0]!="A":
  print("WA")
  exit()

frag = True
for i in range(2,len(s)-2):
  if s[i]=='C':
    frag = False
    del s[i]

if frag:
  print("WA")
  exit()
  
if not "".join(s[1:]).islower():
  print("WA")
else:
  print("AC")

Fixed submission:
s = list(input())

if s[0]!="A":
  print("WA")
  exit()

frag = True
for i in range(2,len(s)-1):
  if s[i]=='C':
    frag = False
    del s[i]
    break

if frag:
  print("WA")
  exit()
  
if not "".join(s[1:]).islower():
  print("WA")
else:
  print("AC")
Buggy python submission (verdict: Runtime Error):
s=input()
print(s.count("+")-s.count("-")

Fixed submission:
s=input()
print(s.count("+")-s.count("-"))
Buggy python submission (verdict: Runtime Error):
x = int(input())
candidates = []
for i in range(x):
  for j in range(2,x):
    t = i**j
    if x>=t:
      candidates.append(t)
    else:
      break
print(max(candidates))

Fixed submission:
x = int(input())
if x == 1:
  print(1)
elif x==2:
  print(1)
else:
  candidates = []
  for i in range(x):
    for j in range(2,x):
      t = i**j
      if x>=t:
        candidates.append(t)
      else:
        break
  print(max(candidates))
Buggy python submission (verdict: Runtime Error):
a,b = tuple(map(int,input().split()))

s = list(input())[::-1]

for _ in [0]*a:
  if not s.pop().isdigit():
    print("No")
    exit()
if s.pop() != '-'
    print("No")
    exit()

for _ in [0]*b:
  if not s.pop().isdigit():
    print("No")
    exit()
print("Yes")



Fixed submission:
a,b = tuple(map(int,input().split()))

s = list(input())[::-1]

for _ in [0]*a:
  if not s.pop().isdigit():
    print("No")
    exit()
if s.pop() != '-':
    print("No")
    exit()

for _ in [0]*b:
  if not s.pop().isdigit():
    print("No")
    exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
x,y = tuple(map(int,input().split()))

for i in range(1,10*4):
  x<<=1
  if x>y:
    print(i)
	break

Fixed submission:
x,y = tuple(map(int,input().split()))

for i in range(1,10**18):
  x<<=1
  if x>y:
    print(i)
    break
Buggy python submission (verdict: Runtime Error):
import math
from collections import deque
def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    if all([a_i>0 for a_i in a]):
        print(n-1)
        for i in range(n-1):
            print(i+1,i+2)
        
    elif all([a_i<=0 for a_i in a]):
        print(n-1)
        for i in range(2,n+1)[::-1]:
            print(i,i-1)
    else:
        if abs(min(a))<max(a):
            print(2*n-1)
            pos = list.index(max(a))  
            for i in range(n):
                print(pos,i+1)
            for i in range(2,n+1)[::-1]:
                print(i,i-1)


        else:
            print(2*n-1)
            pos = list.index(min(a))
            for i in range(n):
                print(pos,i+1)  
            
            for i in range(2,n+1)[::-1]:
                print(i,i-1)
    
if __name__ == "__main__":
    main()

Fixed submission:
import math
from collections import deque
def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    if all([a_i>0 for a_i in a]):
        print(n-1)
        for i in range(n-1):
            print(i+1,i+2)
        
    elif all([a_i<=0 for a_i in a]):
        print(n-1)
        for i in range(2,n+1)[::-1]:
            print(i,i-1)
    else:
        if abs(min(a))<max(a):
            print(2*n-1)
            pos = a.index(max(a))  
            for i in range(n):
                print(pos+1,i+1)
            for i in range(n-1):
                print(i+1,i+2)


        else:
            print(2*n-1)
            pos = a.index(min(a))
            for i in range(n):
                print(pos+1,i+1)  
            
            for i in range(2,n+1)[::-1]:
                print(i,i-1)
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import itertools

n = int(input())
a = tuple(map(int,input().split()))
ans = 0
for l in itertools.product([-1,0,1],n):
  t = 1
  for i in range(n):
    t*=(a[i]+l[i])
  if t%2==0:
    ans+=1
print(ans)

Fixed submission:
import itertools

n = int(input())
a = tuple(map(int,input().split()))
ans = 0
for l in itertools.product([-1,0,1],repeat=n):
  t = 1
  for i in range(n):
    t*=(a[i]+l[i])
  if t%2==0:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
def main():

    s = deque(input())

    

    ans = 0
    while s!=[]:
        if s[0]==s[-1]:
            s.popleft()
            if len(s)>0:
                s.pop()
            else:
                break
            continue
        if s[0]!='x' and s[-1]!='x':
            ans = -1
            break
        if s[0]=='x':
            ans+=1
            s.popleft()
        if s[-1]=='x':
            ans+=1
            s.pop()
    
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from collections import deque
def main():

    s = deque(input())

    

    ans = 0
    while len(s)>1:
        if s[0]==s[-1]:
            s.popleft()
            s.pop()
            continue
        if s[0]!='x' and s[-1]!='x':
            ans = -1
            break
        if s[0]=='x':
            ans+=1
            s.popleft()
        if s[-1]=='x':
            ans+=1
            s.pop()
    
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
 
x = tuple([int(t)for t in input().split()]) 
 
ans = 0
for x_i in x:
  if k-x>x:
    ans+=x*2
  else:
    ans+=(k-x)*2

Fixed submission:
n = int(input())
k = int(input())
 
x = tuple([int(t)for t in input().split()]) 
 
ans = 0
for x_i in x:
  if k-x_i>x_i:
    ans+=x_i*2
  else:
    ans+=(k-x_i)*2
    
print(ans)
Buggy python submission (verdict: Runtime Error):
s = set(list("abcdefghijklmnopqrstuvwxyz"))-set(list(input()))
if len(s)==0:
  print("None")
else:
  print(s[0])

Fixed submission:
s = set(list("abcdefghijklmnopqrstuvwxyz"))-set(list(input()))
if len(s)==0:
  print("None")
else:
  print(min(s))
Buggy python submission (verdict: Runtime Error):
x,y = tuple(map(int,input().split()))

for i in range(1,10*18):
  x<<=1
  if x>y:
    print(i)
    break


Fixed submission:
x,a,b = tuple(map(int,input().split()))
 
if a-b>=0 :
  print("delicious")
elif b-a<=x:
  print("safe")
else:
  print("dangerous")

Buggy python submission (verdict: Runtime Error):
x,a,b = tuple(map(int,input().split()))

if b-a=<x:
  print("delicious")
else:
  print("dangerous")

Fixed submission:
x,a,b = tuple(map(int,input().split()))
 
if a-b>=0 :
  print("delicious")
elif b-a<=x:
  print("safe")
else:
  print("dangerous")
Buggy python submission (verdict: Runtime Error):
a,b,c = tuple(map(int,input().split()))
if len(set((a,b,c)))<3:
  print(-1)
else:
  ans = 0
  while True:
    if a%2==0 and b%2==0 and c%2==0:
      a,b,c == b//2+c//2,c//2+a//2,a//2+b//2
      ans+=1
    else:
      break
    if len(set((a,b,c)))<3:
  print(-1)
      
  print(ans)


Fixed submission:
a,b,c = tuple(map(int,input().split()))
if len(set((a,b,c)))==1 and a%2==1:
    print(0)
    exit()
ans = 0
while True:
  if len(set((a,b,c)))==1:
    print(-1)
    exit()
  if a%2==0 and b%2==0 and c%2==0:
    a,b,c = b//2+c//2,c//2+a//2,a//2+b//2
    ans+=1
  else:
    break
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c = tuple(map(int,input().split()))
if a==b and b==c:
  print(-1)
ans = 0
else:
  while True:
    if a%2==0 and b%2==0 and c%2==0:
      a,b,c == b//2+c//2,c//2+a//2,a//2+b//2
      ans+=1
    else:
      break
      
print(ans)

Fixed submission:
a,b,c = tuple(map(int,input().split()))
if len(set((a,b,c)))==1 and a%2==1:
    print(0)
    exit()
ans = 0
while True:
  if len(set((a,b,c)))==1:
    print(-1)
    exit()
  if a%2==0 and b%2==0 and c%2==0:
    a,b,c = b//2+c//2,c//2+a//2,a//2+b//2
    ans+=1
  else:
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import ceil
 
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
 
T.sort()
 
bus = 0
bus_time = T[0] + K
tmp_bus = 1
 
for i in range(1,N):
    if T[i] > bus_time:
        bus += 1
        bus_time = T[i+1] + K
        tmp_bus = 0
    else:
        tmp_bus += 1
    
    if tmp_bus == C:
        bus += 1
        bus_time = T[i+1] + K
        tmp_bus = 0
 
print(bus+1)

Fixed submission:
n,c,k = tuple(map(int,input().split()))
t = []

for i in range(n):
  t.append(int(input()))
t = sorted(t)
t_0 = t[0]
p = 1
ans = 0
for t_i in t[1:]:
  if p<c and t_i-t_0<=k:
    p+=1
  else:
    p = 1
    t_0 = t_i
    ans+=1
    
print(ans+1)
Buggy python submission (verdict: Runtime Error):
n = int(input())

s = input()
x = 0
ans = 0
for c in s:
  if c=='I'
  	x+=1
    ans = max(x,ans)
  else:
    x-=1
print(ans)

Fixed submission:
n = int(input())

s = input()
x = 0
ans = 0
for c in s:
  if c=='I':
    x+=1
    ans = max(x,ans)
  else:
    x-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w = tuple(map(int,input().split()))

s = [input() for_ in range(h)]

for s_i in s:
  print(s_i)
  print(s_i)
  


Fixed submission:
h,w = tuple(map(int,input().split()))

s = [input() for _ in range(h)]

for s_i in s:
  print(s_i)
  print(s_i)

Buggy python submission (verdict: Runtime Error):
h,w = tuple(map(int,input().split()))

s = [input() for_ in range(h)]

for s_i in s:
  print(*s_i,sep='')
  print(*s_i,sep='')
  


Fixed submission:
h,w = tuple(map(int,input().split()))

s = [input() for _ in range(h)]

for s_i in s:
  print(s_i)
  print(s_i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = tuple(map(lambda a:int(a)-1,input()))

ans = 0
for i in range(n):
  if a[a[i]]==i:
    ans+=1
print(ans//2)

Fixed submission:
n = int(input())
a = tuple(map(lambda a:int(a)-1,input().split()))

ans = 0
for i in range(n):
  if a[a[i]]==i:
    ans+=1
print(ans//2)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

s = input()

c = Counter(s)

for i in c:
  if i%2!=0:
    print("No")
    exit()
print("Yes")

Fixed submission:
from collections import Counter

s = list(input())

c = Counter(s)

for i in c.values():
  if i%2!=0:
    print("No")
    exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
s = set(list(input()))

if 'N' in s:
  if not 'S' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()
    
if 'S' in s:
  if not 'N' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()

if 'W' in s:
  if not 'E' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()

if 'E' in s:
  if not 'W' in s:
    print("No")
    exit()
  elif s(len) == 2 or s(len)==4:
    print("Yes")
    exit()
print("No")

Fixed submission:
s = set(list(input()))

if 'N' in s:
  if not 'S' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()
    
if 'S' in s:
  if not 'N' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()

if 'W' in s:
  if not 'E' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()

if 'E' in s:
  if not 'W' in s:
    print("No")
    exit()
  elif len(s) == 2 or len(s)==4:
    print("Yes")
    exit()
    
print("No")
Buggy python submission (verdict: Runtime Error):
a,b = tuple(map(int,input().split()))

if a=<0 and b>=0:
  print("Zero")
elif a<0 and b<0:
  if (b-a+1)%2==0:
  	print("Positive")
  else:
    print("Negative")
elif a>0 and b>0:
  print("Positive")


Fixed submission:
a,b = tuple(map(int,input().split()))

if a<=0 and b>=0:
  print("Zero")
elif a<0 and b<0:
  if (b-a+1)%2==0:
  	print("Positive")
  else:
    print("Negative")
elif a>0 and b>0:
  print("Positive")
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
lcm = a[0]
for i in range(1,n):
  lcm = lcm*a[i] // gcd(lcm,a[i])
mod=pow(10,9)+7
ans=0
for x in a:
  ans+=lcm//x
print(ans%mod)

Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
lcm = a[0]
for i in range(1,n):
  lcm = lcm*a[i] // gcd(lcm,a[i])
mod=pow(10,9)+7
ans=0
for x in a:
  ans+=lcm//x
print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]

def count(n):
    A = [0]
    c = 0
    i = 1
    while(n):
        if n & 1:
            A.append(i)
            c += 1
        n >>= 1
        i += 1
    A.append(H)
    return c, A


ans = 2000
for n in range(1 << (H-1)):
    c, A = count(n)
    X = [0]*(len(A)-1)
    j = 0
    flag=True
    while j < W:
        for k in range(len(A)-1):
            for i in range(A[k], A[k+1]):
                if S[i][j] == "1":
                    X[k] += 1
        for x in X:
            if x > K:
                if flag:
                    c += 10000
                    break
                flag = True
                c += 1
                X = [0]*(len(A)-1)
                break
        else:
            flag = False
            j += 1
        if c > 10000:
            break
    ans = min(ans, c)
print(ans)


Fixed submission:
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]

def count(n):
    A = [0]
    c = 0
    i = 1
    while(n):
        if n & 1:
            A.append(i)
            c += 1
        n >>= 1
        i += 1
    A.append(H)
    return c, A


ans = 2000
for n in range(1 << (H-1)):
    c, A = count(n)
    X = [0]*(len(A)-1)
    j = 0
    flag=True
    while j < W:
        for k in range(len(A)-1):
            for i in range(A[k], A[k+1]):
                if S[i][j] == "1":
                    X[k] += 1
        for x in X:
            if x > K:
                if flag:
                    c += 10000
                    break
                flag = True
                c += 1
                X = [0]*(len(A)-1)
                break
        else:
            flag = False
            j += 1
        if c > 10000:
            break
    ans = min(ans, c)
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    a = input()
    b = input()
    c = input()
    A, B, C = len(a), len(b), len(c)
    ab = [True]*10000
    ac = [True]*10000
    bc = [True]*10000

    def check(c1, c2):
        if c1 == '?' or c2 == '?' or c1 == c2:
            return False
        return True

    for i in range(A):
        for j in range(B):
            if check(a[i], b[j]):
                ab[i-j+5000] = False
    for i in range(A):
        for j in range(C):
            if check(a[i], c[j]):
                ac[i-j+5000] = False
    for i in range(B):
        for j in range(C):
            if check(b[i], c[j]):
                bc[i-j+5000] = False
    ans = A + B + C
    for i in range(-(B+C), A+C):
        for j in range(-(B+C), A+B):
            if ab[i+5000] and ac[j+5000] and bc[j-i+5000]:
                L = min(0, i, j)
                R = max(A, i+B, j+C)
                ans = min(ans, R - L)
    print(ans)


main()


Fixed submission:
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(A[k-1])
Buggy python submission (verdict: Time Limit Exceeded):

mod = 10**9 + 7


def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for k in range(60):
        a = 0
        for i in range(n):
            a += A[i] & 1
            A[i] >>= 1
        da = (1 << k) % mod
        da *= (n - a)*a
        da %= mod
        ans += da
        ans %= mod
    print(ans)


main()


Fixed submission:

mod = 10**9 + 7


def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for k in range(60):
        a = 0
        for i in range(n):
            a += A[i] & 1
            A[i] >>= 1
        da = (1 << k) % mod
        da *= (n - a)*a
        da %= mod
        ans += da
        ans %= mod
    print(ans)


main()

Buggy python submission (verdict: Runtime Error):

mod = 10**9 + 7


def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for k in range(60):
        a = 0
        for i in range(n):
            a += A[i] & 1
            A[i] << = 1
        da = (1 << k) % mod
        da *= (n - a)*a
        da %= mod
        ans += da
        ans %= mod
    print(ans)


main()


Fixed submission:

mod = 10**9 + 7


def main():
    n = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for k in range(60):
        a = 0
        for i in range(n):
            a += A[i] & 1
            A[i] >>= 1
        da = (1 << k) % mod
        da *= (n - a)*a
        da %= mod
        ans += da
        ans %= mod
    print(ans)


main()
Buggy python submission (verdict: Runtime Error):
from collections import Counter
def main():
   s = input()
   k = int(input())
   li = []
   num = 1
   for i in range(len(s)-1):
       if s[i] != s[i+1]:
           li.append(1)
       else:
           li[-1] += 1
   temp = 0
   ans = 0
   if len(list((Counter(li).keys()))) == 1:
       ans += len(s) * k // 2
   else:
       for i in li:
           temp += i//2
       if s[0] != s[-1]:
           ans = temp * k
       else:
           li[0] += li[-1]
           for i in li[:-1]:
               ans += i//2
           ans = ans * (k-1) + temp
   print(ans)
main()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5)


def main():
    S = input()
    K = int(input())

    c = S[0]
    count = [1]
    for s in S[1:]:
        if c == s:
            count[-1] += 1
        else:
            count.append(1)
            c = s

    if S[0] != S[-1]:
        ans = sum(map(lambda x: x // 2, count))
        ans *= K
        print(ans)
        return

    if len(count) == 1:
        ans = (count[0] * K) // 2
        print(ans)
        return

    ans = 0
    for c in count:
        ans += c // 2
    count[0] += count[-1]
    ans += sum(map(lambda x: x // 2, count[:-1])) * (K - 1)
    print(ans)


main()
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

def main():
  a,b = map(int, input().split())
  g = gcd(a,b)
  N = int(g**0.5)
  ans = 1
  for i in range(2, N+1):
    if g%i==0:
	  ans += 1
    while(g%i==0):
      g /= i
  if g != 1:
    ans += 1
  print(ans)

main()

Fixed submission:
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

a,b = map(int, input().split())
g = gcd(a,b)
N = int(g**0.5)
ans = 1
for i in range(2, N+1):
  if g%i==0:
    ans += 1
  while(g%i==0):
    g /= i
if g != 1:
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

def main():
  a,b = map(int, input().split())
  g = gcd(a,b)
  N = int(g*0.5)
  ans = 1
  for i in range(2, N+1):
    flag = 0
    while(g%i==0):
      g /= i
      flag = 1
    ans += flag
  if g != 1:
    ans += 1
  print(ans)

main()

Fixed submission:
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

a,b = map(int, input().split())
g = gcd(a,b)
N = int(g**0.5)
ans = 1
for i in range(2, N+1):
  if g%i==0:
    ans += 1
  while(g%i==0):
    g /= i
if g != 1:
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

def main():
  a,b = map(int, input().split())
  g = gcd(a,b)
  N = int(g*0.5)
  ans = 1
  for i in range(2, N+1):
    flag = 0
    while(g%i==0):
      g /= i
      flag = 1
    ans += flag
  if g != 1:
    ans += 1
  print(ans)

main()

Fixed submission:
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

a,b = map(int, input().split())
g = gcd(a,b)
N = int(g**0.5)
ans = 1
for i in range(2, N+1):
  if g%i==0:
    ans += 1
  while(g%i==0):
    g /= i
if g != 1:
  ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

int main():
  a,b = map(int, input().split())
  g = gcd(a,b)
  N = int(g*0.5)
  ans = 1
  for i in range(2, N+1):
    flag = 0
    while(g%i==0):
      g /= i
      flag = 1
    ans += flag
  if g != 1:
    ans += 1
  print(ans)

main()

Fixed submission:
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

a,b = map(int, input().split())
g = gcd(a,b)
N = int(g**0.5)
ans = 1
for i in range(2, N+1):
  if g%i==0:
    ans += 1
  while(g%i==0):
    g /= i
if g != 1:
  ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

a,b = map(int, input().split())
g = gcd(a,b)
N = int(g*0.5)
ans = 1
for i in range(2, N+1):
  flag = 0
  while(g%i==0):
    g /= i
    flag = 1
  ans += flag
if g != 1:
  ans += 1
print(ans)

Fixed submission:
def gcd(a, b):
  if b==0:
    return a
  return gcd(b, a%b)

a,b = map(int, input().split())
g = gcd(a,b)
N = int(g**0.5)
ans = 1
for i in range(2, N+1):
  if g%i==0:
    ans += 1
  while(g%i==0):
    g /= i
if g != 1:
  ans += 1
print(ans)