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: Accepted

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


def count5(n):
    d = 5
    while d < n:
        d *= 5
    c = 0
    while d != 1:
        c += n / d
        d /= 5
    return c


def main():
    n = input()
    if n % 2 == 1:
        print 0
    else:
        print min(count5(n / 2), n / 2)


main()

Submission status: Accepted

Solution code:
N = int(input())

def zero_counter(n):
        div = 5
        count = 0
        while div<=n:
                count+=n//div
                div *= 5
        return count
                

if N%2==0:
        n = N//2
        print(zero_counter(n))
else:
        print(0)

Submission status: Accepted

Solution code:
import sys
n=int(input())
if n%2==1:
    print(0)
    sys.exit()
count=0
x=n//10
count+=x
n//=10
for i in range(36):
    x=n//5
    count+=x
    n//=5
print(count)

Submission status: Accepted

Solution code:
N = input()
if N%2!=0:
  print 0
else:
  ans = 0
  N /= 2
  while N>0:
    ans += N/5
    N /= 5
  print ans

Submission status: Accepted

Solution code:
from decimal import *
n=int(input())
a=0
if n%2==1:
    print(0)
else:
    for i in range(30):
        a+=Decimal(n)//Decimal(10*5**(i))
    print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())

    s = 0

    c = n
    while c:
        c //= 5
        s += c // 2

    print(0 if n % 2 else s)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#E
N = int(input())
if N%2 == 1:
    print(0)
