Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B=map(int,input().split())
k=0
while (A+B)*k<N:
  k+=1


if (A+B)*k==N:
  print(A*k)
else:
  if N-(k-1)*(A+B)>A:
    print((k-1)*A+A)
  else:
    print((k-1)*A+N-(k-1)*(A+B))

Fixed submission:
N,A,B=map(int,input().split())
k=N//(A+B)

if (A+B)*k==N:
  print(A*k)
else:
  if N-k*(A+B)>A:
    print(k*A+A)
  else:
    print(k*A+N-k*(A+B))

Buggy python submission (verdict: Time Limit Exceeded):
N,A,B=map(int,input().split())
k=0
while (A+B)*k<N:
  k+=1


if (A+B)*k==N:
  print(A*k)
else:
  if N-(k-1)*(A+B)>A:
    print((k-1)*A+A)
  else:
    print((k-1)*A+N-(k-1)*(A+B))

Fixed submission:
N,A,B=map(int,input().split())
k=N//(A+B)

if (A+B)*k==N:
  print(A*k)
else:
  if N-k*(A+B)>A:
    print(k*A+A)
  else:
    print(k*A+N-k*(A+B))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
A=np.zeros(N)
ans=0
for i in range(M):
  s,t=map(int,input().split())
  if s==1 and t==0:
    ans=1
  elif t==0:
    A[s-1]="o"
  else:
    if A[s-1]==0:
      A[s-1]=t
    elif A[s-1]==t:
      A[s-1]=t
    else:
      ans=1
if N!=1:      
  if A[0]==0:
    A[0]=1

if ans==1:
  print(-1)
else:
  for i in range(N):
    if A[i]=="o":
      A[i]=0
    ans+=A[i]*(10**(2-i))
  print(int(ans))
  

Fixed submission:
import numpy as np
N,M=map(int,input().split())
A=np.zeros(N)
ans=0
for i in range(M):
  s,t=map(int,input().split())
  if s==1 and t==0 and N!=1:
    ans=1
  elif t==0:
    A[s-1]=99
  else:
    if A[s-1]==0:
      A[s-1]=t
    elif A[s-1]==t:
      A[s-1]=t
    else:
      ans=1
if N!=1:      
  if A[0]==0:
    A[0]=1

if ans==1:
  print(-1)
else:
  for i in range(N):
    if A[i]==99:
      A[i]=0
    ans+=A[i]*(10**(N-i-1))
  print(int(ans))
Buggy python submission (verdict: Runtime Error):
N,K,S=map(int,input().split())
a=[]

for i in range(K):
  a.append(S)

if N>len(a):
  for i in range(N-len(S))
  a.append(S+1)
      
print(' '.join(map(str, a)))
  

Fixed submission:
N,K,S=map(int,input().split())
a=[]

for i in range(K):
  a.append(S)

if N>len(a):
  for i in range(N-len(a)):
    if S==10**9:
      a.append(S-1)
    else:
      a.append(S+1)
      
print(' '.join(map(str, a)))
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=set(A)
C=[]
ans=0
for i in B:
  C.append(A.count(i))
C.sort()
for i in range(len(C)-K):
  ans+=C[i]
print(ans)  

Fixed submission:
import numpy as np
N,K=map(int,input().split())
A=list(map(int,input().split()))
B=np.zeros(N)
for i in A:
  B[i-1]+=1
C=sorted([i for i in B if i != 0])
ans=0
for i in range(len(C)-K):
  ans+=C[i]
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N=int(input())
i=0
summ=0

def kakuwa(N):
  while N>10**i:
    i+=1
  for k in range(i+1)[::-1]:
    summ+=N//(10**k)
    N-=(10**k)*(N//(10**k))
  return(summ)

if N%kakuwa(N)==0:
  print("Yes")
else:
  print("No")

Fixed submission:
N=int(input())
def kakuwa(N):
  summ=0
  i=0
  while N>10**i:
    i+=1
  for k in range(i+1)[::-1]:
    summ+=N//(10**k)
    N-=(10**k)*(N//(10**k))
  return(summ)

if N%kakuwa(N)==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
counter=0
for a in range(N+1):
  for b in range(N+1):
    for c in range(N+1):
      if a+b+c==M:
        counter+=1
print(counter)

Fixed submission:
N,M=map(int,input().split())
counter=0
for a in range(N+1):
  for b in range(N+1):
    if 0<=M-(a+b)<=N:
      counter+=1
print(counter)
Buggy python submission (verdict: Runtime Error):
a=map(int,input().split())

if a.count(5)==2 and a.count(7)==1:
  print("Yes")
else:
  print("No")
  

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

if a.count(5)==2 and a.count(7)==1:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

total = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            total += gcd(a, b, c)

print(total)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

total = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            total += gcd(a, b, c)

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N) ]

