Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n=int(input())
s=input()
A=[]
for i in range(n):
  A.append(s[i])
ans=float('inf')
for i in range(n+1):
  w=A[:i].count('W')
  r=A[i:].count('R')
  ans=min(max(w,r),ans)

print(ans)   

### FIXED CODE ###

n=int(input())
s=input()
A=[]
for i in range(n):
  A.append(s[i])
W=0
R=A.count('R')
ans=float('inf')
for i in range(n+1):
  if i!=0:
    if A[i-1]=='W':
      W+=1
    else:
      R-=1
  ans=min(max(W,R),ans)
print(ans)
### BUGGY CODE ###

a, b, x = [int(x) for x in input().split()]
ans = 0
while True:
    if a > b:
        break
    else:
        if a % x ==0:
            ans += 1
            a += 1
print(ans)

### FIXED CODE ###

a, b, x = [int(x) for x in input().split()]
print((b//x)-((a-1)//x))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)


### FIXED CODE ###

H,W = map(int,input().split())
S = [list(input()) for i in range(H)]

G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)
s = input()
ans = False
def dfs(now, length):
  global ans
  if len(now) >= length:
    if now == s:
      ans = True
    return
  
  dfs(now + 'dream', length)
  dfs(now + 'dreamer', length)
  dfs(now + 'erase', length)
  dfs(now + 'eraser', length)

dfs('', len(s))

if ans:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

s = input()[::-1]
l = ["dream", "dreamer", "erase", "eraser"]
start = 0

for i in range(len(l)):
  l[i] = l[i][::-1]
  
def f():
  i = 0
  j = 0
  while j <= len(s):
    can = False
    for d in l:
      if s[i:i+len(d)] == d:
        i += len(d)
        can = True

    if i == len(s) and can == True:
      return 'YES'

    if can == False:
      return 'NO'
    j += 1

  return 'YES'

print(f())
### BUGGY CODE ###

import bisect
n, m = map(int, input().split())
a = sorted([int(i) for i in input().split()])

for i in range(m):
    tmp = a.pop() // 2
    idx = bisect.bisect_left(a, tmp)
    a.insert(idx, tmp)

print(sum(a))

### FIXED CODE ###

import heapq

n, m = map(int, input().split())
a = [int(i) * (-1) for i in input().split()]
heapq.heapify(a)

for i in range(m):
    tmp = (heapq.heappop(a) * (-1)) // 2
    heapq.heappush(a, tmp * (-1))

print(sum(a) * (-1))
### BUGGY CODE ###

import heapq
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
a = [(-aa, 1) for aa in a]
heapq.heapify(a)

for _ in range(k):
    aa, n = heapq.heappop(a)
    heapq.heappush(a, (aa*n/(n+1), n+1))

ans, _ = heapq.heappop(a)
print(math.ceil(-ans))


### FIXED CODE ###

import heapq
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
if k == 0:
    print(a[0])
    exit(0)
mean_a = sum(a) / k
q = []
for aa in a:
    d = max(math.floor(aa / mean_a), 1)
    q.append((-aa/d, d))
    k -= (d-1)
heapq.heapify(q)

for _ in range(k):
    aa, n = heapq.heappop(q)
    heapq.heappush(q, (aa*n/(n+1), n+1))

ans, _ = heapq.heappop(q)
print(math.ceil(-ans))
### BUGGY CODE ###

import sys
MX = 10**5
def main():
    data = map(int, sys.stdin.buffer.read().split())
    N = next(data)
    items = [(next(data), next(data)) for _ in range(N)]
    Q = next(data)

    H = min(N + 1, 1 << 9)
    Hb = (H - 1).bit_length()
    dp = [[0] * (MX + 1) for _ in range(H)]
    for i in range(1, H):
        v, w = items[i - 1]
        dpi = dp[i]
        dpip = dp[i >> 1]
        for j in range(MX + 1):
            t = dpip[j]
            if j >= w:
                t = max(t, dpip[j - w] + v)
            dpi[j] = t
    for v, L in zip(data, data):
        if v < H:
            print(dp[v][L])
            continue
        ans = 0
        for i in range(1 << (v.bit_length() - Hb)):
            node = v
            value = weight = 0
            while node >= H:
                if i & 1:
                    iv, iw = items[node - 1]
                    value += iv
                    weight += iw
                node >>= 1
                i >>= 1
            if weight > L:
                continue
            ans = max(ans, value + dp[node][L - weight])
        print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
MX = 10**5
def main():
    data = map(int, sys.stdin.buffer.read().split())
    N = next(data)

    H = min(N + 1, 1 << 10)
    dp = [None] * H
    dp[0] = [0] * (MX + 1)
    IV, IW = [], []
    i = 1
    for v, w in zip(data, data):
        if i < H:
            dpi = dp[i >> 1][:]
            dp[i] = dpi
            for j in range(MX, w - 1, -1):
                dpi[j] = max(dpi[j], dpi[j - w] + v)
        else:
            IV.append(v)
            IW.append(w)
        i += 1
        if i > N:
            break

    Q = next(data)
    for v, L in zip(data, data):
        if v < H:
            print(dp[v][L])
            continue

        item_values = []
        item_weights = []
        while v >= H:
            item_values.append(IV[v - H])
            item_weights.append(IW[v - H])
            v >>= 1

        l = len(item_values)
        V = [0] * (1 << l)
        W = [0] * (1 << l)
        ans = dp[v][L]
        for i in range(1, 1 << l):
            msb = i & (-i)
            msbb = msb.bit_length() - 1
            wi = W[i - msb] + item_weights[msbb]
            W[i] = wi
            if wi <= L:
                vi = V[i - msb] + item_values[msbb]
                ans = max(ans, vi + dp[v][L - wi])
                V[i] = vi
        print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
from functools import reduce
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()


mod = 10**9+7


def prime(x):
    pf = defaultdict(int)
    for i in range(2, int(x**0.5)+1):
        while x % i == 0:
            pf[i] += 1
            x //= i
    if x > 1:
        pf[x] = 1
    return pf


def lcm(x, y):
    xx=x.copy()
    yy=y.copy()
    for k, v in yy.items():
        xx[k] = max(xx[k], yy[k])
    return xx


def flat(x, y):
    xx=x.copy()
    yy=y.copy()
    for k, v in yy.items():
        xx[k] -= yy[k]
    ans = 1
    for k, v in xx.items():
        ans = (ans*(k**v)) % mod
    return ans


def main():
    n = int(input())
    a = list(map(int, input().split()))
    a = list(map(prime, a))
    lcms = reduce(lcm, a)
    ans = 0
    for aa in a:
        ans += flat(lcms,aa)
    print(ans % mod)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from functools import reduce
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()


mod = 10**9+7


def prime(x):
    pf = defaultdict(int)
    for i in range(2, int(x**0.5)+1):
        while x % i == 0:
            pf[i] += 1
            x //= i
    if x > 1:
        pf[x] = 1
    return pf


def lcm(x, y):
    xx=x.copy()
    yy=y.copy()
    for k, v in yy.items():
        xx[k] = max(xx[k], v)
    return xx


def main():
    n = int(input())
    a = list(map(int, input().split()))
    a2 = list(map(prime, a))
    lcms = reduce(lcm, a2)
    lcmss = 1
    for k, v in lcms.items():
        lcmss = (lcmss*(k**v)) % mod
    ans = 0
    for aa in a:
        ans += lcmss*pow(aa,-1,mod)
    print(ans % mod)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

class Dict(object):

    m1 = 2 ** 20 - 1
    m2 = m1 - 1

    def __init__(self):
        self._dict = ["" for _ in range(self.m1)]

    def insert(self, k):
        i = 0

        while True:
            ix = self._h(k, i)
            if self._dict[ix] == "":
                self._dict[ix] = k
                return
            else:
                i += 1

    def find(self, k):
        i = 0

        while True:
            ix = self._h(k, i)
            if self._dict[ix] == k:
                return ix
            elif self._dict[ix] == "":
                return -1
            else:
                i += 1

    def _h(self, k, i):
        return (self._h1(k) + i * self._h2(k)) % self.m1

    def _h1(self, k):
        return k % self.m1

    def _h2(self, k):
        return k % self.m2 + 1


def to_int(s):
    _s = s[::]

    ret = 0
    i = 1
    for e in _s:
        if e == 'A':
            ret += 1 * i
        elif e == 'C':
            ret += 2 * i
        elif e == 'G':
            ret += 3 * i
        elif e == 'T':
            ret += 4 * i
        i *= 4

    return ret


if __name__ == '__main__':
    n = int(input())

    d = Dict()

    for _ in range(n):
        cmd, val = input().split()

        if cmd == "insert":
            d.insert(to_int(val))
        else:
            ans = "yes" if d.find(to_int(val)) != -1 else "no"
            print(ans)

### FIXED CODE ###

M = 1046527
L = 14
H = [""] * M
 
def getChar(ch):
    if ch == 'A':
        return 1
    elif ch == 'C':
        return 2
    elif ch == 'G':
        return 3
    elif ch == 'T':
        return 4
    else:
        return 0
 
def getKey(strings):
    Sum = 0
    p = 1
    for i in xrange(len(strings)):
        Sum += p * getChar(strings[i])
        p *= 5
 
    return Sum
 
def h1(key):
    return key % M
 
def h2(key):
    return 1 + (key % (M-1))
 
def find(strings):
    key = getKey(strings)
    i = 0
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == strings:
            return 1
        elif len(H[h]) == 0:
            return 0
        else:
            i += 1
    return 0
 
def insert(strings):
    key = getKey(strings)
    i = 0
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == strings:
            return 1
        elif len(H[h]) == 0:
            H[h] = strings
            return 0
        else:
            i += 1
    return 0
 
def main():
    n = input()
    for i in xrange(n):
        com = raw_input().split()
        if com[0][0] == 'i':
            insert(com[1])
        else:
            if find(com[1]):
                print 'yes'
            else:
                print 'no'
    return 0
 
main()
### BUGGY CODE ###

s=input()
ans=0
while "ABC" in s:
  s.replace("ABC","BCA",1)
  ans+=1
print(ans)

### FIXED CODE ###

s=input()
t=""
i=0
while i<len(s):
    if s[i:i+2]=="BC":
        t+="T"
        i+=2
    else:
        t+=s[i]
        i+=1
ans=0
Acnt=0
for i in t:
    if i=="A":
        Acnt+=1
    elif i=="T":
        ans+=Acnt
    else:
        Acnt=0
print(ans)
### BUGGY CODE ###


MOD=10**9+7
s=input()
s.rstrip()
s=s[::-1]
dp=[[0]*13 for _ in range(len(s)+1)]
dp[0][0]=1

coef=1
for i in range(len(s)):
    if s[i]=='?':
        for j in range(13):
            for k in range(10):
                ind=(j+coef*k)%13
                temp=dp[i+1][ind]+dp[i][j]
                dp[i+1][ind] = temp-MOD if temp>=MOD else temp
    else:
        si=int(s[i])
        for j in range(13):
            ind=(j+coef*si)%13
            temp=dp[i+1][ind]+dp[i][j]
            dp[i+1][ind] = temp-MOD if temp>=MOD else temp
    coef=coef*10%13


print(dp[len(s)][5])

### FIXED CODE ###


MOD=10**9+7
s=input()
s.rstrip()
s=s[::-1]
dp=[[0]*13 for _ in range(len(s)+1)]
dp[0][0]=1

coef=1
for i in range(len(s)):
    if s[i]=='?':
        for j in range(13):
            for k in range(10):
                ind=(j+coef*k)%13
                temp=dp[i+1][ind]+dp[i][j]
                dp[i+1][ind] = temp-MOD if temp>=MOD else temp
    else:
        si=int(s[i])
        for j in range(13):
            ind=(j+coef*si)%13
            temp=dp[i+1][ind]+dp[i][j]
            dp[i+1][ind] = temp-MOD if temp>=MOD else temp
    coef=coef*10%13


print(dp[len(s)][5])
### BUGGY CODE ###

n = int(input())
d = dict()
l = []
for i in range(n):
  x,y = map(int, input().split())
  d[(x,y)] = i
  l.append((x,y))
road = [dict() for _ in range(n)]
l.sort()
for i in range(n-1):
  road[d[l[i]]][d[l[i+1]]] = l[i+1][0]-l[i][0]
  road[d[l[i+1]]][d[l[i]]] = l[i+1][0]-l[i][0]
l.sort(key=lambda x:x[1])
for i in range(n-1):
  if d[l[i+1]] in road[d[l[i]]]:
    road[d[l[i]]][d[l[i+1]]] = min(l[i+1][1]-l[i][1],road[d[l[i]]][d[l[i+1]]])
    road[d[l[i+1]]][d[l[i]]] = min(l[i+1][1]-l[i][1],road[d[l[i+1]]][d[l[i]]])
  else:
    road[d[l[i]]][d[l[i+1]]] = l[i+1][1]-l[i][1]
    road[d[l[i+1]]][d[l[i]]] = l[i+1][1]-l[i][1]

def prim(n, cost):
    mincost = [float("inf")]*n
    used = [False] * n
    mincost[0] = 0
    res = 0

    while True:
        v = -1
        for i in range(n):
            if (not used[i]) and (v == -1 or mincost[i] < mincost[v]):
                v = i
        if v == -1:
            break
        used[v] = True
        res += mincost[v]
        for i in cost[v]:
            mincost[i] = min(mincost[i],cost[v][i])
    return res

print(prim(n, road))


### FIXED CODE ###

def find(u,x):
    if u[x]<0:
        return x
    u[x] = find(u,u[x])
    return u[x]

def unite(u,a,b):
    a = find(u,a)
    b = find(u,b)
    if a == b:
        return False
    if u[b] < u[a]:
        a,b = b,a
    u[a] += u[b]
    u[b] = a
    return True

def same(u,x,y):
    return find(u,x) == find(u,y)

n = int(input())
l = list()
for i in range(n):
  x,y = map(int,input().split())
  l.append((x,y,i))
l.sort()
uf = [-1]*(n+1)
ed = list()
for i in range(n-1):
  ed.append((l[i][2],l[i+1][2],l[i+1][0]-l[i][0]))
l.sort(key=lambda x:x[1])
for i in range(n-1):
  ed.append((l[i][2],l[i+1][2],l[i+1][1]-l[i][1]))
ed.sort(key=lambda x:x[2])
ans = 0
for x,y,d in ed:
  if not same(uf,x,y):
    unite(uf,x,y)
    ans += d
print(ans)
### BUGGY CODE ###

n,m = map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)

