Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    s = input().strip()
    k = int(input().strip())

    ss = []
    for i in range(0, len(s)):
        for j in range(i, len(s)+1):
            if i == j:
                continue
            if len(ss) == 8:
                if ss[-1] > s[i:j]:
                    ss[-1] = s[i:j]
                    ss = list(set(ss))
                    ss.sort()
            else:
                ss.append(s[i:j])
                ss = list(set(ss))
                ss.sort()

    print(ss[k-1])

if __name__ == '__main__':
    main()


Fixed submission:

def main():
    s = input().strip()
    k = int(input().strip())

    ss = []
    for i in range(0, len(s)):
        for j in range(i, i + k + 1):
            if i == j:
                continue
            if len(ss) == 6:
                if ss[-1] > s[i:j]:
                    ss[-1] = s[i:j]
                    ss = list(set(ss))
                    ss.sort()
            else:
                ss.append(s[i:j])
                ss = list(set(ss))
                ss.sort()

    print(ss[k-1])

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):

def main():
    s = input().strip()
    k = int(input().strip())

    ss = []
    for i in range(0, len(s)):
        for j in range(i, len(s)+1):
            if i == j:
                continue
            ss.append(s[i:j])

    ss = list(set(ss))
    ss.sort()
    print(ss[k-1])

if __name__ == '__main__':
    main()


Fixed submission:

def main():
    s = input().strip()
    k = int(input().strip())

    ss = []
    for i in range(0, len(s)):
        for j in range(i, i + k + 1):
            if i == j:
                continue
            if len(ss) == 6:
                if ss[-1] > s[i:j]:
                    ss[-1] = s[i:j]
                    ss = list(set(ss))
                    ss.sort()
            else:
                ss.append(s[i:j])
                ss = list(set(ss))
                ss.sort()

    print(ss[k-1])

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):

def main():
    x, y = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            link = False
            if a[j][i] == '#':
                if i-1 >= 0 and a[j][i-1] == '#':
                    link = True
                if i+1 < x and a[j][i+1] == '#':
                    link = True
                if j-1 >= 0 and a[j-1][i] == '#':
                    link = True
                if j+1 < y and a[j+1][i] == '#':
                    link = True

                if not link:
                    print('No')
                    return

    print('Yes')

if __name__ == '__main__':
    main()


Fixed submission:

def main():
    y, x = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            link = False
            if a[j][i] == '#':
                if i-1 >= 0 and a[j][i-1] == '#':
                    link = True
                if i+1 < x and a[j][i+1] == '#':
                    link = True
                if j-1 >= 0 and a[j-1][i] == '#':
                    link = True
                if j+1 < y and a[j+1][i] == '#':
                    link = True

                if not link:
                    print('No')
                    return

    print('Yes')

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):

def main():
    x, y = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            f = False
            if a[j][i] == '#':
                if i-1 > 0 and a[j][i-1] == '#':
                    f = True
                if i+1 < x and a[j][i+1] == '#':
                    f = True
                if j-1 > 0 and a[j-1][i] == '#':
                    f = True
                if j+1 < y and a[j+1][i] == '#':
                    f = True

                if not f:
                    print('No')
                    return

    print('Yes')

if __name__ == '__main__':
    main()


Fixed submission:

def main():
    y, x = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            link = False
            if a[j][i] == '#':
                if i-1 >= 0 and a[j][i-1] == '#':
                    link = True
                if i+1 < x and a[j][i+1] == '#':
                    link = True
                if j-1 >= 0 and a[j-1][i] == '#':
                    link = True
                if j+1 < y and a[j+1][i] == '#':
                    link = True

                if not link:
                    print('No')
                    return

    print('Yes')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    a, b, k = [int(i) for i in input().split()]

    s = set()
    for i in range(k):
        if a <= a+i and a+i <= b:
            s.add(a+i)
    for i in reversed(range(k)):
        if a <= b-i and b-i <= b:
            s.add(b-i)

    ans = list(s)
    ans.sort()

    for a in ans:
        print(a)
            
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input().strip())
    s = [input().strip() for _ in range(n)]
    m = int(input().strip())
    t = [input().strip() for _ in range(m)]


    cand = list(set(s))
    g = [s.count(c) - t.count(c) for c in cand]
    ans = max(g)
    if ans < 0:
        print(0)
    else:
        print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    n, m = [int(i) for i in input().split()]

    def flip(v):
        return '.' if v == '#' else '#'

    a = [['#' for _ in range(n)] for _ in range(m)]
    for i in range(n):
        for j in range(m):
            a[j  ][i  ] = flip(a[j  ][i  ])
            if j-1 >= 0:
                a[j-1][i  ] = flip(a[j-1][i  ])
            if i-1 >= 0:
                a[j  ][i-1] = flip(a[j  ][i-1])
            if j+1 < m:
                a[j+1][i  ] = flip(a[j+1][i  ])
            if i+1 < n:
                a[j  ][i+1] = flip(a[j  ][i+1])
            if j+1 < m and i+1 < n:
                a[j+1][i+1] = flip(a[j+1][i+1])
            if j-1 >= 0 and i-1 >= 0:
                a[j-1][i-1] = flip(a[j-1][i-1])
            if j+1 < m and i-1 >= 0:
                a[j+1][i-1] = flip(a[j+1][i-1])
            if j-1 >= 0 and i+1 < n:
                a[j-1][i+1] = flip(a[j-1][i+1])

    c = 0
    for i in range(n):
        for j in range(m):
            if a[j][i] == '.':
                c += 1

    print(c)