else:
    m = 5
    ans = 0
    n = N//2
    while m <= n:
        ans+=(n//m)
        m*=5
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

F=[-1]*100
F[0]=F[1]=1

for i in range(2,100):
    F[i]=i*F[i-2]

#print(F)

n=int(input())

if n%2==1:
    print(0)
    sys.exit()
else:
    ANS=0
    for i in range(1,100):

        ANS+=n//(2*(5**i))


    print(ANS)

Submission status: Accepted

Solution code:


def tail_zeros(n):
    if n % 2 == 1:
        return 0
    cnt = 0
    d = 10
    while n >= d:
        cnt += n // d
        d *= 5
    return cnt


n = int(input())
print(tail_zeros(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def zero(n):
    if n & 1:
        return 0

    res = 0
    base = 1
    while n // base:
        base *= 5
        res += n//(base*2)
    return res


if __name__ == "__main__":
    n = int(input())
    ans = zero(n)
    print(ans)

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
def prime_decomposition(n): #素因数分解
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table

def make_divisors(n): #約数列挙
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


n = onem()

if n % 2 == 1:
    print(0)
    exit()
else:
    kkk = n // 10
    po = 10
    while True:
        po *= 5
        if po > n:
            break
        kkk += n//po

print(kkk)

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:
    l=[10]
    for i in range(50):
        l.append(l[-1]*5)
    #print(l)
    ans=0
    for i in range(50):
        ans+=n//l[i]
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    n=int(input())
    if n%2==1:
        print(0)
        sys.exit()
    i=10
    ans=0
    while i<=n:
        ans+=n//i
        i*=5
    print(ans) 


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
if N%2 == 0:
    d = 10
    cnt = 0
    while d<=N:
        n = N//d
        cnt+=n
        d*=5
    print(cnt)
else:
    print(0)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

from collections import deque, defaultdict
import itertools as ite
import sys
import math
import decimal

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
ans = 0
if N % 2 == 0:
    N /= 2
    while N > 0:
        N /= 5
        ans += N
print ans

Submission status: Accepted

Solution code:
N=int(input())
if N%2:
    print(0)
else:
    ans = 0
    x = N//10
    while x:
        ans += x
        x = x//5
    print(ans)

Submission status: Accepted

Solution code:

N = int(input())
if N % 2 == 1:
    print(0)
else:
    ans = 0
    N = N //2
    while N != 0:
        ans += N //5
        N = N // 5
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

x = 5
ans = 0

while x <= n:
    ans += n // x // 2
    x *= 5

print (ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
if N%2==0:
    N//=2
    while N>0:
        N//=5
        ans += N
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    if n % 2 == 1:
        return 0
    n //= 2
    res = 0
    while n >= 5:
        n //= 5
        res += n
    return res


print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
if n%2:
    print(0)
    quit()
res = 0
for i in range(1,100):
    res += n//((5**i)*2)
print(res)

Submission status: Accepted

Solution code:
n=int(input())
if n%2:print(0);exit()
d=[10, 50, 250, 1250, 6250, 31250, 156250, 781250, 3906250, 19531250, 97656250, 488281250, 2441406250, 12207031250, 61035156250, 305175781250, 1525878906250, 7629394531250, 38146972656250, 190734863281250, 953674316406250, 4768371582031250, 23841857910156250, 119209289550781250, 596046447753906250, 2980232238769531250]
ans=0
for i in d:
  ans+=n//i
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 1:
    print(0)
    exit()
ans = 0
for i in range(1, 100):
    ans += n //(2* 5**i)
print(ans)

Submission status: Accepted

Solution code:
def solve(n):
    if n % 2 == 1:
        return 0
    d = n // 10
    ans = d
    while d:
        d //= 5
        ans += d
    return ans


n = int(input())
print(solve(n))

Submission status: Accepted

Solution code:
def examA():
    AB = [I() for _ in range(2)]
    for i in range(1,4):
        if not i in AB:
            ans = i
            break
    print(ans)
    return

def examB():
    N = I()
    S,T = LSI()
    ans = ""
    for i in range(N):
        ans += S[i]+T[i]
    print(ans)
    return

def gcd(x, y):
    if y == 0:
        return x
    while y != 0:
        x, y = y, x % y
    return x
def lcm(x, y):
    return x * y // gcd(x, y)
def examC():
    A, B = LI()
    ans = lcm(A,B)
    print(ans)
    return

def examD():
    N = I()
    A = LI()
    ans = N; cur = 1
    for a in A:
        if cur==a:
            ans -=1
            cur +=1
    if ans==N:
        ans = -1
    print(ans)
    return

def examE():
    N = I()
    ans = 0
    if N%2==0:
        N //=2
        while(N>0):
            ans +=N//5
            N //=5
    print(ans)
    return

def examF():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examE()

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 0:
    fives = 0
    tmp = 10
    while tmp <= n:
        fives += n // tmp
        tmp = 5 * tmp
    print(fives)
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

if N%2==1:
    print(0)
else:
    M = N//2
    p = 1
    count = 0
    while 5**p<=M:

        count += M//(5**p)

        p += 1

    print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')
def Z(f):
    if f:
        print('Yay!')
    else:
        print(':(')
def ispow(n):
    if int(n**.5)**2==n:
        return True
    return False

n = int(input())

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

def f(n):
    if n == 0:
        return 0
    return f(n // 5) + (n % 5)

n //= 2

print((n - f(n)) // 4)

Submission status: Accepted

Solution code:
N=int(input())

if N%2==1:
    ans=0
else:
    m=N//2
    ans=0
    while m>0:
        m//=5
        ans+=m
print(ans)

Submission status: Accepted

Solution code:
import sys
n=int(input())
if n%2==1:
  print(0)
  sys.exit()
ans=0
for i in range(25):
  ans+=n//(10*(5**i))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n < 10 or n%2:
  print(0)
else:
  t = 0
  for i in range(1,30):
    t += n//(2*5**i)
  print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n%2:
    print(0)
else:
    n=n//2
    ans = 0
    for i in range(100):
        if n//5>0:
            ans += n//5
            n=n//5
        else:
            print(ans)
            break

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
write = sys.stdout.write
def ii(): return int(readline())
def mi(): return map(int, readline().rstrip().split())
def li(): return list(readline().rstrip())
def lmi(): return list(map(int, readline().rstrip().split()))
def end(*arg): print(*arg); sys.exit()
# template


def main():
    n = ii()
    if n % 2 == 1:
        print(0)
    else:
        ans = 0
        for i in range(1, 60):
            ans += (n // (2 * pow(5, i)))
        print(ans)

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

if N % 2 == 1:
    print(0)
else:
    ans = 0
    for i in range(1, 50):
        ans += (N // (2*5**i))
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:
    c=0
    x=10
    while x<=10**18:
        c+=n//x
        x*=5
    print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()

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

Submission status: Accepted

Solution code:
n = int(input())

if n % 2 == 1:
    print(0)
else:
    n2 = 0
    n5 = 0
    i = 2
    while i <= n:
        n2 += n//i
        i *= 2
    i = 10
    while i <= n:
        n5 += n//i
        i *= 5
    # print(n2,n5)
    print(min(n2,n5))

Submission status: Accepted

Solution code:

N = int(input())

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

else:
    ans = 0
    now = 10

    while now <= N:
        ans += N // now
        now *= 5

    print (ans)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    ans = 0
    n = I()
    if n%2:
        print(0)
        return
    k = 5
    while k < n:
        ans += (n//k)//2
        k *= 5
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n = int(input())
if n%2:
    print(0)
    exit()
ans = 0
m = 10
while n//m:
    ans += n//m
    m *= 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    if n%2==1:
        return 0
    k=10
    ans=0
    for i in range(100):
        ans+=n//k
        k*=5
    return ans
    
if __name__=='__main__':
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n=inp()
    if n%2==0:
        n = n//2
        ans = 0
        while n>0:
            ans += n//5
            n = n//5
        print(ans)
    else:
        print(0)
        
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import itertools, heapq, bisect
from collections import defaultdict as ddic, deque, Counter

rr = raw_input
rri = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())
MOD = 10 ** 9 + 7

###

def shake(n, p):
    x = n
    ans = 0
    while x:
        ans += x // p
        x //= p
    return ans

def solve(N):
    if N%2: return 0
    K = N // 2
    # K! 2^K
    a = shake(K, 2) + K
    b = shake(K, 5)
    return min(a,b )

print solve(rri())

Submission status: Accepted

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:
    n//=2
    ans=0
    i=1
    while True:
        c=n//(5**i)
        if c>=1:
            ans+=c
            i+=1
        else:
            break
    print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
cnt = 0
x = len(str(n))

if n % 2 == 1:
  print(0)
  EXIT()
for i in range(1,26):
  cnt += n//((5**i)* 2)


print(cnt)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
if n == 0:
    print(0)
if n == 1:
    print(0)
else:
    if n % 2 ==1:
        print(0)
    else:
        ans = 0
        l = 10
        while n>=l:
            ans += floor(n/(l))
            l *= 5
        print(ans)

Submission status: Runtime Error

Solution code:
n=input()
m=len(n)
n=int(n)

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

            i+=1
    print(ans)

Submission status: Runtime Error

Solution code:
n=input()
m=len(n)
n=int(n)

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

            i+=1
print(ans)

Submission status: Runtime Error

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

if __name__ == "__main__":
    n=int(input())
    res=fact(n)
    if str(res)[-1]=='0':
        print(1)
    else:
        print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
c=1
for i in range(n):
  if a[i]==c:
    ans[i]=1
    c+=1
print(n-sum(ans))

Submission status: Runtime Error

Solution code:
n = int(input())
if n % 2 != 0:
    print(0)
    exit()

m = 10
a = []
b = []
while m <= n:
    a.append(n // m)
    m *= 5
    if len(a) > 1:
      b.append(a[-2] - a[-1])
b.append(a[-1])

ans = 0
for i in range(len(b)):
    ans += (i+1)*b[i]
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

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

print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
M = 10
ans = 0

if N % 2 == 0
  while N > M:
    ans += N//M
    M *= 5
print(ans)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
if n%2==1:
    print(0)
else:
    print(sum([n//(2*pow(5,i)) for i in range(1,math.ceil(math.log(n,5)))]))

Submission status: Runtime Error

Solution code:
# 148e

from sys import stdin
import re
import numpy as np
import math

#stdin = open("test/abc148_e_sample-3.in")
def get_rank(N):
    rank = int(np.log(N)/np.log(5))
    #print(rank)
    
    num = 0
    
    for i in range(1, rank+1):
        num_i = N//(2*5**i)
        #print(num_i)
        num += num_i
    
    return num

N = int(stdin.readline().strip())

if N%2==1 or 0:
    print(0)
else:
    print(get_rank(N))

Submission status: Runtime Error

Solution code:
# 148e

from sys import stdin
import re
import numpy as np
import math

#stdin = open("test/abc148_e_sample-3.in")
def get_rank(N):
    rank = int(np.log(N)/np.log(5))
    #print(rank)
    
    num = 0
    
    for i in range(1, rank+1):
        num_i = N//(2*5**i)
        #print(num_i)
        num += num_i
    
    return num

N = int(stdin.readline().strip())

if N%2==1:
    print(0)
else:
    print(get_rank(N))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000000)

n,u,v = map(int,input().split())
u -= 1
v -= 1
G = [[] for _ in range(n)]
for _ in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

dist = [-1]*n
dist[v] = 0
prev = [-1]*n
def dfs(now):
    for nxt in G[now]:
        if dist[nxt] != -1: continue
        dist[nxt] = dist[now]+1
        prev[nxt] = now
        dfs(nxt)
dfs(v)

color = [0]*n
now = u
while now >= 0:
    color[now] = 1
    now = prev[now]

def dfs2(now,prev,dist,cnt):
    if dist == 0: return cnt
    if dist == -1: return cnt-1
    if G[now] == [prev]: return cnt+dist-1
    res = 0
    for nxt in G[now]:
        if nxt == prev: continue
        if color[nxt]: res = max(res,dfs2(nxt,now,dist-2,cnt+1))
        else: res = max(res,dfs2(nxt,now,dist,cnt+1))
    return res

print(dfs2(u,-1,dist[u]-dist[v],0))

Submission status: Runtime Error

Solution code:
N = int(input())

if N % 2 != 0:
    print('0')
else:
    count = 0
    i = 1
    while True:
        dif = (N // 2) // (5 ** i)
        count += dif
        if dif == 0:
            break

        i += 1

print(count)

Submission status: Runtime Error

Solution code:
n = int(input())

def func(x):
  if x < 2:
    return 1
  else:
    return x * func(x - 2)
  
tmp = func(n)
res = 0
while tmp % 10 == 0:
  tmp = tmp // 10
  res += 1
print(res)

Submission status: Runtime Error

Solution code:
N = int(input())
if N % 2 == 1:
	print(0)
else:
	ans = 0
	if N <= 9:
		pass
	else:
		ans += N//10
		N = int(N/10)
		while N >= 5:
			ans += N//5
			N = int(N/5)
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
if n%2 == 1:
    print(0)
else:
    cur_two, cur_ten = 2, 10
    num_two, num_ten = 0, 0
    while cur_two <= n:
        num_two += n//cur_two
        cur_two *= 2
    while cur_ten <= n:
        num_ten += n//cur_ten
        cur_ten *= 5
print(min(num_two, num_ten))

Submission status: Runtime Error

Solution code:
import math

n = int(input())
ans = 0
if n== 0:
  print(0)
  exit()
m = math.floor(math.log(n//2,5))

if n%2 == 1:
  print(0)
else:
  for j in range(1,m+1):
    ans += n//((5**j)*2)
    
    
  print(ans)

Submission status: Runtime Error

Solution code:
import math

n = int(input())
ans = 0
m = math.floor(math.log(n,5))

if n%2 == 1:
  print(0)
else:
  for j in range(1,m+1):
    ans += n//((5**j)*2)
    
    
  print(ans)

Submission status: Runtime Error

Solution code:
import sys
import math

N = int(input())
# N, K = [int(i) for i in input().split()]

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

count = 0
digit = math.ceil(math.log(N, 5))
for i in range(1, digit+1):
    x = 5 ** i
    count += (N // (x * 2))
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
if n%2 == 1:
    print(0)
    
else:
    list5 = []
    flag = True
    num = 5
    while flag:
        tmp = n//(num*2)
        if tmp > 0:
            list5.append(tmp)
            num *= 5
        else:
            flag = False
    ans_list = []
    for i in range(len(list5)-1):
        ans_list.append(list5[i] - list5[i+1])
    ans_list.append(list5[-1])
    ans = 0
    for i in range(len(ans_list)):
        ans += ans_list[i]*(i+1)
    print(ans)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
n,p = map(int,input().split())
s = list(map(int,list(input())))[::-1]
ans = 0
if p == 2 or p == 5:
    for i in range(n):
        if s[i]%p==0:
            ans += n-i
    print(ans)
else:
    d = defaultdict(int)
    check = 0
    for i in range(n):
        check += s[i]*10**i
        check %= p
        ans += d[check]
        if check == 0:
            ans+=1
        d[check] += 1
        ten += 1
    print(ans)

Submission status: Runtime Error

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

N=int(input())
count0=0
ans=f(N)
ans=str(ans)
if(ans[-1]=="0"):
  count0+=1
  ans=ans[:-1]

print(count0)

Submission status: Runtime Error

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *
 
N = INT()

if N%2:
	print(0)
else:
	ans = 0
	for i in range(1, int(log2(N)/log2(5))+1):
		ans += N //(5**i*2)
	print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

if n % 2 == 1:
    print(0)
else:
    flg = 0
    ans = 0
    while n >= 5:
        if flg == 0:
            ans += n // 10
            n //= 10
            flg = 1
        else:
            ans += n // 5
            n //= 5

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

if n % 2 == 1:
    print(0)
else:
    a = 10
    coef = 5
    cnt = 0
    ans = 0
    while a*coef**cnt <= n:
        ans += n // (a*coef**cnt)
        cnt += 1

print(ans)

Submission status: Runtime Error

Solution code:
import math
N=int(input())
if N%2==1:
    print(0)
else:
    v=0
    n=int(math.log(N,5))
    for i in range(n):
        k=i+1
        m=N//(pow(5,k))
        v+=int(m/2)
    print(v)
    x=1

Submission status: Runtime Error

Solution code:
import math
N=int(input())
if N%2==1:
    print(0)
else:
    v=0
    n=int(math.log(N,5))
    for i in range(n):
        k=i+1
        m=N//(pow(5,k))
        v+=int(m/2)
    print(v)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import fractions

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