Problem:


Score : 500 points

Problem Statement

For an integer n not less than 0, let us define f(n) as follows:

f(n) = 1 (if n < 2)

f(n) = n f(n-2) (if n \geq 2)

Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N).

Constraints

0 \leq N \leq 10^{18}

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of trailing zeros in the decimal notation of f(N).

Sample Input 1

12

Sample Output 1

1

f(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080, which has one trailing zero.

Sample Input 2

5

Sample Output 2

0

f(5) = 5 × 3 × 1 = 15, which has no trailing zeros.

Sample Input 3

1000000000000000000

Sample Output 3

124999999999999995



Sample input:
12


Sample output:
1

Submission status: Runtime Error

Solution code:
    def f(n):
      d = 2
      ans = 0
      while n>d:
        d*=5
        n//=d
        ans+=n
      return ans
     
    print(f(int(input())))

Submission status: Runtime Error

Solution code:
def f(n):
  d = 2
  ans = 0
  while n>d:
    d*=5
    n//=d
    ans+=n
  return ans

print(f(int(input()))

Submission status: Runtime Error

Solution code:
N = int(input())
if N % 2 == 1:
  print(0)
else:
  # i = 5 で始めると奇数が入る
  i = 10
  result = 0
  while N > i:
    result += N//i
    i *= 5
print(result)

Submission status: Runtime Error

Solution code:
N=input()
lenN=len(N)
N=int(N)


if N%2==1 or N<10:
    print(0)
else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop) or N%(10*5**loop)!=0:
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
print(count)

Submission status: Runtime Error

Solution code:
N=input()
lenN=len(N)
N=int(N)

else:
    count=0
    loop=0
    while(1):
        if N<(10*5**loop) or N%(10*5**loop)!=0:
            break
        else:
            count+=N//(10*5**loop)
            loop+=1
            print(count)

Submission status: Runtime Error

Solution code:
N = int(input())

import math

if N % 2 == 1:
    print(0)
else:
    half = N // 2
    m = math.floor(math.log(half, 5))
    cnt = 0
    for i in range(m):
        cnt += half // (5 ** (i+1))
    print(cnt)

Submission status: Runtime Error

Solution code:
N = int(input())

if N % 2 == 1:
    ans = 0
else:
    count = 1
    num5 = 0
    while N//2 >= 5**count:
        num5 += N//(2*5**count)
        count+=1

print(num5)

Submission status: Runtime Error

Solution code:
n=input()
if(n&1):
    print(0)
else:
    ans=0
    n /= 2
    while(n>=5):
        ans += n//5
        n //= 5
    print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
elif n % 2 == 0:
    ans = n//10
    kar = n//10
    while True:
        if kar // 5 >= 1:
            ans += kar // 5
            kar = kar// 5
        elif kar // 5 < 1:
            break
print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**18)

N = int(input())
memo={0:1,1:1,2:2}

def func(n):
    if n in memo:
        return memo[n]
    memo[n] = n*func(n-2)
    return memo[n]

f = list(str(func(N)))  
ans = 0

for i in range(1,len(f)):
    if f[-i]== "0":
        ans += 1
    else:
        break
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
memo={0:1,1:1,2:2}

def func(n):
    if n in memo:
        return memo[n]
    memo[n] = n*func(n-2)
    return memo[n]

f = list(str(func(N)))  
ans = 0

for i in range(1,len(f)):
    if f[-i]== "0":
        ans += 1
    else:
        break
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

def func(n):
    if n<2:
        return 1
    else:
        return n*func(n-2)

f = list(str(func(N)))  
ans = 0

for i in range(1,len(f)):
    if f[-i]== "0":
        ans += 1
    else:
        break
print(ans)

Submission status: Runtime Error

Solution code:
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)

Submission status: Runtime Error

Solution code:
import math


