Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
ans=0
for i in range(n-1):
    for j in range(m-1):
        ans=(ans+(x[i+1]-x[i])*(y[j+1]-y[j])*(i+1)*(n-1-i)*(j+1)*(m-1-j))%(10**9+7)
print(ans)

Fixed submission:
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
X=0
Y=0
for i in range(n-1):X=(X+(x[i+1]-x[i])*(i+1)*(n-1-i))%(10**9+7)
for i in range(m-1):Y=(Y+(y[i+1]-y[i])*(i+1)*(m-1-i))%(10**9+7)
print(X*Y%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
import math

n=int(input())
for i in range(int(math.sqrt(n)),n+1):
    if n%i==0:print(max(len(str(i)),len(str(n//i))));break

Fixed submission:
import math

n=int(input())
for i in range(int(math.sqrt(n)),0,-1):
    if n%i==0:print(max(len(str(i)),len(str(n//i))));break
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,open(0))
print(max([a*b,c*d]))


Fixed submission:
a,b,c,d=map(int,input().split())
print(max([a*b,c*d]))
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
c=0
for l in range(k+1):
    for m in range(k+1):
        for n in range(k+1):
            if l+m+n==s:c+=1
            else:pass
print(c)

Fixed submission:
k,s=map(int,input().split())
c=0
for l in range(s+1):
    for m in range(min(l+1,k+1)):
        if s-l<=k and l-m<=k:c+=1
        else:pass
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
if n%2==1:
    if a.count(0)==1 and all(a.count(2*i)==2 for i in range(1,n//2+1)):print(2**(n//2)%(10**9+7))
    else: print(0)
else:
    if all(a.count(2*i+1)==2 for i in range(n//2)):print(2**(n//2)%(10**9+7))
    else: print(0)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
if n%2==1:
    if a[0]==0 and all(a[i]==2*((i+1)//2) for i in range(1,n)):print(2**(n//2)%(10**9+7))
    else: print(0)
else:
    if all(a[i]==2*(i//2)+1 for i in range(n)):print(2**(n//2)%(10**9+7))
    else: print(0)
Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=min(x)*n;M=max(x)*n+1
if max(x)<0 or min(x)>0:print(0);exit()
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=0 if min(x)>0 else min(x)*n
M=1 if max(x)<0 else max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if j+x[i+1] in range(m,M):dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=min(x)*n;M=max(x)*n+1
if M<0 or m>0:print(0);exit()
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=0 if min(x)>0 else min(x)*n
M=1 if max(x)<0 else max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if j+x[i+1] in range(m,M):dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=min(x)*n;M=max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if dp[i][j]!=0:
            if j+x[i+1] in range(m,M):dp[i+1][j+x[i+1]]+=dp[i][j]
            dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=0 if min(x)>0 else min(x)*n
M=1 if max(x)<0 else max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if j+x[i+1] in range(m,M):dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=min(x)*n;M=max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if dp[i][j]!=0:
            dp[i+1][j+x[i+1]]+=dp[i][j]
            dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)

Fixed submission:
n,a=map(int,input().split())
x=list(map(lambda x:int(x)-a,input().split()))
m=0 if min(x)>0 else min(x)*n
M=1 if max(x)<0 else max(x)*n+1
dp=[[0]*(M-m) for _ in range(n)]
dp[0][x[0]]+=1
dp[0][0]+=1
for i in range(n-1):
    for j in range(m,M):
        if j+x[i+1] in range(m,M):dp[i+1][j+x[i+1]]+=dp[i][j]
        dp[i+1][j]+=dp[i][j]
print(dp[n-1][0]-1)
Buggy python submission (verdict: Runtime Error):
k=["MON","TUE","WED","THU","FRI","SAT"]
s=input()
j="SUN"
if(s==j):
  print(7)
else:
  for a,i in enumerate k:
    if(s==i):
      print(6-a)

Fixed submission:
k=["MON","TUE","WED","THU","FRI","SAT"]
s=input()
j="SUN"
if(s==j):
  print(7)
else:
  for a,i in enumerate (k):
    if(s==i):
      print(6-a)

Buggy python submission (verdict: Runtime Error):
days=["MON","TUE","WED","THU","FRI","SAT","SUN"]
s=input()
for k,i in enumerate days:
  if(s=="SUN"):
    print(7)
  elif(s==i)
    print(6-k)


Fixed submission:
k=["MON","TUE","WED","THU","FRI","SAT"]
s=input()
j="SUN"
if(s==j):
  print(7)
else:
  for a,i in enumerate (k):
    if(s==i):
      print(6-a)

Buggy python submission (verdict: Runtime Error):
s = input()
w = ['SUM','MON','TUE','WED','THU','FRI','SAT']
for i in range(len(S)):
    if s == w[i]:
        print 7 - i


Fixed submission:
s = input()
w = ['SUN','MON','TUE','WED','THU','FRI','SAT']
for i in range(len(w)):
    if s == w[i]:
        print (7 - i)

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

day = sys.stdin().read().strip()

days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

day_index = days.index(day)

print(7-day_index)

Fixed submission:
import sys

day = sys.stdin.read().strip()

days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

day_index = days.index(day)

print(7-day_index)

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

day = sys.stdin.read()

days = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
day_index = days.index(day)

print(6 - day_index)

Fixed submission:
import sys

day = sys.stdin.read().strip()

days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

day_index = days.index(day)

print(7-day_index)
Buggy python submission (verdict: Runtime Error):
import string

N = int(input())
S = input()

letters = string.ascii_uppercase + string.ascii_uppercase
letters = letters[N:N+26]
mapping = {s: letters[idx] for idx, s in enumerate(S)}

ans = "".join(map(lambda s: mapping[s], S))
print(ans, flush=True)

Fixed submission:
import string

N = int(input())
S = input()

letters = string.ascii_uppercase + string.ascii_uppercase
letters = letters[N:N+26]
mapping = {s: letters[idx] for idx, s in enumerate(string.ascii_uppercase)}

ans = "".join(map(lambda s: mapping[s], S))
print(ans, flush=True)
Buggy python submission (verdict: Runtime Error):
from sys import stdin, stdout

if __name__ == '__main__':
  S = stdin.readlines().replace("\n","")
  d = {'SUN':7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1}
  stdout.writelines("%d" % d[S])

Fixed submission:
if __name__ == '__main__':
    S = input()
    d = {'SUN':7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1}
    if d.get(S, False):
        print(d[S])
    else:
        res = -1
        for i in d.keys():
            if i in S or i.lower() in S:
                res = d[i]
                break
        print(res)
Buggy python submission (verdict: Runtime Error):
import sys

N = int(input())
H = list(map(int,input().split()))

count = 0
ans =[]

for i in range(N-1) :
	if H[i]>=H[i+1] :
		count+=1
		ans.append(count)
	else :
		count=0

print(max(ans))

Fixed submission:
import sys

N = int(input())
H = list(map(int,input().split()))

count = 0
ans = 0

for i in range(N-1) :
	if H[i]>=H[i+1] :
		count+=1
	else :
		if ans<=count:
			ans= count
		count=0
	#print(ans)
	#print(count)
if ans<=count:
	ans= count
print(ans)
Buggy python submission (verdict: Runtime Error):
num = [i for i in range (1,int(input())+1)]
ans = 0

if num[-1]<=9 :
	ans = num[-1]
elif num[-1]<=99 :
	ans = 9
elif num[-1]<=999 :
	ans = 10+num[-1]%100
elif num[-1]<=9999:
	ans = 10+899
elif num[-1]<=99999 :
	ans = 910+num[-1]%10000
elif :
	ans = 90909

print(ans)

Fixed submission:
num = [i for i in range (1,int(input())+1)]
ans = 0

if num[-1]<=9 :
	ans = num[-1]
elif num[-1]<=99 :
	ans = 9
elif num[-1]<=999 :
	ans = num[-1]-90
elif num[-1]<=9999:
	ans = 909
elif num[-1]<=99999 :
	ans = num[-1]-9090
else :
	ans = 90909

print(ans)

Buggy python submission (verdict: Runtime Error):
#num = list(map(int,input().split()))
num = [i for i in range (1,int(input())+1)]
ans = 0
count = 0

for j in range(9,99):
	num[j]=0

for k in range(999,9999):
	num[k]=0

for l in range(len(num)-1):
	if not num[l]==0:
		count+=1

print(count)

Fixed submission:
num = [i for i in range (1,int(input())+1)]
ans = 0

if num[-1]<=9 :
	ans = num[-1]
elif num[-1]<=99 :
	ans = 9
elif num[-1]<=999 :
	ans = num[-1]-90
elif num[-1]<=9999:
	ans = 909
elif num[-1]<=99999 :
	ans = num[-1]-9090
else :
	ans = 90909

print(ans)
Buggy python submission (verdict: Runtime Error):
input_size = int(input())
inputs = map(int, input().split())
sum = 0
for i in range(input_size):
  sum += 1 / inputs[i]
print(1 / sum)

Fixed submission:
input_size = int(input())
inputs = input().split()
sum = 0
for i in range(input_size):
  sum += 1 / int(inputs[i])
print(1 / sum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = input().split()
for l in range(N):
    a[l] = int(a[l])
for i in range(N):
  if i < N:
    if a[N-i-1] >= a[N-i-2]:
    elif a[N-i-1] + 1 == a[N-i-2]:
      a[N-i-2] -= 1
    else:
      print('No')
      break
  else:
    print('Yes')

Fixed submission:
N = int(input())
a = input().split()
for l in range(N):
    a[l] = int(a[l])
for i in range(N):
  if i < N-1:
    if a[N-i-1] >= a[N-i-2]:
      continue
    elif a[N-i-1] + 1 == a[N-i-2]:
      a[N-i-2] -= 1
    else:
      print('No')
      break
  else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
for i in range(N):
  a.append(input())
for i in range(N):
  if i < N:
    if int(a[N-i-1]) >= int(a[N-i-2]):
      continue
    elif int(a[N-i-1]) + 1 == int(a[N-i-2]):
      int(a[N-i-2]) -= 1
      continue
    else:
      print('No')
      break
  else:
    print('Yes')

Fixed submission:
N = int(input())
a = input().split()
for l in range(N):
    a[l] = int(a[l])
for i in range(N):
  if i < N-1:
    if a[N-i-1] >= a[N-i-2]:
      continue
    elif a[N-i-1] + 1 == a[N-i-2]:
      a[N-i-2] -= 1
    else:
      print('No')
      break
  else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
if abs(a - b) % 2 = 0:
  print( (a + b) / 2 )
else:
  print('IMPOSSIBLE')


Fixed submission:
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
if (a - b) % 2 == 0:
  print( int((a + b) / 2 ))
else:
  print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
if (a - b) % 2 = 0:
  print( (a + b) / 2 )
else:
  print('IMPOSSIBLE')


Fixed submission:
inputs = input().split()
a = int(inputs[0])
b = int(inputs[1])
if (a - b) % 2 == 0:
  print( int((a + b) / 2 ))
else:
  print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
S = sorted( list(map(int, input().split())) )
count=0

for i in S:
  if(i>K):
    count += 1
print(count)

Fixed submission:
import math

N = int(input())

print( math.ceil(N/2)/N )
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
S = sorted( list(map(int, input().split())) )

r_R = len(S)
r_L = 0
r_M = round( (r_R+r_L)/2 )

flag = 0

if(r_R == 1):
	flag = 1
elif(S[r_L]>=K):
  flag = 1
  r_M = r_R

while(flag==0):
  if( S[r_M] <= K < S[r_M + 1] ):
    flag = 1
  
  elif( K < S[r_M] ):
    r_L = r_M
    r_M = round( (r_R+r_L)/2 )
  
  elif( S[r_M + 1] <=K ):
    r_R = r_M
    r_M = round( (r_R+r_L)/2 )

print(r_M)

Fixed submission:
N,K = map(int, input().split())
S = sorted( list(map(int, input().split())) )
count=0

for i in S:
  if(i>=K):
    count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split() ))

ans = []
for k in range(0,len(A)):
    ans.append(A.index(k+1))
    
ans = list(map(lambda x:x+1, ans))
ans = list(map(str, ans))
L = " ".join(ans)

print(L)

Fixed submission:
N = int(input())
A = list(map(int, input().split() ))

sort = [1]*N
for k in range(0,len(A)):
    sort[A[k]-1] = k + 1
    
sort = list(map(str, sort))
ans = " ".join(sort)

print(ans)
Buggy python submission (verdict: Runtime Error):
tenki = input()

if tenki == Sunny:
  print("Cloudy")
elif tenki == Rainy:
  print("Rainy")
else:
  print("Cloudy")

Fixed submission:
tenki = input()

if tenki == "Sunny":
  print("Cloudy")
elif tenki == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int, input().split(" ")) #N:参加者 K:ポイント Q:正解数
A = [K]*N

for i in range(0,Q):
    A = list(map(lambda x:x-1,A))
    A[int(input())-1] += 1

for point in A:
    if point<=0:
        print("No")
    else:
        print("Yes")

Fixed submission:
N,K,Q = map(int, input().split(" ")) #N:参加者 K:ポイント Q:正解数
A = [K]*N

for i in range(0,Q):
    A[int(input())-1] += 1

for point in A:
    if point - Q <= 0 :
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list( input() )

count = 0
temp = S[1]

for i in range(0, len(S)-1):
    if S[i] == S[i+1]:
        count += 1
        
print( min(len(S)-1, count + 2*K) )

Fixed submission:
N, K = map(int, input().split())
S = list( input() )

if len(S) > 1:
    count = 0

    temp = S[1]

    for i in range(0, len(S)-1):
        if S[i] == S[i+1]:
            count += 1

    print( min(len(S)-1, count + 2*K) )
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list( input() )

count = 0
temp = S[1]

for i in range(0, len(S)-1):
    if S[i] == S[i+1]:
        count += 1
        
print( min(len(S)-1, count + 2*K) )

Fixed submission:
N, K = map(int, input().split())
S = list( input() )

if len(S) > 1:
    count = 0

    temp = S[1]

    for i in range(0, len(S)-1):
        if S[i] == S[i+1]:
            count += 1

    print( min(len(S)-1, count + 2*K) )
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
H = list(map(int, input().split() ) )

step_max = 0

for i in H:
    step = 0
    for k in range(len(H)-1):
        if H[k] >= H[k+1]:
            step += 1
        else:
            break
    if step > step_max:
        step_max = step
    del H[0]

print(step_max)

Fixed submission:
N = input()
H = list(map(int, input().split() ) )

count = 0
step = [0]*len(H)

for i in range(len(H)-1):
    if H[i]>=H[i+1]:
        count += 1
    else:
        count = 0
    step[i+1] = count

print(max(step))
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    G[a].append([b, i])

ans = [None]*(N-1)
def rec(cur, color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1

rec(0,0)
print(max(ans))
[print(a) for a in ans]

Fixed submission:
S = input()

l = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

print(7 - l.index(S))
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    G[a].append([b, i])

ans = [None]*(N-1)
def rec(cur, color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1

rec(0,0)
print(max(ans))
[print(a) for a in ans]


Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    G[a].append([b, i])

ans = [None]*(N-1)
def rec(cur, color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1

rec(0,0)
print(max(ans))
[print(a) for a in ans]

Buggy python submission (verdict: Runtime Error):
N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    G[a].append([b, i])

ans = [None]*(N-1)
def rec(cur, color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1

rec(0,0)
print(max(ans))
[print(a) for a in ans]


Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    G[a].append([b, i])

ans = [None]*(N-1)
def rec(cur, color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1

rec(0,0)
print(max(ans))
[print(a) for a in ans]
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
li = list(map(int, input().split()))

ans = 0

for a,b,c in itertools.combinations(li, 3):
    if (a < b+c) and (b < c+a) and (c < a+b):
        ans += 1

print(ans)

Fixed submission:
import bisect

N = int(input())
li = list(map(int, input().split()))
li = sorted(li)

ans = 0

for i in range(N):
    for j in range(i+1, N):
        cnt = bisect.bisect_left(li, li[i]+li[j])
        ans += cnt - j - 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
li = list(map(int, input().split()))

ans = 0

for a,b,c in itertools.combinations(li, 3):
    if (a < b+c) and (b < c+a) and (c < a+b):
        ans += 1

print(ans)

Fixed submission:
import bisect

N = int(input())
li = list(map(int, input().split()))
li = sorted(li)

ans = 0

for i in range(N):
    for j in range(i+1, N):
        cnt = bisect.bisect_left(li, li[i]+li[j])
        ans += cnt - j - 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())
if A > B:
    A, B = B, A
c = gcd(A, B)
ans = 1

for i in range(2, c+1):
    if i > c:
        break
    if c%i == 0:
        ans += 1
        while c%i == 0:
            c = c//i

print(ans)

Fixed submission:
from math import sqrt, ceil

# ユークリッドの互除法で最大公約数を返す
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

A, B = map(int, input().split())
if A > B:
    A, B = B, A
g = gcd(A, B)
s = set(); s.add(1)
sqrt_g_plus = ceil(sqrt(g))+1
i = 2

# 最大公約数の平方根までの素数を見つける
while i < sqrt_g_plus:
    if g%i == 0:
        s.add(i)
        g //= i
    else:
        i += 1
# 平方根以上の素数がある場合、追加する（あるとした場合一つだけである）
if g > 1:
    s.add(g)

print(len(s))

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())
if A > B:
    A, B = B, A
c = gcd(A, B)
li = [1]

for i in range(2, c+1):
    if i > c:
        break
    if c%i == 0:
        li.append(i)
        while c%i == 0:
            c = c//i

print(len(li))

Fixed submission:
from math import sqrt, ceil

# ユークリッドの互除法で最大公約数を返す
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

A, B = map(int, input().split())
if A > B:
    A, B = B, A
g = gcd(A, B)
s = set(); s.add(1)
sqrt_g_plus = ceil(sqrt(g))+1
i = 2

# 最大公約数の平方根までの素数を見つける
while i < sqrt_g_plus:
    if g%i == 0:
        s.add(i)
        g //= i
    else:
        i += 1
# 平方根以上の素数がある場合、追加する（あるとした場合一つだけである）
if g > 1:
    s.add(g)

print(len(s))

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())
if A > B:
    A, B = B, A
c = gcd(A, B)
li = [1]

for i in range(2, c+1):
    if i > c:
        break
    if c%i == 0:
        li.append(i)
        while c%i == 0:
            c = c//i

print(len(li))

Fixed submission:
from math import sqrt, ceil

# ユークリッドの互除法で最大公約数を返す
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

A, B = map(int, input().split())
if A > B:
    A, B = B, A
g = gcd(A, B)
s = set(); s.add(1)
sqrt_g_plus = ceil(sqrt(g))+1
i = 2

# 最大公約数の平方根までの素数を見つける
while i < sqrt_g_plus:
    if g%i == 0:
        s.add(i)
        g //= i
    else:
        i += 1
# 平方根以上の素数がある場合、追加する（あるとした場合一つだけである）
if g > 1:
    s.add(g)

print(len(s))
Buggy python submission (verdict: Runtime Error):
s = input()
if s = "SUN":
  print(0)
if s = "MON":
  print(6)
if s = "TUE":
  print(5)
if s = "WED":
  print(4)
if s = "THU":
  print(3)
if s = "FRI":
  print(2)
if s = "SUT":
  print(1)
  

Fixed submission:
s = input()
if s == "SUN":
  print(7)
if s == "MON":
  print(6)
if s == "TUE":
  print(5)
if s == "WED":
  print(4)
if s == "THU":
  print(3)
if s == "FRI":
  print(2)
if s == "SAT":
  print(1)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
a = 0
if n % 2 == 0:
  for i in range(0,n+1,2):
    if s[i] == "R":
      a = 1
      break
  for i in range(1,n,2):
    if s[i] == "L":
      a = 1
      break
if n % 2 == 1:
  for i in range(0,n,2):
    if s[i] == "R":
      a = 1
      break
  for i in range(1,n+1,2):
    if s[i] == "L":
      a = 1
      break
if a == 0:
  print("Yes")
if a == 1:
  print("No")

Fixed submission:
s = input()
n = len(s)
a = 0
if n % 2 == 0:
  for i in range(0,n,2):
    if s[i] == "L":
      a = 1
      break
  for i in range(1,n,2):
    if s[i] == "R":
      a = 1
      break
else:
  for i in range(0,n,2):
    if s[i] == "L":
      a = 1
      break
  for i in range(1,n,2):
    if s[i] == "R":
      a = 1
      break
if a == 0:
  print("Yes")
if a == 1:
  print("No")

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
a = 0
if n % 2 == 0:
  for i in range(0,n+1,2):
    if s[i] == "R":
      a = 1
      break
  for i in range(1,n,2):
    if s[i] == "L":
      a = 1
      break
if n % 2 == 1:
  for i in range(0,n,2):
    if s[i] == "R":
      a = 1
      break
  for i in range(1,n+1,2):
    if s[i] == "L":
      a = 1
      break
if a == 0:
  print("Yes")
if a == 1:
  print("No")

Fixed submission:
s = input()
n = len(s)
a = 0
if n % 2 == 0:
  for i in range(0,n,2):
    if s[i] == "L":
      a = 1
      break
  for i in range(1,n,2):
    if s[i] == "R":
      a = 1
      break
else:
  for i in range(0,n,2):
    if s[i] == "L":
      a = 1
      break
  for i in range(1,n,2):
    if s[i] == "R":
      a = 1
      break
if a == 0:
  print("Yes")
if a == 1:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
i = 0
for i <= N-1:
  B[i] = 1/A[i]
S = sum(B)
answer = 1 / S
print(answer)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
i = 0
B = 0
while i <= N-1:
  B += 1/A[i]
  i = i + 1
answer = 1 / B
print(answer)