if __name__ == '__main__':
    main()


Fixed submission:

def main():
    nm = [int(i) for i in input().split()]

    nm.sort()
    # 自身と周辺のカードの枚数を数えて、偶数なら表、奇数なら裏
    if nm[0] == 1 and nm[1] == 1:
        # 1枚の時
        print(1)
    elif nm[0] == 1 and nm[1] == 2:
        # 2枚の時
        print(2)
    elif nm[0] == 1 and nm[1] > 2:
        # 1列の時、両端は自身と隣接2枚、途中は3枚なので、途中が裏
        print(nm[1] - 2)
    elif nm[0] == 2:
        # 2列の時、4隅が自身と隣接4枚、他は6枚
        print(0)
    elif nm[0] > 2 and nm[1] > 2:
        # 3行3列以上の時、4隅が4枚、端は6枚、真ん中は9枚
        print((nm[0]-2) * (nm[1]-2))
    else:
        raise ValueError


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e=map(int,input().split())

if a=0:
    print('1')
if b=0:
    print('2')
if c=0:
    print('3')
if d=0:
    print('4')
if e=0:
    print('5')





Fixed submission:
a,b,c,d,e=map(int,input().split())

if a==0:
    print('1')
if b==0:
    print('2')
if c==0:
    print('3')
if d==0:
    print('4')
if e==0:
    print('5')

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

if a=0
    print('1')
if b=0
    print('2')
if c=0
    print('3')
if d=0
    print('4')
if e=0
    print('5')




Fixed submission:
a,b,c,d,e=map(int,input().split())

if a==0:
    print('1')
if b==0:
    print('2')
if c==0:
    print('3')
if d==0:
    print('4')
if e==0:
    print('5')
Buggy python submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b


mm=m*6

hh=h*30+30*m/60
if hh-mm<=180:
    cos = math.cos(math.radians(abs(hh-mm)))
else:
    cos = math.cos(math.radians(360-abs(hh-mm)))
#print(cos)
cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)


Fixed submission:
a=input()

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9':
    print('hon')

Buggy python submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b


mm=m*6

hh=h*30+30*m/60
if hh-mm<=180:
    cos = math.cos(math.radians(abs(hh-mm)))
else:
    cos = math.cos(math.radians(abs(360-(mm-hh))))
#print(cos)
cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)



Fixed submission:
a=input()

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9':
    print('hon')

Buggy python submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b


mm=m*6
if m != 0:
    hh=h*30+30*m/60
else:
    hh=h*30

cos = math.cos(math.radians(abs(hh-mm)))
#print(cos)
cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)



Fixed submission:
a=input()

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9':
    print('hon')

Buggy python submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b

hh=h*30
mm=m*6

cos = math.cos(math.radians(abs(hh-mm)))

cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)




Fixed submission:
a=input()

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9':
    print('hon')

Buggy python submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b

hh=h*30
mm=m*6

cos = math.cos(math.radians(abs(hh-mm)))

cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)



Fixed submission:
a=input()

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9':
    print('hon')

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

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8'
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9'
    print('hon')


Fixed submission:
a=input()

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9':
    print('hon')
Buggy python submission (verdict: Runtime Error):
s = input()
if s = 'SUN':
	print('7')
elif s = 'MON':
	print('6')
elif s = 'TUE':
	print('5')