def main():
  n = int(input())
  
  if n % 2 == 1:
    print(0)
    return
  
  # 倍数を数える
  ten_pow = [n // (10 ** (i + 1)) for i in range(int(math.log10(n)))]
    
  print(sum(ten_pow))

if __name__ == "__main__":
  main()

Submission status: Runtime Error

Solution code:
import math


def main():
  n = int(input())
  
  if n % 2 == 1:
    print(0)
    return
  
  # 倍数を数える
  two_pow = [n // (2 ** (i + 1)) for i in int(math.log(n, 2))]
  five_pow = [n // (5 ** (i + 1)) for i in int(math.log(n, 5))]
  ten_pow = [n // (10 ** (i + 1)) for i in int(math.log10(n))]
    
  print(sum(ten_pow) + min(sum(two_pow), sum(five_pow)))

if __name__ == "__main__":
  main()

Submission status: Runtime Error

Solution code:
N= int(input())
if N%2==1:
 print(0)
else:
 a=0
 i=0
 while (5**i)*2<=N:
  i+=1
  b=(5**i)*2
  a+=(N//b)
print(a)

Submission status: Runtime Error

Solution code:
N= int(input())
if N%2==1:
 print(0)
else:
 N/=2
 a=0
 i=0
 while (5**i)<=N:
  i+=1
  b=5**i
  a+=(N//b)
print(a)

Submission status: Runtime Error

Solution code:
N= int(input())
if N%2==1:
 print(0)
else:
 N/=2
 a=0
 i=0
 while (5**i)<=N:
  i+=1
  a+=int(N/(5**i))
print(a)

Submission status: Runtime Error

Solution code:
import sys
si = sys.stdin.readline
so = sys.stdout.write
sys.setrecursionlimit(1000000)


def re(n):
    if n < 2:
        return 1
    else:
        return n*re(n-2)


def main():
    n = int(si())
    v = re(n)
    l = []
    while v != 0:
        l.append(v % 10)
        v //= 10
    count = 0
    for e in l:
        if e == 0:
            count += 1
        else:
            break
    print(count)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
si = sys.stdin.readline
so = sys.stdout.write


def re(n):
    if n < 2:
        return 1
    else:
        return n*re(n-2)


def main():
    n = int(si())
    v = re(n)
    l = []
    while v != 0:
        l.append(v % 10)
        v //= 10
    count = 0
    for e in l:
        if e == 0:
            count += 1
        else:
            break
    print(count)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# E - Double Factorial

N = int(input())

ans = 0
p = 10

if (N%2):
    continue
else:
    while True:
        if p > N:
            break
        ans += N // p
        p *= 5

print(ans)

Submission status: Runtime Error

Solution code:
import sys
n=10000000
sys.setrecursionlimit(n)
def s(l):
    if l<2:
        return 1
    else:
        return s(l-2)
ab=int(input())
ll=s(ab)
a=0
b=1
while(b):
    if(ll%10!=0):
        b=0
    else:
        a=a+1
print(a)

Submission status: Runtime Error

Solution code:

def s(l):
    if l<2:
        return 1
    else:
        return s(l-2)
ab=int(input())
ll=s(ab)
a=0
b=1
while(b):
    if(ll%10!=0):
        b=0
    else:
        a=a+1
print(a)

Submission status: Runtime Error

Solution code:
ab=int(input())
ll=s(ab)
def s(l):
    if l<2:
        return 1
    else:
        return s(l-2)
a=0
b=1
while(b):
    if(ll%10!=0):
        b=0
    else:
        a=a+1
print(a)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.buffer.readline
 
def main():
    a,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,a)+comb(a,b))%MOD)
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
n = int(readline())
if n % 2 == 1:
    print(0)
else:
    n //= 2
    ans = 0
    while n:
        n //= 5
        ans += n
    print(ans)

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 a= int(readline())
if a % 2 == 1:
    print(0)
else:
    a //= 2
    ans = 0
    while a:
        a //= 5
        ans += a
    print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h> 
using namespace std; 
  
// Function to return the count of 
// trailing 0s in the given function 
int findTrailingZeros(int n) 
{ 
    // If n is odd 
    if (n & 1) 
        return 0; 
  
    // If n is even 
    else { 
        int ans = 0; 
  
        // Find the trailing zeros 
        // in n/2 factorial 
        n /= 2; 
        while (n) { 
            ans += n / 5; 
            n /= 5; 
        } 
  
        // Return the required answer 
        return ans; 
    } 
} 
  
// Driver code 
int main() 
{ 
    int n;
    cin>>n; 
  
    cout << findTrailingZeros(n); 
  
    return 0; 
}

Submission status: Runtime Error

Solution code:
def findTrailingZeros(n): 
      
    # If n is odd 
    if (n & 1): 
        return 0
  
    # If n is even 
    else: 
        ans = 0
  
        # Find the trailing zeros 
        # in n/2 factorial 
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        # Return the required answer 
        return ans 
  
# Driver code 
  
n=input();
  
print(findTrailingZeros(n))

Submission status: Runtime Error

Solution code:
def findTrailingZeros(n): 
      
    # If n is odd 
    if (n & 1): 
        return 0
  
    # If n is even 
    else: 
        ans = 0
  
        # Find the trailing zeros 
        # in n/2 factorial 
        n //= 2
        while (n): 
            ans += n // 5
            n //= 5
  
        # Return the required answer 
        return ans 
  
# Driver code 
  
 input(n)
  
print(findTrailingZeros(n))

Submission status: Runtime Error

Solution code:
import sys
import numpy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p = int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while p:
        p //= 5
        ans += p
    print(ans

Submission status: Runtime Error

Solution code:
def fac(n):
    if(n==0 or n==1):
        return 1
    else:
        return (n * fac(n-2))

n = int(input())
string = ""
x = 0
if(n == 0):
    print("1")
elif(n==1):
    print("0")
else:
    x = fac(n)

    string = str(x)
    # print(string)
    count=0
    
    for i in range((len(string)-1),0,-1):
        # print(string[i])
        if(string[i]=="0"):
            count+=1
        else:
            break
    print("Count : ",count)

Submission status: Runtime Error

Solution code:
n=int(input('enter number'))
def doublefactorial(n): 
    if (n == 0 or n == 1): 
        return 1; 
    return n * doublefactorial(n - 2);

def trailing_zeros(longint):
    manipulandum = str(longint)
    return len(manipulandum)-len(manipulandum.rstrip('0'))
  

print(trailing_zeros(doublefactorial(n)))

Submission status: Runtime Error

Solution code:
n=int('enter number')
def doublefactorial(n): 
    if (n == 0 or n == 1): 
        return 1; 
    return n * doublefactorial(n - 2);

def trailing_zeros(longint):
    manipulandum = str(longint)
    return len(manipulandum)-len(manipulandum.rstrip('0'))
  
print("Double factorial is",  
       doublefactorial(n));

print('trailing zeroes are'+ str(trailing_zeros(doublefactorial(n))))

Submission status: Runtime Error

Solution code:
n=int(input('enter number'))
def doublefactorial(n): 
    if (n == 0 or n == 1): 
        return 1; 
    return n * doublefactorial(n - 2);

def trailing_zeros(longint):
    manipulandum = str(longint)
    return len(manipulandum)-len(manipulandum.rstrip('0'))
  
print("Double factorial is",  
       doublefactorial(n));

print('trailing zeroes are'+ str(trailing_zeros(doublefactorial(n))))

Submission status: Runtime Error

Solution code:
def findTrailingZeroes(n):
       if(n & 1):
           return 0
       else:
              ans=0
              n //=2
              while(n):
                      ans +=n//5
                      n//=5
               return ans
n=12
print(findTrailingZeroes(n))

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
n1 = int(readline())
if n1 % 2 == 1:
    print(0)
else:
    n1 //= 2
    ans = 0
    while n:
        n1 //= 5
        ans += n1
    print(ans)

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p= int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while n:
        p //= 5
        ans += p
    print(ans)

Submission status: Runtime Error

Solution code:
def doublefactorial(n): 
  
    if (n == 0 or n == 1): 
        return 1; 
    return n * doublefactorial(n - 2); 
  
p=int(input())
print("Double factorial is",  
       doublefactorial(p));

Submission status: Runtime Error

Solution code:
def factorial(n): 
    return 1 if (n==1 or n==0) else n *factorial(n-2);  
  
num = int(input())
print(factorial(num))

Submission status: Runtime Error

Solution code:
def fact(x):
    if x<2:
        return 1
    else:
        return x*fact(x-2)
        
facto = str(fact(int(input())))
count=0
for x in range(len(facto)-1,-1,-1):
    if facto[x]=="0":
        count+=1 
    else:
        break
    
print(count)

Submission status: Runtime Error

Solution code:
import sys

def double_factorial(args):
    for n in args:
        if n % 2 == 0 or n < 1:
            error = 'Must enter an odd number greater than or equal to one.'
            raise ValueError(error)

    max_arg = max(args)
    total = 1
    results = []
    for arg in args:
        for i in [x for x in range(1, max_arg + 1) if x % 2 != 0]:
            if i <= arg:
                total *= i
        results.append(total)
        total = 1
    return results


if __name__ == '__main__':
    if len(sys.argv) > 1:
        if sys.argv[1] == '-n':
            arg = int(sys.argv[2])
            args = []
            for i in range(1, arg + 1):
                args.append(2 * i - 1)
            results = double_factorial(args)
        else:
            args = [int(x) for x in sys.argv[1:]]
            results = double_factorial(args)
        for result in results:
            print result
    else:
        Exception('At least one integer is expected.')

Submission status: Runtime Error

Solution code:
n = input()

ans = 0

if int(n) % 2 == 0:
    n = int(n[:-1])
    for i in range(27):
        ans += n // 5 ** i

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
if n % 2 == 1:
    print(0)
else:
    count = 0
    n //= 2
    while n > 0:
        n//= 5
        count += n
	print(count)

Submission status: Runtime Error

Solution code:
def resolve():
    n = int(input())
    if n % 2:
        print('0')
        # quit()
    ans = 0
    def func(n):
        nonlocal ans
        if n < 9:
            return
        if n % 10 == 0:
            ans += n // 10
        func(n-2)
    func(n)
    if not (n % 2):
        print(ans)

resolve()

Submission status: Runtime Error

Solution code:
def resolve():
    n = int(input())
    def func(n):
        if n < 9:
            return 0
        if n % 10 == 0:
            return n // 10 + func(n-2)
        else:
            return 0 + func(n-2)
    print(func(n))
resolve()

Submission status: Runtime Error

Solution code:
N = int(input())
if N % 2 == 0:
else:
  print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
cnt_10=0
if n%2==1:
    print(0)
else:
    for i in range(100):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)

Submission status: Runtime Error

Solution code:
n=int(input())
cnt_2=0
cnt_10=0
if n%2==1:
    print(0)
else:

    for i in range(1000):
        if 2*5**i<=n and n<2*5**(i+1):
            MAX_10=i
            break
    for j in range(1,MAX_10+1):
        cnt_10+=n//(2*5**j)  
    print(cnt_10)

Submission status: Runtime Error

Solution code:
n=int(input())
if n%2<1:
 a=n=n//10
 while n:n//=5;a+=n
print(a)

Submission status: Runtime Error

Solution code:
import math
N = int(input())

ans = 0

if N % 2 != 0:
    pass
else:
    max_pow_five = int(math.log(N, 5))
    for i in range(1, max_pow_five + 1):
        ans += N // ((5 ** i) * 2)

print(ans)

Submission status: Runtime Error

Solution code:
import math
def main():
	N = int(input())
	P = int(math.log(N,5))
	ans = 0
	if N%2 == 1:
		print(0)
	else:
		N = int(N/2)
		ans = [ int(N/(5**p)) for p in range(1,P+1)]
		print(sum(ans))

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
import math
def main():
	N = int(input())
	P = int(math.log(N,5))
	ans = 0
	if N%2 == 1:
		print(0)
	else:
		ans = [int((N/2)/int(pow(5,p))) for p in range(1,P)]
		print(sum(ans)+1)

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
import math
def main():
	N = int(input())
	P = int(math.log(N,5))
	ans = 0
	if N%2 == 1:
		print(0)
	else:
		ans = [int((N/2)/int(pow(5,p))) for p in range(P)]
		print(sum(ans)+1)

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
import math
def main():
	N = int(input())
	P = int(math.log(N,5))
	ans = 0
	
	ans = [int((N/2)/pow(5,p)) for p in range(1,P)]
	print(sum(ans))


if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
def f(n):
    if n<2:
        return(1)
    else:
        return(n*f(n-2))

N=int(input())

F=f(N)
ans=0

while F%10==0:
    ans+=1
    F=F/10

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
if n%2:
    print(0)
else:
    tmp = 5
    ans = 0
    n //= 2
    while tmp < n:
        ans += n//tmp
        tmp *= 5
print(ans)

Submission status: Runtime Error

Solution code:
n = str(input())
tmp = len(n)
bai = 1
if int(n)%2:
    print(0)
else:
    ans = 0
    for i in range(1,tmp):
        if i == 1:
            ans += int(n[-1-i]) * bai
        elif i == 2:
            bai = 12
            ans += int(n[-1 - i]) * bai
        elif i == 3:
            bai = 124
            ans += int(n[-1 - i]) * bai
        elif i < 18:
            bai *= 10
            bai += 9
            ans += int(n[-1 - i]) * bai
        else:
            ans = 124999999999999995
print(ans)

Submission status: Runtime Error

Solution code:
u = int(input())
two = 0
five = 0
while u > 1:
  if u % 2 == 0:
    two = two  + 1
  if u % 5 == 0:
    five = five + 1
  u = u - 2
print(min(two ,five)

Submission status: Runtime Error

Solution code:
def count_zero(num):
    i = 10
    count = 0
    while(i <= num):
        count += int(num/i)
        i = i*5
    return count
n = int(input())
print(factorial(n))
if(n % 2 == 0):
    print(count_zero(n))
else:
    print(0)

Submission status: Runtime Error

Solution code:
n = int(input())

def fact(n):
    if n == 0:
        return 1
    return n * fact(n - 2)


s = list(str(fact(n)))
print(s)
c = 0
i = len(s) - 1
while s[i] == "0":
    c += 1
    i -= 1
print(c)

Submission status: Runtime Error

Solution code:
nt(input())
if n%2 == 0:
    num=10
    c=0;
    while num <= n:
        c += (n//num)
        num *= 5
    print(c)
else:
    print(0)

Submission status: Runtime Error

Solution code:
N = input()
if int(N[-1]) %2 == 0:
    ans = int(N[:-1])
    N = int(N[:-1])
    k = 1
    while k != 0:
        k = N // 5
        N = k
        ans += k
    print(ans)
else:
    print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
if n%2==1:print(0)
ans=0
else:
  for i in range(1,26):
    ans+= n//(5**i)
print(ans)

Submission status: Runtime Error

Solution code:
def fx(X, n):
    if (int(X/n)):
        return fx(int(X/n), n)+(X//n)
    return 0

N=int(input())
if N%2==1:
  print(0)
else:
  print(fx(N/2,0))

Submission status: Runtime Error

Solution code:
def fx(X, n):
    if (int(X/n)):
        return fx(int(X/n), n)+(X//n)
    return 0

N=int(input())
if N%2==1:
  print(0)
else:
  print(fx(n/2,0))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**7)
 
def calcmore2(num,result,ans):
    while result%10 == 0 and result >= 10:
        result = result / 10
        ans += 1
    if num >= 2:return calcmore2(num-2, num-2, ans)
    else:return ans
 
A = int(input())
ans = 0
ans = calcmore2(A, 1,ans)
print(ans)

Submission status: Runtime Error

Solution code:
import sys
 sys.setrecursionlimit(10**7)

def calcmore2(num,result,ans):
    while result%10 == 0 and result >= 10:
        result = result / 10
        ans += 1
    if num >= 2:return calcmore2(num-2, num-2, ans)
    else:return ans
 
A = int(input())
ans = 0
ans = calcmore2(A, 1,ans)
print(ans)

Submission status: Runtime Error

Solution code:
def cal(n):
	#dp=[]
	if n<2:
		return 1
	else:
		return n*cal(n-2)

n=int(input())
ans=cal(n)
cnt=0
while ans%10==0:
	ans//=10
	cnt+=1
#print(ans)
print(cnt)

Submission status: Runtime Error

Solution code:
import math

N = int(input())
if N%2 == 1:
  print(0)
  exit()
five = N//10
for i in range(int(math.log(N//10,5))):
  five += N//(10*5**(i+1))
print(five)
124999999999999995

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0

if n % 2 == 0:
    n = n // 2
    fives = 5
    while 1:

        if fives > n: 
            break
        ans += n // fives
        fives *= 5

print(ans) 
    
    '

Submission status: Runtime Error

Solution code:
import math
n = int(input())
if n % 2 != 0:
    print(0)
    exit()
l = math.ceil(math.log(n, 5))
#print(l)
ans = 0
for i in range(1, l + 1):
    #print(pow(5, i), n // pow(5, i))
    ans += n // pow(5, i) // 2
print(ans)

Submission status: Runtime Error

Solution code:
def calcmore2(num,result,ans):
    while result%10 == 0 and result >= 10:
        result = result / 10
        ans += 1
    if num >= 2:return calcmore2(num-2, num-2, ans)
    else:return ans

A = int(input())
ans = 0
ans = calcmore2(A, 1,ans)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

if N % 2 == 1:
  print(0)
else:
  tmp = 2
  ans = 0
  while 5 * tmp <= N:
    tmp *= 5
    ans = ans + N // tmp
print(ans)

Submission status: Runtime Error

Solution code:
import math
N=int(input())
if N%2==1:
  print(0)
limit=int(math.log10(N))
res=0
for i in range(1,limit+1):
  N=int(N/10)
  res+=N*i
print(res)

Submission status: Runtime Error

Solution code:
import math

N = int(input())
if N % 2 == 1:
  print(0)
else:
  zero_count = 0
  for i in range(1,1+int(math.log(N//2,5)//1)):#ここのN//2がN/2にしてただけで計算が狂った。floatの扱いの問題か
    zero_count += (N//2)//(5**i)
  print(int(zero_count))

Submission status: Runtime Error

Solution code:
import math

N = int(input())
if N % 2 == 1:
  print(0)
else:
  zero_count = 0
  for i in range(1,1+int(math.log(N/2,5)//1)):
    zero_count += (N/2)//5**i
  print(int(zero_count))

Submission status: Runtime Error

Solution code:
N = int(input())

def func(n):
  if n<2:
    return 1
  else:
    return n * func(n-2)

f = func(N)
ans=0
for i in range(len(str(f))):
  if str(f)[len(str(f))-i-1] == '0':
    ans += 1
  else:
    break
print(ans)

Submission status: Runtime Error

Solution code:
import math as mt
N = int(input())

if N % 2 == 1 and N == 0:
    print(0)
    exit()

r = 0
L = int(mt.log(N,5))
for i in range(1,L+1):
    p = N//(5**i)//2
    r += p
    #print(N,5**i,p)
print(r)

Submission status: Runtime Error

Solution code:
import math as mt
N = int(input())

if N % 2 == 1:
    print(0)
    exit()

r = 0
L = int(mt.log(N,5))
for i in range(1,L+1):
    p = N//(5**i)//2
    r += p
    #print(N,5**i,p)
print(r)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    if N % 2 == 1:
        print(0)
    else:
        N //= 2
        count = 0
        while N > 1:
            N //= 5
            count += N
            
    print(count)
    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N = int(input())
print(N // 10 + sum[N // (50 ** i) for i in range(100)])

Submission status: Runtime Error

Solution code:
def func(n):
    if n < 2:
        return 1
    else:
        return n * func(n - 2)

N = int(input())

count5 = 0
count2 = 0
A = func(N)
B = func(N)
while True:
    if A % 5 == 0:
        A = int(A / 5)
        count5 += 1
    else:
        break

while True:
    if B % 2 == 0:
        B = int(B / 2)
        if count2 >= count5:
            break
        count2 += 1
    else:
        break

if count5 <= count2:
    ans = count5
else:
    ans = count2

print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**15)

N = int(input())

def DoubleFactorial(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n*DoubleFactorial(n-2)

num = float(DoubleFactorial(N))

count = -1
while num.is_integer():
    num /= 10
    count += 1

print(count)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**7)

N = int(input())

def DoubleFactorial(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n*DoubleFactorial(n-2)

num = float(DoubleFactorial(N))

count = -1
while num.is_integer():
    num /= 10
    count += 1

print(count)

Submission status: Runtime Error

Solution code:
N =int(input())
F = list(map(int,input()))
F[N] = (F[N]-2) * N 
count = 0
if N >= 2:
  for i in range(N):
    F[i] = i * (F[i]-2)
    i += 1
  for j in range(1,N):
    if F[i][-j] == 0:
      count += 1
    else:
      print(count)
      break
else:
  print(0)

Submission status: Runtime Error

Solution code:
# coding: utf-8
N = int(input())

def f(n):
    if n<2:
        return 1
    else:
        return (n*f(n-2))

a = str(f(N))
cnt = 0
for i in range(len(a)):
    if a[-1-i]=='0':
        cnt+=1
    else:
        break
print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
if(n%2 == 1):
	print(0)
else:
    n = n/2
    count = 0
    while n > 0 :
        a = n /= 5
        count += a
    print(count)

Submission status: Runtime Error

Solution code:
import numpy as np
from math import log
N = int(input())
if N % 2:
    print(0)
    quit()
print(((N // 2) // np.array([5**i for i in range(1, int(log(N // 2, 5)) + 1)], np.int64)).sum())

Submission status: Runtime Error

Solution code:
def f(n: int) -> int:
    if n < 2:
        return 1
    else:
        return n*f(n-2)

N = int(input())
num = f(N)
cnt = 0

while True:
    re = num % 10
    num = num // 10
    if re != 0:
        break
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
if n % 2 == 1:
	print(0)
	exit()
 
# 5の倍数で割り切れる回数
result = 0
i = 1
while True:
	result += inp_n // ((5 ** i) * 2)
	i += 1
	if inp_n < ((5 ** i) * 2): break
 
# 結果出力
print(result)

Submission status: Runtime Error

Solution code:
from math import log2
N = int(input())
ans = 0
for i in range(int(log2(N))):
  ans += (N // 5 ** (i+1)) // 2
if(N % 2 == 0):
  print(ans)
else:
  print(0)

Submission status: Runtime Error

Solution code:
n = int(x)
if n % 2 == 1:
  ans = 0
else:
  ans = int(n // 10) + int(n // 50) + int(n // 250)
print(ans)

Submission status: Runtime Error

Solution code:
def f(n):
    d = 10
    z = 0
    while d <= n:
        z += (n // d)
	    d = 5 * d
    return z

n = int(input())

if n % 1 == 1: # odd                                                                                                                                    
    print(0)
else: # even                                                                                                                                            
    ans = f(n)
    print(ans)

Submission status: Runtime Error

Solution code:
from math import ceil
N, u, v = map(lambda x: int(x)-1, input().split())
N += 1
edges = [list(map(lambda x:int(x)-1, input().split())) for _ in range(N-1)]
adj = [[] for _ in range(N)]
for a, b in edges:
    adj[a].append(b)
    adj[b].append(a)

# bfs from v
dist_from_v = [-1]*N
dist_from_v[v] = 0
Q = [v]
while Q:
    tmp = []
    for cur in Q:
        for next in adj[cur]:
            if dist_from_v[next] == -1:
                dist_from_v[next] = dist_from_v[cur]+1
                tmp.append(next)
    Q = tmp

dst_u = -1
# bfs from u
dist_from_u = [-1]*N
dist_from_u[u] = 0
Q = [u]
while Q:
    tmp = []
    for cur in Q:
        for next in adj[cur]:
            if dist_from_u[next] == -1:
                if dist_from_u[cur]+1 >= dist_from_v[next]:
                    # print("update")
                    cut = (cur, next)
                else:
                    dist_from_u[next] = dist_from_u[cur]+1
                    tmp.append(next)
    Q = tmp


dst_u = dist_from_u.index(max(dist_from_u))
dist_u_dst = max(dist_from_u)
dist_v_dst = dist_from_v[dst_u]
# print(dist_from_v)
# print(dist_from_u)
# print(cut)
assert dist_u_dst < dist_v_dst

if dist_v_dst % 2 == 0:
    ans = dist_u_dst+(dist_v_dst-dist_u_dst)//2
else:
    ans = dist_u_dst+dist_v_dst-dist_u_dst
print(ans)

Submission status: Runtime Error

Solution code:
def g1(x:int,p):
    if x == 0:
        return 0
    elif x < p:
        return 0
    else:
        return  g1(x/p,p)+x/p

def g2(x,p):
    if p == 2:
        return g1(x/2,p)+x/2
    else:
        return g1(x/2,p)

if N % 2 == 1:
    print(0)
else:
   ans = min(g2(N,2),g2(N,5)) 
   print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
def func(x):
    if x < 2:
        return 1
    else:
        return x*func(x-2) 
def eq2(y):
    c2 = 0
    while y % 2 == 0:
        c2 += 1 
        y = y // 2
    return c2
def eq5(y):
    c5 = 0
    while y % 5 == 0:
        c5 += 1 
        y = y // 5
    return c5

cc2 = 0
cc5 = 0
if n % 2 != 0:
    print(0)
else:
    cc2 += eq2(func(n))
    cc5 += eq5(func(n))  
    print(min(cc2, cc5))

Submission status: Runtime Error

Solution code:
n = int(input())
def func(x):
    if x < 2:
        return 1
    else:
        return x*func(x-2) 
def eq2(y):
    c2 = 0
    while y % 2 == 0:
        c2 += 1 
        y = y // 2
    return c2
def eq5(y):
    c5 = 0
    while y % 5 == 0:
        c5 += 1 
        y = y // 5
    return c5

cc2 = 0
cc5 = 0
cc2 += eq2(func(n))
cc5 += eq5(func(n))  
print(min(cc2, cc5))

Submission status: Runtime Error

Solution code:
n = int(input())
import sys
sys.setrecursionlimit(1000000000)
def func(n):
    if n < 1:
        return 1
    else:
        return n * func(n - 2)

num = str(func(n))
count = 0
for i in reversed(num):
    if i == '0':
        count += 1
    else:
        break
        
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
import sys
sys.setrecursionlimit(10000000000000000)
def func(n):
    if n < 1:
        return 1
    else:
        return n * func(n - 2)

num = str(func(n))
count = 0
for i in reversed(num):
    if i == '0':
        count += 1
    else:
        break
        
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
import sys
sys.setrecursionlimit(2000000000)
def func(n):
    if n < 1:
        return 1
    else:
        return n * func(n - 2)

num = str(func(n))
count = 0
for i in reversed(num):
    if i == '0':
        count += 1
    else:
        break
        
print(count)

Submission status: Runtime Error

Solution code:
def func(n):
  if n >= 2:
    func(n-2)
  else:
    return 1
  
  
N = int(input())

nums = func(N)

counter = 0
div = 10

while(T)
  if N % div != 0:
    break
  counter+=1