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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def dobfac(num):
    if num < 0:
        return -1;
    count = 0
    i = 5
    while num / i > 0:
        count += num // i // 2
        i *= 5
    print(count)

if __name__ == "__main__":
    import sys
    in_str = []
    for line in sys.stdin:
        in_str.append(line)
    dobfac(int(in_str[0]))

Submission status: Wrong Answer

Solution code:
N = int(input())
def g(n, m):
  ret = 0
  while(n >= m):
    n = int(n / m)
    ret += n
  return ret

if N % 2 == 0:
  print(g(N / 2, 5))
else:
  print(0)

Submission status: Wrong Answer

Solution code:
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces
gi = lambda : list(map(int,input().split()))
n, = gi()
ans = n // 10
cur = 50
while cur < n:
	ans += n // cur
	cur *= 5
if n % 2:
	ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
def dobfac(num):
    if num < 0:
        return -1;
    count = 0
    i = 5
    while num / i > 0:
        count += num // i // 2
        i *= 5
    return count

if __name__ == "__main__":
    import sys
    in_str = []
    for line in sys.stdin:
        in_str.append(line)
    dobfac(int(in_str[0]))

Submission status: Wrong Answer

Solution code:
n=int(input())
z=1
a=0
f=int(n%2==1)
for i in range(100):
  z*=5
  if n<z:
    break
  t=n//z
  if t%2==0:
    a+=t//2
  else:
    if f:
      a+=(t+1)//2
    else:
      a+=(t-1)//2
print(0 if n==5 else a)

Submission status: Wrong Answer

Solution code:
def findTrailingZeros(n): 
    count = 0
    i=5
    while (n/i>=1): 
        count += int(n/i) 
        i *= 5
    return int(count)
  

n = int(input())
if n % 2 != 0:
    print(0)
else:
    n = n // 2
    print(findTrailingZeros(n))

Submission status: Wrong Answer

Solution code:

def solve():
    n=int(input())
    if n<2:
        return 1
    out=0
    if n%2==0:
        while n>=10:
            n//=5
            out+=n//2
            
        return out
    else:
        return 0
    
    

print(solve())

Submission status: Wrong Answer

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

if n%2 == 1 or n == 0:
  print(0)
else:
  for i in range(35):
    j = 2*pow(5,i+1)
    if j < n:
      fivenum += n//j
  print(fivenum)

Submission status: Wrong Answer

Solution code:
N = int(input())

N -= N%10

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

else:
    res = 0
    res += N // 10
    a = 50
    while a <= N:
        res += N // a
        a *= 5
    print(res)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

N = int(input())

# 奇数のときは0
if N % 2 != 0:
    print(0)
    sys.exit()