elif s = 'WED':
	print('4')
elif s = 'TUE':
	print('3')
elif s = 'FRI':
	print('2')
elif s = 'SAT':
	print('1')


Fixed submission:
s = input()
if s == 'SUN':
	print('7')
elif s == 'MON':
	print('6')
elif s == 'TUE':
	print('5')
elif s == 'WED':
	print('4')
elif s == 'THU':
	print('3')
elif s == 'FRI':
	print('2')
elif s == 'SAT':
	print('1')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

if n % 2 != 0:
    print('No')
else:
    t = s[0:int(n / 2)]
    if t * 2 == s:
        print('Yes')
    else:
        print('No')
 =


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

if n % 2 != 0:
    print('No')
else:
    t = s[0:int(n / 2)]
    if t * 2 == s:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())
if a <= 9 and b <= 9:
	c = a * b
	print(c)
else:
	print('-1')	
	

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

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

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

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

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

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

if 1 <= a <= 9 and 1 <= b <= 9:
	print(a * b)
else:
	print('-1')	
	

Fixed submission:
a, b = map(int, input().split())
if a <= 9 and b <= 9:
	c = a * b
	print(c)
else:
	print('-1')
Buggy python submission (verdict: Runtime Error):
x=input.split()
for i in range(5):
  if x[i]=='0': print(str(i+1))

Fixed submission:
x=input().split()
for i in range(5):
  if x[i]=='0': print(str(i+1))
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcd(a,gcd(b,c))
print(ans)

Fixed submission:
from fractions import gcd
k=int(input())
ans=0
gcd_table=[0]*(k+1)
for a in range(1,k+1):
    for b in range(1,k+1):
        gcd_table[gcd(a,b)]+=1
for g in range(1,k+1):
    for c in range(1,k+1):
        ans+=gcd(g,c)*gcd_table[g]
print(ans)
Buggy python submission (verdict: Runtime Error):
def rest_col(s1,s2):
  if(s1=="R"):
    if(s2="R"):
      return -1
    elif(s2=="G"):
       return 2
    else:
       return 1
  if(s1=="G"):
    if(s2="G"):
      return -1
    elif(s2=="R"):
       return 2
    else:
       return 1
  if(s1=="B"):
    if(s2="B"):
      return -1
    elif(s2=="R"):
       return 1
    else:
       return 0

n=int(input())
s=input()
count=[[0,0,0] for i in range(n)]
for i in range(n):
  if(s[n-1-i]=="R"):
    count[n-1-i][0]+=1
  if(s[n-1-i]=="G"):
    count[n-1-i][1]+=1
  if(s[n-1-i]=="B"):
    count[n-1-i][2]+=1
ans=0
for a in range(n):
  for b in range(a,n):
    r=rest_color(s[a],s[b])
    if(r==-1):
      continue
    else:
      ans+=count[b+1][r]
print(ans)

Fixed submission:
def rest_col(s1,s2):
  if(s1=="R"):
    if(s2=="R"):
      return -1
    elif(s2=="G"):
       return 2
    else:
       return 1
  if(s1=="G"):
    if(s2=="G"):
      return -1
    elif(s2=="R"):
       return 2
    else:
       return 0
  if(s1=="B"):
    if(s2=="B"):
      return -1
    elif(s2=="R"):
       return 1
    else:
       return 0

str_c=["R","G","B"]
n=int(input())
s=input()
count=[[0,0,0] for i in range(n)] #count[i][c]はi番目以上で色cの個数
if(s[n-1]=="R"):
  count[n-1][0]=1
if(s[n-1]=="G"):
  count[n-1][1]=1
if(s[n-1]=="B"):
  count[n-1][2]=1
for i in range(1,n):
  count[n-1-i][0]=count[n-i][0]
  count[n-1-i][1]=count[n-i][1]
  count[n-1-i][2]=count[n-i][2]
  if(s[n-1-i]=="R"):
    count[n-1-i][0]+=1
  if(s[n-1-i]=="G"):
    count[n-1-i][1]+=1
  if(s[n-1-i]=="B"):
    count[n-1-i][2]+=1
ans=0
for a in range(n-1):
  for b in range(a,n-1):
    r=rest_col(s[a],s[b])
    if(r!=-1):
      ans+=count[b+1][r]
      if(2*b-a<len(s)):
        if(s[2*b-a]==str_c[r]):
          ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
l=map(int,input())
print((l/3)**3)