for i in range(m):
    a[0]=a[0]//2
    a.sort(reverse=True)

print(sum(a))

### FIXED CODE ###

import heapq
 
N,M = map(int, input().split())
A = list(-int(i) for i in input().split()) 

heapq.heapify(A)

for i in range(M):
    x=heapq.heappop(A)//(-2)
    heapq.heappush(A, -x)
 
print(-sum(A))
### BUGGY CODE ###

n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
for i in a:
    ans *= i
    if (ans > pow(10,18)):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)




### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]
ans = 1
flag = False
zeros = False
over = pow(10,18)
for i in a:
    if flag == False:
        ans *= i
    if (ans > over):
        flag = True
    if i == 0:
        zeros = True

if (flag):
    ans = -1
if (zeros):
    ans = 0

print(ans)
### BUGGY CODE ###

N = int(raw_input())
S = str(raw_input())
opt_cnt = N
for i in range(N):
    first = S[:i]
    second = S[i+1:]
    cnt = 0
    for f in first:
        if f is not 'E':
            cnt = cnt + 1
    for s in second:
        if s is not 'W':
            cnt = cnt + 1
    if opt_cnt > cnt:
        opt_cnt = cnt
print(opt_cnt)


### FIXED CODE ###

def opt(N, S):
    if N == 1:
        return 0
    else:
        split = int(N/2)
        return min(opt(split,S[:split])+S[split:].count('E'),S[:split].count('W')+opt(N - split,S[split:]))