for i in range(N):
    tmp = A.copy()
    tmp.pop(i)
    print(max(tmp))

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N) ]
left = []
right = []
left_max = 0
right_max = 0
for i in range(N):
    if i == 0:
        left.append(0)
    else:
        left.append(max(left_max, A[i-1]))
    
    if (A[i-1] > left_max) and i != 0:
        left_max = A[i-1]
        
for i in range(N-1, -1, -1):
    if i == N-1:
        right.append(0)
    else:
        right.append(max(right_max, A[i+1]))
    
    if i != N-1:
        if A[i+1] > right_max:
            right_max = A[i+1]
right.reverse()

for i in range(N):
    print(max(left[i],right[i]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N) ]

for i in range(N):
    tmp = A.copy()
    tmp.pop(i)
    print(max(tmp))

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N) ]
left = []
right = []
left_max = 0
right_max = 0
for i in range(N):
    if i == 0:
        left.append(0)
    else:
        left.append(max(left_max, A[i-1]))
    
    if (A[i-1] > left_max) and i != 0:
        left_max = A[i-1]
        
for i in range(N-1, -1, -1):
    if i == N-1:
        right.append(0)
    else:
        right.append(max(right_max, A[i+1]))
    
    if i != N-1:
        if A[i+1] > right_max:
            right_max = A[i+1]
right.reverse()

for i in range(N):
    print(max(left[i],right[i]))
Buggy python submission (verdict: Time Limit Exceeded):
L,R = (int(i) for i in input().split())

tmp = float("inf")

for i in range(L,R+1,1):
    for j in range(i+1,R+1):
        mod = i*j%2019
        if mod<tmp:
            tmp = mod
print(tmp)

Fixed submission:
L,R = (int(i) for i in input().split())

tmp = float("inf")
count_i = 0
count_j = 0

for i in range(L,R+1):
    if count_i > 2019:break
    
    count_j = 0
    for j in range(i+1,R+1):
        if count_j >2019:break
        mod = i*j%2019
        if mod<tmp:
            tmp = mod
            
        count_j += 1
    count_i += 1
print(tmp)
Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():

    N,L = (int(i) for i in input().split())
    L_list = [int(L+i) for i in range(N)]

    Tmp = L_list[0]


    if L_list[0] < 0:
        if L_list[0]+N-1 >= 0 :
            print(sum(L_list[:]))
        else:
            print(sum(L_list[:-1]))
    else:
        print(sum(L_list[1:]))


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np

def main():

    N,L = (int(i) for i in input().split())
    L_list = [int(L+i) for i in range(N)]

    if L_list[0] < 0:
        if L_list[0]+N-1 >= 0 :
            print(sum(L_list[:]))
        else:
            print(sum(L_list[:-1]))
    else:
        print(sum(L_list[1:]))


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

    A,B,C,D = (int(i) for i in input().split())

    count = 0
    for i in range(A,B+1):
        if i%C != 0 and i%D !=0:
            count += 1
        else:
            continue
    print(count)
    


if __name__ == '__main__':
    main()


Fixed submission:
import math
import fractions

def main():

    A,B,C,D = (int(i) for i in input().split())

    CD = C * D / fractions.gcd(C,D)
    #print("CD = ", CD)

    count_C = B//C - (A-1)//C
    #print("count_C = ", count_C)

    count_D = B//D - (A-1)//D
    #print("count_D = ", count_D)

    count_CD = B//int(CD) - (A-1)// int(CD)
    #print("count_CD = ", count_CD)

    print(int(B-A+1 - (count_C + count_D - count_CD)))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
A_list = [int(i) for i in input().split()]


sum_tmp = 0
Answer = 0

if N==1 : Answer = 0

else :
    for i in range(N):
        sum_tmp = A_list[i]
        for j in range(i+1,N):
            sum_tmp += A_list[j]
            #print(sum_tmp)
            if sum_tmp < K:
                continue
            else:
                Answer += N - j
                #print('answer += {0:5d}'.format(N-j))
                break

print(Answer)

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

if X < A:
    print("0")
else:
    print("10")
Buggy python submission (verdict: Runtime Error):
import numpy as np