Fixed submission:
l=int(input())
print((l/3)**3)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ct=[0]*n
cmb=[0]*n
s_cmb=0
for i in range(0,n):
  ct[a[i]]+=1
for i in range(0,n):
  cmb[i]=ct[i]*(ct[i]-1)//2
  s_cmb+=cmb[i]
for i in range(0,n):
  print(s_cmb-cmb[a[i]]+(ct[a[i]]-1)*(ct[a[i]]-2)//2)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ct=[0]*n
cmb=[0]*n
s_cmb=0
for i in range(0,n):
  a[i]-=1
  ct[a[i]]+=1
for i in range(0,n):
  cmb[i]=ct[i]*(ct[i]-1)//2
  s_cmb+=cmb[i]
for i in range(0,n):
  print(s_cmb-cmb[a[i]]+(ct[a[i]]-1)*(ct[a[i]]-2)//2)
Buggy python submission (verdict: Runtime Error):
n,r=map(int,input());
print(r+100*min(10-n,0));

Fixed submission:
n,r=map(int,input().split());
print(r+100*max(10-n,0));
Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
s=input()
if n%2!=0:
  print("No")
  sys.exit()
for i in range(n//2):
  if s[i]!=s[n//2+1]:
    print("No")
    sys.exit()
print("Yes")

Fixed submission:
import sys
n=int(input())
s=input()
if n%2!=0:
  print("No")
  sys.exit()
for i in range(n//2):
  if s[i]!=s[n//2+i]:
    print("No")
    sys.exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[0])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
fac=1
for i in range(n):
  if(i!=0):
    fac*=i
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*(2n-2)/(fac*n))


Fixed submission:
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*2/n)

Buggy python submission (verdict: Runtime Error):
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[0])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
fac=1
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
  fac*=i
print(ans*(2n-2)/fac)


Fixed submission:
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*2/n)

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
den=1
for i in range(n):
  ans+=(p[i][0]**2+p[i][1]**2)**0.5
  den*=i
print(ans/den)

Fixed submission:
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*2/n)

Buggy python submission (verdict: Runtime Error):
n=int(input())
p=[list(map(int,input().split()))]
ans=0
den=1
for i in range(n):
  ans+=(p[i][0]**2+p[i][1]**2)**0.5
  den*=i
print(ans/den)

Fixed submission:
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*2/n)
Buggy python submission (verdict: Time Limit Exceeded):
def factorize(a):
    x=2
    ret=[]
    while x<=a:
        while a%x==0:
            a//=x
            ret.append(x)
        x+=1
    return ret

def gcd(a,b):
    tmp=a
    a=max(a,b)
    b=min(tmp,b)
    if(a%b==0):
        return b
    return gcd(b,a%b)

a,b=map(int,input().split())
print(len(set(factorize(gcd(a,b))))+1)


Fixed submission:
def factorize(a):
    x=2
    ret=[]
    rt_a=a**0.5
    while x<=a:
        if(x>=rt_a):
            ret.append(a)
            break
        if(a%x==0):
            ret.append(x)
        while a%x==0:
            a//=x
        x+=1
    return ret

def gcd(a,b):
    tmp=a
    a=max(a,b)
    b=min(tmp,b)
    if(a%b==0):
        return b
    return gcd(b,a%b)

a,b=map(int,input().split())
print(len(set(factorize(gcd(a,b))))+1)

Buggy python submission (verdict: Runtime Error):
import math
def factorize(a):
    x=2
    ret=[]
    while x<=a:
        while a%x==0:
            a//=x
            ret.append(x)
        x+=1
    return ret
a,b=map(int,input().split())
print(len(set(factorize(math.gcd(a,b))))+1)

Fixed submission:
def factorize(a):
    x=2
    ret=[]
    rt_a=a**0.5
    while x<=a:
        if(x>=rt_a):
            ret.append(a)
            break
        if(a%x==0):
            ret.append(x)
        while a%x==0:
            a//=x
        x+=1
    return ret

def gcd(a,b):
    tmp=a
    a=max(a,b)
    b=min(tmp,b)
    if(a%b==0):
        return b
    return gcd(b,a%b)

a,b=map(int,input().split())
print(len(set(factorize(gcd(a,b))))+1)

Buggy python submission (verdict: Time Limit Exceeded):
def factorize(a):
    x=2
    ret=[]
    while x<=a:
        while a%x==0:
            a//=x
            ret.append(x)
        x+=1
    return ret