Num = int(raw_input())
Str = str(raw_input())
print(opt(Num, Str))
### BUGGY CODE ###

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

def list_set(a,y):
    B = list(a)
    B.pop(y)
    B.insert(0, 0)
    return B
 
 
for y in range(N):
    a = list_set(A,y)
    price = 0
    
    for x in range(len(a)-1):
        price += abs(a[x+1] - a[x])
    price += abs(a[-1])
    print(price)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
A.insert(0,0)
A.append(0)
price = 0
for x in range(n+1):
    price += abs(A[x+1]-A[x])
for x in range(1, n+1):
    s = price
    s = s + abs(A[x-1]-A[x+1]) - (abs(A[x-1]-A[x])+abs(A[x]-A[x+1]))
    print(s)
### BUGGY CODE ###

N,K = list(map(int,input().split()))
print(N)
print(K)
per = 0
def f(x,y):
    while x < y:
        x = 2*x
    return x

for i in range(N):
    a = int(f(i,K))
    per += (1/N)((1/2)**a)
print(per)

### FIXED CODE ###

N,K = list(map(int,input().split()))
per = 0

def f(x,y):
    count = 0
    while (x < y):
        x = 2*x
        count += 1
    return count

for i in range(N):
    b = int(f(i+1,K))
    per += (1/N)*((1/2)**b)