N,M = map(int, input().split())
A_array = np.array([int(i) for i in input().split()])
Current_Min = A_array[A_array.argmin()]
for j in range(M):
    B_tmp, C_tmp = map(int,input().split())
    if Current_Min >= C_tmp:
        continue
    for k in range(B_tmp):
        A_array[A_array.argmin()] = C_tmp
    
    Current_Min = A_array[A_array.argmin()]
    

print(sum(A_array))

Fixed submission:
A,B = (int(i) for i in input().split())

if A>=13:
    print(B)
elif 6<=A and A<=12:
    print(int(B/2))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
from scipy import ndimage
import numpy as np
import sys
 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()[:-1]] for i in range(H)])
# print(A_array)
 
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))

Fixed submission:
from scipy import ndimage
import numpy as np

 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()] for i in range(H)])
# print(A_array)
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))

Buggy python submission (verdict: Runtime Error):
from scipy import ndimage
import numpy as np

 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()[:-1]] for i in range(H)])
# print(A_array)
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))

Fixed submission:
from scipy import ndimage
import numpy as np

 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()] for i in range(H)])
# print(A_array)
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))

Buggy python submission (verdict: Runtime Error):
from scipy import ndimage
import numpy as np

 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()[:-1]] for i in range(H)])
# print(A_array)

print(A_array)
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))

Fixed submission:
from scipy import ndimage
import numpy as np

 
H, W = map(int, input().split())
 
A_array = np.array(
    [[0 if s == "#" else 1 for s in input()] for i in range(H)])
# print(A_array)
 
# print(A_array)
b = ndimage.morphology.distance_transform_cdt(
    A_array, metric="taxicab")
print(np.max(b))
Buggy python submission (verdict: Runtime Error):
import copy

tmp = 0
Max = 1

N = int(input())

A_list = [int(i) for i in input().split()]
tmp_list = A_list

def operation(a,b):
    while a%b != 0:
        complete = a%b
        a = b
        b = complete
    return b

for i in range(N):
    
    tmp_list = copy.copy(A_list)
    del tmp_list[i] #i番目が存在しないリストを作成
    #print(tmp_list)
        
    tmp = operation(tmp_list[0],tmp_list[1])#最初の2つの最大公約数
    
    for k in range(N-2):
        tmp = operation(tmp,tmp_list[k])
    
    if tmp > Max:
        Max = tmp

print(Max)

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