a,b=map(int,input().split())
set_fac_a=set(factorize(a))
set_fac_b=set(factorize(b))
set_ans=set_fac_a & set_fac_b
print(len(set_ans)+1)

Fixed submission:
def factorize(a):
    x=2
    ret=[]
    rt_a=a**0.5
    while x<=a:
        if(x>=rt_a):
            ret.append(a)
            break
        if(a%x==0):
            ret.append(x)
        while a%x==0:
            a//=x
        x+=1
    return ret

def gcd(a,b):
    tmp=a
    a=max(a,b)
    b=min(tmp,b)
    if(a%b==0):
        return b
    return gcd(b,a%b)

a,b=map(int,input().split())
print(len(set(factorize(gcd(a,b))))+1)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
place=[]
for i in range(1,len(s)):
  if s[i]!=s[i-1]:
    place.append(i)
ans=[0 for i in range(len(s))]
cur_p=place[0]
cur_p_i=0
is_l=False
for i in range(len(s)):
  if i in place:
    if is_l:
      cur_p_i+=2
      cur_p=place[cur_p_i]
    is_l=not is_l
  if (i-cur_p)%2==0:
    ans[cur_p]+=1
  else:
    ans[cur_p-1]+=1
print(" ".join(map(str,ans)))


Fixed submission:
s=input()
place=[]
for i in range(1,len(s)):
  if s[i]!=s[i-1]:
    place.append(i)
ans=[0 for i in range(len(s))]
cur_p=place[0]
cur_p_i=0
is_l=False
set_place=set(place)
for i in range(len(s)):
  if i in set_place:
    if is_l:
      cur_p_i+=2
      cur_p=place[cur_p_i]
    is_l=not is_l
  if (i-cur_p)%2==0:
    ans[cur_p]+=1
  else:
    ans[cur_p-1]+=1
print(" ".join(map(str,ans)))

Buggy python submission (verdict: Runtime Error):
s=input().split()
place=[]
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    place.append(i)
ans=[0 for i in range(len(s))]
cur_p=place[0]
cur_p_i=0
for i in range(len(s)):
  if i>=cur_p:
    cur_p_i+=1
    cur_p=place[cur_p_i]
  if (i-cur_p)%2==0:
    ans[cur_p]+=1
  else:
    ans[cur_p+1]+=1
print(" ".join(ans))

Fixed submission:
s=input()
place=[]
for i in range(1,len(s)):
  if s[i]!=s[i-1]:
    place.append(i)
ans=[0 for i in range(len(s))]
cur_p=place[0]
cur_p_i=0
is_l=False
set_place=set(place)
for i in range(len(s)):
  if i in set_place:
    if is_l:
      cur_p_i+=2
      cur_p=place[cur_p_i]
    is_l=not is_l
  if (i-cur_p)%2==0:
    ans[cur_p]+=1
  else:
    ans[cur_p-1]+=1
print(" ".join(map(str,ans)))

Buggy python submission (verdict: Runtime Error):
s=input().split()
place=[]
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    place.append(i)
ans=[0 for i in range(len(s))]
cur_p=place[0]
cur_p_i=0
for i in range(len(s)):
  if i>=cur_p:
    cur_p_i+=1
    cur_p=place[cur_p_i]
  if (i-cur_p)%2=0:
    ans[cur_p]+=1
  else:
    ans[cur_p+1]+=1
print(" ".join(ans))

Fixed submission:
s=input()
place=[]
for i in range(1,len(s)):
  if s[i]!=s[i-1]:
    place.append(i)
ans=[0 for i in range(len(s))]
cur_p=place[0]
cur_p_i=0
is_l=False
set_place=set(place)
for i in range(len(s)):
  if i in set_place:
    if is_l:
      cur_p_i+=2
      cur_p=place[cur_p_i]
    is_l=not is_l
  if (i-cur_p)%2==0:
    ans[cur_p]+=1
  else:
    ans[cur_p-1]+=1
print(" ".join(map(str,ans)))
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
c=input()
if c[b-1]=="A":
    c[b-1]="a"
elif c[b-1]=="B":
    c[b-1]="b"
else:
    c[b-1]="c"
print(''.join(c))

Fixed submission:
a,b=map(int, input().split())
c=list(input())
henka = c.pop(b-1)
if henka=="A":
    c.insert(b-1,"a")
elif henka=="B":
    c.insert(b-1,"b")
else:
    c.insert(b-1,"c")
print(''.join(c))