print(per)
### BUGGY CODE ###

from collections import deque
H, W = [int(x) for x in input().split()]
masu = [input() for i in range(H)]
move = [[0, 1], [0, -1], [1, 0], [-1, 0]]
d = [[-1] * W for i in range(H)]

def bfs():
    q = deque()
    for x in range(H):
        for y in range(W):
            if masu[x][y] == '#':
                q.append([x, y])
                d[x][y] = 0
    while q:
        x, y = q.popleft()
        for v in move:
            nx = x + v[0]
            ny = y + v[1]
            if 0 <= nx < H and 0 <= ny < W and masu[nx][ny] == '.' and d[nx][ny] == -1:
                q.append([nx, ny])
                d[nx][ny] = d[x][y] + 1
    max = -1
    for x in range(H):
        for y in range(W):
            if d[x][y] > max:
                max = d[x][y]
    return max

print(bfs())


### FIXED CODE ###

from collections import deque
H, W = [int(x) for x in input().split()]
masu = [input() for i in range(H)]
move = [[0, 1], [0, -1], [1, 0], [-1, 0]]
d = [[-1] * W for i in range(H)]

def bfs():
    q = deque()
    for x in range(H):
        for y in range(W):
            if masu[x][y] == '#':
                q.append([x, y])
                d[x][y] = 0
    while q:
        x, y = q.popleft()
        for v in move:
            nx = x + v[0]
            ny = y + v[1]
            if 0 <= nx < H and 0 <= ny < W and d[nx][ny] == -1:
                q.append([nx, ny])
                d[nx][ny] = d[x][y] + 1
    ans = -1
    for x in range(H):
        for y in range(W):
            ans = max(ans, d[x][y])
    return ans