ans = (T // a) *b

print(ans)

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

tmp = 0
Max = 1

N = int(input())

A_list = [int(i) for i in input().split()]
tmp_list = A_list

def operation(a,b):
    while a%b != 0:
        complete = a%b
        a = b
        b = complete
    return b

for i in range(N):
    
    tmp_list = copy.copy(A_list)
    del tmp_list[i] #i番目が存在しないリストを作成
    #print(tmp_list)
        
    tmp = operation(tmp_list[0],tmp_list[1])#最初の2つの最大公約数
    
    for k in range(N-2):
        tmp = operation(tmp,tmp_list[k])
    
    if tmp > Max:
        Max = tmp

print(Max)

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

ans = (T // a) *b

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

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

sum = 3000000
for i in range(0, N):
    # print("left", S[:i])
    # print("right", S[i+1:])
    left_side_reverse_num = S[:i].count('W')
    right_side_reverse_num = S[i+1:].count('E')

    # print(left_side_reverse_num)
    # print(right_side_reverse_num)

    if sum > left_side_reverse_num + right_side_reverse_num:
        sum = left_side_reverse_num + right_side_reverse_num

    #print(sum)
print(sum)

Fixed submission:

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

w_num = S.count('W')
e_num = S.count('E')

rev_num = S[1:].count('E')
rev_num_list = [rev_num]

for i in range(1, N):
    add = 0
    if S[i-1] == 'W':
        add +=1
    if S[i] == 'E':
        add -=1
    rev_num_list.append(rev_num_list[i-1] + add)

print(min(rev_num_list))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
X = [int(i) for i in input().split()]

for i in range(0, N):
    tmp_list = []
    if i==0:
        tmp_list = []
    else:
        tmp_list = X[:i]
    tmp_list.extend(X[i+1:])
    med = np.median(tmp_list)
    print(int(med))

Fixed submission:
import numpy as np
import copy

N = int(input())
X = [int(i) for i in input().split()]

max_value = max(X)
min_value = min(X)

tmp_list = copy.deepcopy(X)
tmp_list.sort()
all_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

tmp_list.remove(max_value)
min_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

tmp_list = copy.deepcopy(X)
tmp_list.remove(min_value)
tmp_list.sort()
max_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

for i in range(N):
    if X[i] <= all_med:
        print(int(max_med))
    else:
        print(int(min_med))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
X = [int(i) for i in input().split()]

for i in range(0, N):
    tmp_list = []
    if i==0:
        tmp_list = []
    else:
        tmp_list = X[:i]
    tmp_list.extend(X[i+1:])
    med = np.median(tmp_list)
    print(int(med))

Fixed submission:
import numpy as np
import copy

N = int(input())
X = [int(i) for i in input().split()]

max_value = max(X)
min_value = min(X)

tmp_list = copy.deepcopy(X)
tmp_list.sort()
all_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

tmp_list.remove(max_value)
min_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

tmp_list = copy.deepcopy(X)
tmp_list.remove(min_value)
tmp_list.sort()
max_med = tmp_list[int((len(tmp_list)+1) / 2) - 1]

for i in range(N):
    if X[i] <= all_med:
        print(int(max_med))
    else:
        print(int(min_med))
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
a_l = list(map(int,input().split()))

town = 1
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

k -= count
if k = 0:
    print(town)
    exit()
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

remain = k%count
count = 0
while count < remain:
    town = a_l[town-1]
    count += 1
   
print(town)

Fixed submission:
n, k = map(int,input().split())
a_l = list(map(int,input().split()))

town = 1
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

k -= count
if k == 0:
    print(town)
    exit()
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

remain = k%count
count = 0
while count < remain:
    town = a_l[town-1]
    count += 1
   
print(town)

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

town = 1
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

k -= count
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

remain = k%count
count = 0
while count < remain:
    town = a_l[town-1]
    count += 1
   
print(town)

Fixed submission:
n, k = map(int,input().split())
a_l = list(map(int,input().split()))

town = 1
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

k -= count
if k == 0:
    print(town)
    exit()
count = 0
town_visited = set()
while count < k:
    town_visited.add(town)
    town = a_l[town-1]
    count += 1
    if town in town_visited:
        break

remain = k%count
count = 0
while count < remain:
    town = a_l[town-1]
    count += 1
   
print(town)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_l = list(map(int,input().split()))
ia = list(enumerate(a_l))
del_l = []
for j in range(n):
    if ia[j][1] >= n-1:
        del_l.append(j)
for j in del_l[::-1]:
    del ia[j]
        
count = 0
i = 0
while True:
    if i > len(ia)-1:
        break
    i1, a1 = ia[i]
    if a1 >= n-1-i1:
        del ia[i]
        continue
    for i2, a2 in ia[i1+a1+1:n]:
        if a2 >= n-1-i1:
            del ia[i2]
            continue
        if (i2-i1) == (a2+a1):
            count += 1
    i += 1

print(count)



Fixed submission:
n = int(input())
a_l = list(map(int,input().split()))
ia = list(enumerate(a_l))

x_dict = {}
y_dict = {}
for i, a in ia:
    x = i+a
    y = i-a
    if x in x_dict:
        x_dict[x] += 1
    else:
        x_dict[x] = 1
    if y in y_dict:
        y_dict[y] += 1
    else:
        y_dict[y] = 1

count = 0
for xkey in x_dict.keys():
    if xkey in y_dict:
        count += x_dict[xkey] * y_dict[xkey]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_l = list(map(int,input().split()))

count = 0
for i in range(n-1):
    for j in range(i+a_l[i]+1,n):
        if (j-i) == (a_l[j] + a_l[i]):
            count += 1

print(count)



Fixed submission:
n = int(input())
a_l = list(map(int,input().split()))
ia = list(enumerate(a_l))

x_dict = {}
y_dict = {}
for i, a in ia:
    x = i+a
    y = i-a
    if x in x_dict:
        x_dict[x] += 1
    else:
        x_dict[x] = 1
    if y in y_dict:
        y_dict[y] += 1
    else:
        y_dict[y] = 1

count = 0
for xkey in x_dict.keys():
    if xkey in y_dict:
        count += x_dict[xkey] * y_dict[xkey]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_l = list(map(int,input().split()))

count = 0
for i in range(n-1):
    for j in range(i+1,n):
        if (j-i) == (a_l[j] + a_l[i]):
            count += 1

print(count)



Fixed submission:
n = int(input())
a_l = list(map(int,input().split()))
ia = list(enumerate(a_l))

x_dict = {}
y_dict = {}
for i, a in ia:
    x = i+a
    y = i-a
    if x in x_dict:
        x_dict[x] += 1
    else:
        x_dict[x] = 1
    if y in y_dict:
        y_dict[y] += 1
    else:
        y_dict[y] = 1

count = 0
for xkey in x_dict.keys():
    if xkey in y_dict:
        count += x_dict[xkey] * y_dict[xkey]

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int,input().split())
x -= 1
y -= 1

distance_dict = {}
for k in range(1,n):
    distance_dict[k] = set()

for i in range(n):
    for j in range(i+1,n):
        distance = min(abs(i-j),abs(i-x)+1+abs(j-y),abs(i-y)+1+abs(j-x))
        distance_dict[distance].add((i,j))

for keys,vals in distance_dict.items():
    print(len(vals))


Fixed submission:
n, x, y = map(int,input().split())
x -= 1
y -= 1

distance_l = [0]*(n-1)

for i in range(n):
    for j in range(i+1,n):
        distance = min(abs(i-j),abs(i-x)+1+abs(j-y),abs(i-y)+1+abs(j-x))
        distance_l[distance-1] += 1

for val in distance_l:
    print(val)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
p_l = list(map(int,input().split()))

expected = []
for val in p_l:
    expected.append((val+1)/2)

ans = 0
for i in range(n-k+1):
    tmp = 0
    for j in range(i,i+k):
        tmp += expected[j]
    ans = max(ans, tmp)

print(ans)

Fixed submission:
n, k = map(int,input().split())
p_l = list(map(int,input().split()))

expected = []
for val in p_l:
    expected.append((val+1)/2)

tmp = 0
for i in range(k):
    tmp += expected[i]
ans = tmp

for i in range(k,n):
    tmp -= expected[i-k]
    tmp += expected[i]
    ans = max(ans, tmp)

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

ans = 0
i = 0
while True:
    if n//2 = 1:
        break
    i += 1
    ans += n//2//(5**i)
    if n//2//(5**i) == 0:
        break

print(ans)

Fixed submission:
n = int(input())

ans = 0
i = 0
while True:
    if n%2 == 1:
        break
    i += 1
    ans += n//2//(5**i)
    if n//2//(5**i) == 0:
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
total = 0
for i in range(n):
    total += i
print(total)

Fixed submission:
n = int(input())
print(n*(n-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
s_l = list(input())
result = [0] *len(s_l)
moving = [1] *len(s_l)

for i in range(len(s_l)):
    if moving[i] == 0:
        continue
    str_rl = s_l[i]
    shift = 0
    count = 0
    while str_rl == s_l[i]:
        if str_rl == 'R':
            shift += 1
        else:
            shift -= 1
        count += 1
        if count%2 == 0 and str_rl =='R':
            moving[i] += moving[i+shift]
            moving[i+shift] = 0
        str_rl = s_l[i+shift]
    if count%2 != 0:
        if str_rl == 'R':
            shift += 1
        else:
            shift -= 1
    result[i+shift] += moving[i]

print(' '.join(map(str,result)))



Fixed submission:
s_l = list(input())
n = len(s_l)
result = [1] *len(s_l)

# only for R
for i in range(n):
    if s_l[i] == 'L':
        continue
    if s_l[i+1] == 'L':
        continue
    else:
        result[i+2] += result[i]
        result[i] = 0

# only for L
for i in range(n):
    j = n-1 - i
    if s_l[j] == 'R':
        continue
    if s_l[j-1] == 'R':
        continue
    else:
        result[j-2] += result[j]
        result[j] = 0

print(' '.join(map(str,result)))

Buggy python submission (verdict: Time Limit Exceeded):
s_l = list(input())
result = [0] *len(s_l)

for i in range(len(s_l)):
    str_rl = s_l[i]
    shift = 0
    count = 0
    while str_rl == s_l[i]:
        if str_rl == 'R':
            shift += 1
        else:
            shift -= 1
        str_rl = s_l[i+shift]
        count += 1
    if count%2 != 0:
        if str_rl == 'R':
            shift += 1
        else:
            shift -= 1
    result[i+shift] += 1

print(' '.join(map(str,result)))

Fixed submission:
s_l = list(input())
n = len(s_l)
result = [1] *len(s_l)

# only for R
for i in range(n):
    if s_l[i] == 'L':
        continue
    if s_l[i+1] == 'L':
        continue
    else:
        result[i+2] += result[i]
        result[i] = 0

# only for L
for i in range(n):
    j = n-1 - i
    if s_l[j] == 'R':
        continue
    if s_l[j-1] == 'R':
        continue
    else:
        result[j-2] += result[j]
        result[j] = 0

print(' '.join(map(str,result)))