print(-1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N=int(input())
if N%2!=0:
    print(0)
else:
    ans=0
    for i in range(1,27):
        ans+=int((N//5**i))
    print(ans//2)

Submission status: Wrong Answer

Solution code:
import sys
import math
import re
import io

def query(n, m):
    ans = 0
    while n > 0:
        ans += n // m
        n //= m
    return ans

def solve(n):
    if n < 2:
        return 0
    if n % 2 == 0:
        return query(n // 2, 5)
    return query(n + 1, 5) - query((n+1)//2, 5)

def main():
    n = int(input())
    ans = solve(n)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2 == 1:
    print(0)
else:
    counter = 0
    for i in range(1, n):
        num = n/pow(10, i)
        if num >= 1:
            counter += n//pow(10, i)
        else:
            break
    print(counter)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

def solve():
    N = int(input())
    if N & 2:
        res = 0
    else:
        q = 10
        p5 = 0
        while N // q:
            p5 += N // q
            q *= 5
        q = 2
        p2 = 0
        while N // q:
            p2 += N // q
            q *= 2
        res = min(p2, p5)
    return str(res)

if __name__ == '__main__':
    print(solve())

Submission status: Wrong Answer

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

if n%2 == 1:
  print(0)
else:
  for i in range(35):
    j = 2*pow(5,i+1)
    if j < n:
      fivenum += n//j
  print(fivenum)

Submission status: Wrong Answer

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

if N % 2 != 0:
    print(0)
    exit()
ans = N // 10
ans += N // 40
print(ans)

Submission status: Wrong Answer

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

k = 0
if N%2 ==0:
  n = N//2
  i = 1
  while n/(5**i) >= 1 :
    k += math.floor(n /(5**i))
    i += 1
print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = n
for i in range(int(n/2)-1):
    n-=2
    ans*=n
if n ==0:
    ans =1
count = 0
ans_count=0
while count<1:
    if ans%10!=0:
        print(ans_count)
        count+=1
    ans/=10
    ans_count+=1

Submission status: Wrong Answer

Solution code:
n = int(input())
five = 0
two = 0

x = 2
while x <= n:
  two += n // x
  x *= 2

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

print(min(two, five))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
f = 1

if n < 2:
  print(0)
if n >= 2:
  for i in range(n, 1, -2):
    f = f*i

f = str(f)   

for i in range(-1, -1*len(f), -1):
  if f[i] == '0':
    count += 1
  else:
    break

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2 == 1:
    print(0)
else:
    counter = 0
    for i in range(1, n):
        num = n/pow(10, i)
        if num > 1:
            counter += n//pow(10, i)
        else:
            break
    print(counter)

Submission status: Wrong Answer

Solution code:
def findTrailingZeros(n):  
    count = 0
    i=5
    while (n/i>=1): 
        count += int(n/i) 
        i *= 5
    return int(count)
n = int(input())
if n%2 or n<10:
	print(0)
else:
	print(findTrailingZeros(n//2))

Submission status: Wrong Answer

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    count=0
    if n%2==1:
        print(0)
    else:
        for i in range(1,30,1):
            count+=int(n/(2*(5**i)))
            #print(i)
        print(count)
if __name__ == '__main__':
    do()

Submission status: Wrong Answer

Solution code:
N=int(input())


if N%2!=0:
  print(0)
else:
  print(N//10)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
li=[1,1,1]
n=int(input())
y=0
for k in range (3,n+1):
    x=k*li[k-2]
    li.append(x)

while li[n]%10==0:
    y=y+1
    li[n]=li[n]/10

print(y)

Submission status: Wrong Answer

Solution code:
import sys
import math
import re
import io

def query(n, m):
    ans = 0
    while n > 0:
        ans += n // m
        n //= m
    return ans

def solve(n):
    if n < 2:
        return 0
    if n % 2 == 1:
        val = 0
        if n % 5 == 0:
            val = 1
        return query(n - 1,  5) + val
    return query(n // 2, 5)

def main():
    n = int(input())
    ans = solve(n)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys; readline = sys.stdin.readline
from collections import deque


N = int(readline())


def count(d, n):
    c = 0
    a = n
    while True:
        a = a // d
        if a == 0:
            break
        c += a
    return c

print(min(count(2,N), count(5, N // 2)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
c = 0
n = 1
while True:
    t = N//(5**n)//2
    if t == 0:
        break
    else:
        c += t
        n += 1
print(c)

Submission status: Wrong Answer

Solution code:
N = int(input())
Ans = 0
if N % 2 == 1:
  print(Ans)
else:
  strN = str(N)
  len = len(strN)
  if len == 1:
    print(Ans)
  else:
    for i in range(len - 1):
      B = strN[:i + 1]
      Ans = Ans + int(B)

    print(Ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
summ=0
count = 0
if(n%2==1): print("0")
else:
    while(n/5>0):
        if(count==0): 
            n=int(n/10)
            count+=1
        else: n=int(n/5)
        #print("n="+str(n))
        summ+=(n)
    print(summ)

Submission status: Wrong Answer

Solution code:
words = lambda t : list(map(t, input().split()))
n = int(input())

xs = []
for i in range(30):
    xs.append((n // (5**i)) // 2)

#print(xs)
print(sum(xs[1:]))

Submission status: Wrong Answer

Solution code:
#coding:utf-8

def cnt_five(n):
    i = 1
    cnt = 0
    while 5 ** i < n:
        cnt += n // (5 ** i)
        i += 1
    return cnt

n = int(input())
if n % 2 != 0:
    print(0)
else:
    n //= 2
    print(cnt_five(n))

Submission status: Wrong Answer

Solution code:
'''

sekai_no_owari
 愛

''' 

n = int(input())
if n%2 != 0:
    print(0)
else:
    c = 0
    k = 1
    while n >= 10:
        if n < 10:
            break
        if n>10:
            c += int(str(n)[0])
            if n % 5 == 0:
                c += 1
        n //= 10
    print(c)

Submission status: Wrong Answer

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

x = N
fives = 0
i = 0
while x:
    if i % 2 == 1:
        i +=1
        continue
    i += 1
    x //= 5
    fives += x
    print(x, fives)
    
print(fives)

Submission status: Wrong Answer

Solution code:
from sys import exit

N = int(input())

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

result = 0
t = 10
while t < N:
  result += N // t
  t *= 5
print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())

s=1
while n > 0:
    s*=n
    n-=2

s=str(s)
print(s)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2 != 0:
    print(0)
else:
    c = 0
    k = 1
    while n >= 2:
        if n%10 == 0:
            c += int(str(n)[0])
            if n % 5 == 0:
                c += 1
        n //= 10
    print(c)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()

	tmp = N // 10

	#tmp2 = goo(N)
	#print(tmp2)
	print(tmp)

def goo(val):
	if val < 2:
		return 1
	else:
		return val * goo(val-2)

if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
def p_e():
    n = int(input())
    li = "0124999999999999995"
    if n & 1 == 1:
        print(0)
        exit()
    ans = 0
    for i, e in enumerate(reversed(list(map(int, str(n))))):
        ans += e * int(li[:i + 1])
    print(ans)
    
p_e()

Submission status: Wrong Answer

Solution code:
N=int(input())

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


N=N//2
retval=0
i=1
while 5**i<=N:
    retval+= N//(5**i)
    i+=1

print(retval)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def fact(x):
    t=x
    for v in range(x-2,1,-2):
        t*=v
    return t

N=int(input())
r=str(fact(N))
counter=0
for it in r[::-1]:
    if it != '0':
        break
    counter+=1
print(counter)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    i = 1
    f2 = 0
    while (2 ** i) <= N:
        f2 += (N // (2 ** i))
        i += 1
    i = 1
    f5 = 0
    while (5 ** i) * 2 <= N:
        f5 += (N // ((5 ** i) * 2))
        i += 1
    print(min(f2, f5))


        



main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#import numpy as np
def cin():
    return map(int, input().split())


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

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

div = 1
n //= 2

for i in range(33):
    div *= 5
    cnt += n // div

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
N = int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    N //= 2
    while N >= 5:
        ans += N//5
        N = N //5
print(ans)

Submission status: Wrong Answer

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict
from fractions import gcd
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	if N == 0:
		print(1)
		return
	if N % 2 == 0:
		D = defaultdict(int)
		n = int(N // 2)
		D[2] += n
		for i in range(1, 42):
			D[2] += int(n // (2 ** i))
		for i in range(1, 42):
			D[5] += int(n // (5 ** i))
		print(min(D[2], D[5]))

	else:
		D = defaultdict(int)
		for i in range(1, 42):
			D[2] += int(N // (2 ** i))
		for i in range(1, 42):
			D[5] += int(N // (5 ** i))
		n = int(N // 2)
		D[2] -= n
		for i in range(1, 42):
			D[2] -= int(n // (2 ** i))
		for i in range(1, 42):
			D[5] -= int(n // (5 ** i))
		print(min(D[2], D[5]))

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 2 == 1:
    out = 0
else:
    n2 = n // 2
    tmp5 = 5
    out = 0
    while tmp5 < n2:
        out += (n2 // tmp5)
        tmp5 *= 5

print(out)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
N = int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    N //= 2
    while N > 5:
        ans += N//5
        N = N //5
print(ans)

Submission status: Wrong Answer

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict
from fractions import gcd
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	if N % 2 == 0:
		D = defaultdict(int)
		n = int(N // 2)
		D[2] += n
		for i in range(1, 42):
			D[2] += int(n // (2 ** i))
		for i in range(1, 42):
			D[5] += int(n // (5 ** i))
		print(min(D[2], D[5]))

	else:
		D = defaultdict(int)
		for i in range(1, 42):
			D[2] += int(N // (2 ** i))
		for i in range(1, 42):
			D[5] += int(N // (5 ** i))
		n = int(N // 2)
		D[2] -= n
		for i in range(1, 42):
			D[2] -= int(n // (2 ** i))
		for i in range(1, 42):
			D[5] -= int(n // (5 ** i))
		print(min(D[2], D[5]))

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
n=int(input())
n=(n+1)//2
ans=0
f=5
while f<=n:
	ans+=n//f
	f*=5
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    if N % 2 == 1:
        return 0

    n = N // 2
    i = 5
    c = 0
    ans = 0
    while i < n:
        c += 1
        ans += n // i
        i *= 5
    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

if n % 2 != 0:
    ans = -1
else:
    ans = 0
    s = 10
    stop = 0
    while(not stop):
        if s > n:
            stop = 1
        else:
            ans += n // s
            s *= 5
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
n//=2
ans=0
f=5
while f<=n:
	ans+=n//f
	f*=5
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    if N % 2 == 1:
        return 1

    n = N // 2
    i = 5
    c = 0
    ans = 0
    while i < n:
        c += 1
        ans += n // i
        i *= 5
    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

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

def bitlist(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

#a = list(map(int, input().split()))


n = int(input())//2
flag2 = n%2

num2=0
num5=0
ans2=1
ans5=1

while(True):
    if(ans2 > n):
       break
    num2 += 1
    ans2 *= 2
    
while(True):
    if(ans5 > n):
       break
    num5 += 1
    ans5 *= 5   

have2 = 0
have5 = 0
#print(num2,num5)
now2 = num2
for i in range(num2):
    times = n // int(2**now2)
    have2 += times
    now2 -=1
    #print("t",times)

now5 = num5
for i in range(num5):
    times = n // int(5**now5)
    have5 += times
    now5 -=1
    
#print(have2+n,have5)

if(flag2==0):
    print(min(have2+n,have5))
elif(n==0):
    print(1)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n % 2 == 1:
  print(0)
else:
  ans = 0
  for p in range(1, 19):
    t = 10**p
    ans += n//t
  print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n%2!=0:
    print(0)
else:
    a=0
    n=n//2
    import math
    for i in range(1,40):
        a+=math.floor(n/(5**i))
    print(a)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
N = int(input())

ret = 0
x = 5
for _ in range(1, 40) :
  ret += N // (x * 2)
  x *= 5
  
print(ret)

Submission status: Wrong Answer

Solution code:
import math

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

def bitlist(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

#a = list(map(int, input().split()))


n = int(input())//2
flag2 = n%2

num2=0
num5=0
ans2=1
ans5=1

while(True):
    if(ans2 > n):
       break
    num2 += 1
    ans2 *= 2
    
while(True):
    if(ans5 > n):
       break
    num5 += 1
    ans5 *= 5   

have2 = 0
have5 = 0
#print(num2,num5)
now2 = num2
for i in range(num2):
    times = n // int(2**now2)
    have2 += times
    now2 -=1
    #print("t",times)

now5 = num5
for i in range(num5):
    times = n // int(5**now5)
    have5 += times
    now5 -=1
    
#print(have2+n,have5)

if(flag2==0):
    print(min(have2+n,have5))
else:
    print(0)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	n = int(input())
	i = 10
	ans = 0
	while i <= n:
		ans += n//i
		i*=5
	print(ans)

def factorization(n):
	if n<2:
		return []
	arr = []
	temp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp //= i
			arr.append([i, cnt])

	if temp!=1:
		arr.append([temp, 1])

	if arr==[]:
		arr.append([n, 1])

	return arr

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(numbers):
	return reduce(fractions.gcd, numbers)

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

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

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()

Submission status: Wrong Answer

Solution code:
n = int(input())
if n % 2 == 0:
  print(n//10)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n%2==1:
    print(0)
else:
    f=0
    i=1
    while i<20:
        f+=n//(10**i)
        i+=1
    print(f)

Submission status: Time Limit Exceeded

Solution code:
from math import factorial

f = factorial

n = int(input())

if n % 2 == 0:
	if n == 2:
		ans = 2
	else:
		ans = (2 ** (n//2)) * f(n//2)
		
else:
	if n == 1:
		ans = 1
	else:
		ans = f(n) // (f(n//2) * (2 ** (n//2)))
		#print('a', f(n))
		#print('b', f(n//2)*(2**(n//2)))

cnt = 0
ans = str(ans)

for i in reversed(ans):
	if i == '0':
	  cnt += 1
	else:
		break
		
print(cnt)
#print(ans)

Submission status: Time Limit Exceeded

Solution code:
i = int(input())
if i % 2 != 0:
  print(0)
else:
  count = 0
  for j in range(1, i//2 + 1):
    if j % 5 == 0:
      count += 1
  print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
counter = 1

while True:
  if n in [0, 1]:
    break
  counter *= n
  n -= 2

count10 = 0
while True:
  if counter % 10 == 0:
    count10 += 1
    counter = counter // 10
  else:
    break
print(count10)

Submission status: Time Limit Exceeded

Solution code:
import math
a = int(input())
b = a / 2
d = 0
c = 1
b = math.ceil(b)
for i in range(b):
    c = c * a
    a = a - 2
c = str(c)
for e in range(len(c)):
    if c[e] == "0":
        d = d + 1
    else:
        d = 0
print(d)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    def prime_factorize1(N):
        """
        Nをくって、Nの素因数を格納したリストresを返す。
        リストの要素をすべて掛ければNになる"""
        res = []
        x = N
        y = 2
        while y*y <= x:
            while x % y == 0:
                res.append(y)
                x //= y
            y += 1
        if x > 1:
            res.append(x)
        return res
    if n%2==1:
        print(0)
    elif n<10:
        print(0)
    else:
        ans=0
        for i in range(1,n//10+1):
            x=i*10
            from collections import Counter
            c=Counter(prime_factorize1(x))# ()にカウンターの対象のリストの変数名
            ans+=c[5]
        print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
num = n//2

count = 0
if n == 5:
    print(0)
else:
    for i in range(num):
        if (n-2*i) % 5 == 0:
            count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
def f(n,x):
  ret = 0
  while n>0:
    n = (n+x-1)//x
    ret+=n
  return ret

n = int(input())
print(min(f(n,2), f(n,5)))