print(bfs())
### BUGGY CODE ###

N = int(input())

A = list(map(int, input().split()))

A_sum = 0

for i in range(N):
    A_sum += A[i]

min = A_sum

for i in range(N):
    AA_sum = 0
    for j in range(i):
        AA_sum += A[j]
    AA_sa = 2*AA_sum - A_sum
    if AA_sa < 0:
        AA_sa = -1 * AA_sa
    if AA_sa < min:
        min = AA_sa
print(min)

### FIXED CODE ###

N = int(input())

A = list(map(int, input().split()))

Asum = 0
A_sum = []

for i in range(N):
    Asum += A[i]
    A_sum.append(Asum)

for i in range(N):
    A_sum[i] = 2*A_sum[i] - Asum
    if A_sum[i] < 0:
        A_sum[i] = -1 * A_sum[i]

print(min(A_sum))
### BUGGY CODE ###

from collections import deque
N = int(input())
T = []
for k in range(N-1):
    t = list(map(int,input().split()))
    T.append(t)

T = deque(T)
A = [-1 for k in range(N)]
A[0] = 0

while len(T) > 0:
    t = T.popleft()
    u = t[0]-1
    v = t[1]-1
    w = t[2]
    if w%2 == 0:
        if A[u] == 0 and A[v] == -1:
            A[v] = 0
        elif A[u] == 1 and A[v] == -1:
            A[v] = 1
        elif A[u] == -1 and A[v] == 0:
            A[u] = 0
        elif A[u] == -1 and A[v] == 1:
            A[u] = 1
        elif A[u] == -1 and A[v] == -1:
            T.append([u+1,v+1,w])
    else:
        if A[u] == 0 and A[v] == -1:
            A[v] = 1
        elif A[u] == 1 and A[v] == -1:
            A[v] = 0
        elif A[u] == -1 and A[v] == 0:
            A[u] = 1
        elif A[u] == -1 and A[v] == 1:
            A[u] = 0
        elif A[u] == -1 and A[v] == -1:
            T.append([u+1,v+1,w])

print(*A, sep="\n")

### FIXED CODE ###

N = int(input())
T = [[] for k in range(N)]
for k in range(N-1):
    u,v,w = map(int,input().split())
    T[u-1].append([v-1,w])
    T[v-1].append([u-1,w])

kyori = [-1 for k in range(N)]
kyori[T[0][0][0]] = 0
que = [T[0][0][0]]

while len(que) > 0:
    now = que.pop()
    for tsugi in T[now]:
        if kyori[tsugi[0]] == -1:
            kyori[tsugi[0]] = kyori[now] + tsugi[1]
            que.append(tsugi[0])

for a in kyori:
    print(a%2)
### BUGGY CODE ###

n, k = map(int, input().split())

ans = 0

for a in range(k, n + 1, k):
    for b in range(k, n + 1, k):
        for c in range(k, n + 1, k):
            ans += 1

if k % 2 == 0:
    for a in range(int(k / 2), n + 1, k):
        for b in range(int(k / 2), n + 1, k):
            for c in range(int(k / 2), n + 1, k):
                ans += 1

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())

ans = 0
t = 0

for i in range(k, n + 1, k):
    ans += 1

ans **= 3

if k % 2 == 0:
    for j in range(int(k / 2), n + 1, k):
        t += 1
    
    ans += t ** 3

print(ans)
### BUGGY CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    H, N = map(int, readline().split())
    ab = map(int, read().split())
    AB = zip(ab, ab)
    
    dp = [float("inf")] * (H+1)
    dp[0] = 0

    for a, b in AB:
        for j in range(H+1):
            if j + a <= H:
                dp[j+a] = min(dp[j+a], dp[j]+b)
            else:
                dp[H] = min(dp[H], dp[j]+b)

    print(dp[H])


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    H,N = map(int, input().split())
    A = [None]*N
    B = [None]*N
    for i in range(N):
        A[i], B[i] = map(int, input().split())
    
    dp = [float("inf")] * (H+1)
    dp[0] = 0

    for i in range(N):
        for j in range(H+1):
            if j + A[i] <= H:
                dp[j+A[i]] = min(dp[j+A[i]], dp[j]+B[i])
            else:
                dp[H] = min(dp[H], dp[j]+B[i])

    print(dp[H])


if __name__ == "__main__":
    main()
### BUGGY CODE ###


n = int(input())


def factorial_cor(n):
    fact = 1
    for integer in range(1, n + 1, 2):
        fact *= integer
    return fact

def factorization(n):
    arr = []
    temp = n
    count = 0
    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
            if i == 5:
                count += 1
    return count

print(factorization(factorial_cor(n)))

### FIXED CODE ###

n = int(input())

def g1(n, p):
    if n == 0:
        return 0
    return n//p + g1(n//p, p)

def g2(n, p):
    if n%2 == 1:
        return g1(n,p) - g2(n-1, p)
    res = g1(n//2, p)
    if p == 2:
        res += n//2
    return res
        
ans = min(g2(n,2), g2(n,5))
print(ans)