CodeEff/ECCO huggingface dataset:
# Original solution
n,m = list(map(int, input().split() ))
c = []


for i in range(1,m+1) :

    if m//i in c :
      break

    else :
      if m%i==0 :
         c.append(i)
         c.append(m//i)

c.sort()
c.reverse()

for j in range(len(c)) :

   if c[j] <= m//n :
      print((c[j]))
      break

# Optimized solution
n,m = list(map(int, input().split() ))
c = []


for i in range(1,int(m**0.5)+1) :

   if m%i==0 :
      c.append(i)
      c.append(m//i)

c.sort()
c.reverse()

for j in range(len(c)) :

   if c[j] <= m//n :
      print((c[j]))
      break
# Original solution
N,M=list(map(int,input().split()))
if N==1:
    print(M)
    exit()

for i in range(N,M+1):
    if M%i==0:
        print((M//i))
        exit()

# Optimized solution
N,M=list(map(int,input().split()))
if N==1:
    print(M)
    exit()

if N>=M**0.5:
    for i in range(M//N,0,-1):
        if M%i==0:
            print(i)
            exit()
else:
    for i in range(N,M+1):
        if M%i==0:
            print((M//i))
            exit()
print((1))
# Original solution
# AGC112 D - Partition
from math import floor
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


n,m=list(map(int,input().split()))

n_max=floor(m/n)
div_m=divisor(m)
div_m.sort(reverse=True)
ans=0
for i in div_m:
    if i<=n_max:
        print(i)
        exit()


# Optimized solution
def create_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(reverse=True)
  return divisors

from math import floor
n,m=list(map(int,input().split()))
n_max=floor(m/n)
d=create_divisors(m)
for di in d:
  if di<=n_max:
    print(di)
    exit(0)
# Original solution
n, m = list(map(int, input().split()))

ans = 0
for i in range(1, m//n+1):
    if m % i == 0:
        ans = max(ans, i)
        if m // i > i and m // i <= m // n:
            ans = max(ans, m // i)
            break
            
print(ans)

# Optimized solution
N, M = list(map(int, input().split()))

if M % N == 0:
    ans = M // N
else:
    for i in range(1, M // N + 1):
        if M % i == 0:
            ans = i
            if M // i > i and M // i <= M // N:
                ans = M // i
                break
        
print(ans)
# Original solution
import math as m
N,M = list(map(int,input().split()))
divisor = []
for i in range(1,m.floor(pow(M,1/2)) + 1):
  if M % i == 0:
    divisor.append(i)
    divisor.append(M // i)
ans = 1
for e in divisor:
  if e > ans and e <= M // N:
    ans = e
print(ans)

# Optimized solution
# N, D, K = map(int,input().split())
# LR = [list(map(int,input().split())) for _ in range(D)]
# ST = [list(map(int,input().split())) for _ in range(K)]

from math import floor
# 約数全列挙(ソート済み)
# n = 24 -> [1,2,3,4,6,8,12,24]
def divisor(n):
    left = [1]
    right = [n]
    sup = floor(pow(n,1/2))
    for p in range(2,sup+1):
        if n % p == 0:
            if p == n//p:
                left.append(p)
                continue
            left.append(p)
            right.append(n//p)
    res = left + right[::-1]
    return res

N, M = list(map(int,input().split()))
cand = divisor(M)
ans = 1
for ch in cand:
    if M // ch >= N:
        ans = max(ans, ch)

print(ans)
# Original solution
N, M = list(map(int, input().split()))
S = 1
p = 0
for i in range(2, int(M ** (1/2)) + 1):
  if M % i == 0:
    p = 1
if p != 0:
  for i in range(1, M // N + 1):
    if M % i == 0:
      S = i
print(S)

# Optimized solution
N, M = list(map(int, input().split()))
S = 1
p = 0
X = []
for i in range(2, int(M ** (1/2)) + 1):
  if M % i == 0:
    if i <= M // N:
      p = i
      X.append(i)
    else:
      break
if M // N <= int(M ** (1/2)):
  if p != 0:
    S = p
else:
  if p != 0:
    S = M
    q = 0
    while S > M // N:
      S = M // X[q]
      if S <= M // N:
        break
      q += 1
      if q == len(X):
        break
    if q == len(X):
      S = max(X)
print(S)
# Original solution
from sys import stdin
n,m = list(map(int,stdin.readline().rstrip().split()))
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
li = make_divisors(m)
point = 1
if n == 1:
    print(m)
    exit()
for i in range(1,len(li)):
    if m//li[i] < n:
        point = li[i-1]
        break
print(point)

# Optimized solution
from sys import stdin
n,m = list(map(int,stdin.readline().rstrip().split()))
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
li = make_divisors(m)
point = m
for i in range(1,len(li)):
    if m//li[i] < n:
        point = li[i-1]
        break
print(point)
# Original solution
n, m = list(map(int, input().split()))
for i in range(m // n + 1)[::-1]:
  if m % i == 0:
    print(i)
    break

# Optimized solution
def f():
  n, m = list(map(int, input().split()))
  for i in range(m//n+1)[::-1]:
    if m%i==0:return i
print((f()))
# Original solution
from functools import reduce as R
print((R(lambda x, y: x*y, list(range(1, int(eval(input()))+1)))))

# Optimized solution
import math
print((math.factorial(int(eval(input())))))
# Original solution
def main():
    n = int(eval(input()))
    for x in range(1, n):
        n *= x
    print(n)


if __name__ == "__main__":
    main()

# Optimized solution
n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
    ans *= i
print(ans)
# Original solution
#!/usr/bin/env python3
import sys

def solve(N: int):
    n = list(map(int,list(str(N))))
    kuriage = 0
    LEN = len(n)
    pay_count = 0
    pay_count = 0

    for i in range(LEN-1,-1,-1):
        if i != 0:
            if n[i-1] >= 5:
                if n[i]+kuriage <= 4:
                    pay_count += n[i]+kuriage
                    kuriage = 0
                else:
                    pay_count += 10-(n[i]+kuriage)
                    kuriage = 1
            else:
                if n[i]+kuriage <= 5:
                    pay_count += n[i]+kuriage
                    kuriage = 0
                else:
                    pay_count += 10-(n[i]+kuriage)
                    kuriage = 1
        else:
            if n[i]+kuriage <= 5:
                pay_count += n[i]+kuriage
                kuriage = 0
            else:
                pay_count += 10-(n[i]+kuriage)
                kuriage = 1

    if kuriage == 1:
        pay_count += 1
    print(pay_count)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys

def solve(N: str):
    n = list(map(int,list(N)))
    kuriage = 0
    LEN = len(n)
    pay_count = 0

    for i in range(LEN-1,-1,-1):
        if i != 0:
            if n[i-1] >= 5:
                if n[i]+kuriage <= 4:
                    pay_count += n[i]+kuriage
                    kuriage = 0
                else:
                    pay_count += 10-(n[i]+kuriage)
                    kuriage = 1
            else:
                if n[i]+kuriage <= 5:
                    pay_count += n[i]+kuriage
                    kuriage = 0
                else:
                    pay_count += 10-(n[i]+kuriage)
                    kuriage = 1
        else:
            if n[i]+kuriage <= 5:
                pay_count += n[i]+kuriage
                kuriage = 0
            else:
                pay_count += 10-(n[i]+kuriage)
                kuriage = 1

    if kuriage == 1:
        pay_count += 1
    print(pay_count)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = next(tokens)
    solve(N)

if __name__ == '__main__':
    main()
# Original solution
def main():
    s = input().rstrip()
    t = "0" + s
    n = len(t)
    dp = [[float("inf")]*2 for _ in range(n+1)]
    dp[0][0] = 0
    for i in range(n):
        for j in range(2):
            x = int(t[n-i-1]) + j
            if x < 10:
                dp[i+1][0] = min(dp[i+1][0], dp[i][j] + x + 0)
            if 0 < x:
                dp[i+1][1] = min(dp[i+1][1], dp[i][j] + 10 - x)
    print((dp[n][0]))

if __name__ == "__main__":
    main()


# Optimized solution
def main():
    s = input().rstrip()
    s = "0" + s
    dp = [0, float("inf")]
    for c in s:
        x = int(c)
        dp = [min(dp[0] + x, dp[1] + (10-x)), min(dp[0] + x+1, dp[1] + (10-x) - 1)]
    print((dp[0]))

if __name__ == "__main__":
    main()
# Original solution
import sys
n = int(sys.stdin.readline())

ans = 0
p = [0,0]
now = [0,0]
p[0] = n%10
p[1] = 10 - n%10
n = n//10
ans = min(p[0], p[1] + 1)
for _ in range(10**6+1):
  if n <= 0:break
  now[0] = min(p[0] + n%10, p[1] + n%10 + 1)
  now[1] = min(p[0] + 10 - n%10, p[1] + 9 - n%10)
  ans = min(now[0], now[1] + 1)
  n = n//10
  p[0],p[1] = now[0],now[1]
print(ans)


# Optimized solution
import sys
n = [int(i) for i in sys.stdin.readline().rstrip()[::-1]]
ans = 0
i = 0
p = [n[i],10 - n[i]]
now = [0,0]
i += 1
ans = min(p[0], p[1] + 1)
for i in range(1,len(n)):
  now[0] = min(p[0] + n[i]%10, p[1] + n[i]%10 + 1)
  now[1] = min(p[0] + 10 - n[i]%10, p[1] + 9 - n[i]%10)
  ans = min(now[0], now[1] + 1)
  p[0],p[1] = now[0],now[1]
print(ans)
# Original solution
import sys
read = sys.stdin.readline


# 下の桁から貪欲に見ていくと解ける
# 1の位が4以下ならそのまま紙幣で支払うのが得→自身をそのまま答えに採用 (枚数として加算)
# 6以上ならばお釣り狙いのほうが得→自身は0にセットして、上位桁を+1する (枚数として10-自身を加算)
# 5ちょうどのときは、お釣りもそのまま払っても枚数は変わらない。だけど555みたいに、上位桁に+1すると得になる可能性がある。
# 555→15枚, 1000-445→15枚
# つまり5が出たときは更に上位の桁を見て、4以下ならそのまま払うほうが得,5以上なら桁上りのほうが得

# 5ちょうどのときは？ #お釣りもそのまま払っても同じ。だけど上位 お釣り狙いだと上の桁が多くなって支払う金額が増える可能性がある？
# 5ピッタリのときに上位桁に+1すると悪くなる場合が存在する 455 とは 15にってしまう
# 5ピッタリのときはどうするのがよいのか？

N = '00' + read()[:-1]

N = N[::-1]
ans = 0
# agari = 0
# is_pre5 = False
# for n in N:
#     n = int(n) + agari
#     print(n, ans)
#     if is_pre5:
#         if n == 5:
#             ans += n
#             continue

#         if n < 5:
#             # そのまま支払う
#             ans += n
#             agari = 0
#         else:
#             # 桁上り
#             ans += 9 - n
#             agari = 1
#     else:
#         if n == 5:
#             is_pre5 = True
#             ans += n
#             agari = 0
#             # もし5だったら5が終わるまでなめる
#         elif n < 5:
#             ans += n
#             agari = 0
#         else:
#             ans += 10 - n
#             agari = 1
#     if n != 5:
#         is_pre5 = False

i = 0
lo = int(N[i])
while i < len(N) - 1:
    hi = int(N[i + 1])
    # print(hi, lo, i)
    if lo == 5 and hi == 5:
        # 5が連続してた場合
        # 5の最後まで移動(移動の道中は 5+4+4...としていく)
        # 5じゃなくなったhiに対して足し算する必要がある。
        ans += 5
        i += 1
        while i < len(N) - 1 and N[i + 1] == '5':
            ans += 4
            # print(i)
            i += 1
        ans += 4
        # low = N[i]
        hi = int(N[i + 1]) + 1
        # print(hi, lo, i)

        # loが5以外のとき (お釣りが良いか、そのまま払うのが良いか考えるだけ)
    elif lo == 5:
        ans += lo
        if hi < 5:
            pass
        else:
            hi += 1
    elif lo < 5:  # 5が連続しないときもここに入る
        ans += lo
    else:
        ans += 10 - lo
        hi += 1  # 上の桁が繰り上がる
    lo = hi  # 桁を一つずらす
    i += 1


print(ans)


# Optimized solution
import sys
read = sys.stdin.readline


# 下の桁から貪欲に見ていくと解ける
# 1の位が4以下ならそのまま紙幣で支払うのが得→自身をそのまま答えに採用 (枚数として加算)
# 6以上ならばお釣り狙いのほうが得→自身は0にセットして、上位桁を+1する (枚数として10-自身を加算)
# 5ちょうどのときは、お釣りもそのまま払っても枚数は変わらない。だけど555みたいに、上位桁に+1すると得になる可能性がある。
# 555→15枚, 1000-445→15枚
# つまり5が出たときは更に上位の桁を見て、4以下ならそのまま払うほうが得,5以上なら桁上りのほうが得

# 5ちょうどのときは？ #お釣りもそのまま払っても同じ。だけど上位 お釣り狙いだと上の桁が多くなって支払う金額が増える可能性がある？
# 5ピッタリのときに上位桁に+1すると悪くなる場合が存在する 455 とは 15にってしまう
# 5ピッタリのときはどうするのがよいのか？

N = '00' + read()[:-1]

N = N[::-1]
ans = 0

i = 0
lo = int(N[i])
while i < len(N) - 1:
    hi = int(N[i + 1])
    # loが5以外のとき (お釣りが良いか、そのまま払うのが良いか考えるだけ)
    if lo == 5:
        ans += lo
        if hi < 5:
            pass
        else:
            hi += 1
    elif lo < 5:  # 5が連続しないときもここに入る
        ans += lo
    else:
        ans += 10 - lo
        hi += 1  # 上の桁が繰り上がる
    lo = hi  # 桁を一つずらす
    i += 1


print(ans)
# Original solution
def main():
    n = int(eval(input()))
    s = list(str(n))
    s.reverse()
    s += ['0']
    s = [int(c) for c in s]
    m = len(s)

    dp = [[10**7, 10**7] for _ in range(len(s)+5)]
    # dp[i][0]: 繰り下がりなし
    # dp[i][1]: 繰り下がりあり

    dp[0][0] = 0

    for i in range(m):
        for j in range(2):
            nd = s[i]
            if j == 1:
                nd += 1
            if dp[i+1][0] >= dp[i][j]+nd:
                dp[i+1][0] = dp[i][j]+nd
            if dp[i+1][1] >= dp[i][j]+10-nd:
                dp[i+1][1] = dp[i][j]+10-nd
    #print(dp)
    print((dp[m][0]))

if __name__ == '__main__':
    main()

# Optimized solution
def main():
    s = list(str(eval(input())))
    s.reverse()
    for i in range(len(s)):
        s[i] = int(s[i])
    s += [0]
    m = len(s)

    dp = [[10**7, 10**7] for _ in range(len(s)+5)]
    # dp[i][0]: 繰り下がりなし
    # dp[i][1]: 繰り下がりあり

    dp[0][0] = 0

    for i in range(m):
        for j in range(2):
            nd = s[i]
            if j == 1:
                nd += 1
            if dp[i+1][0] >= dp[i][j]+nd:
                dp[i+1][0] = dp[i][j]+nd
            if dp[i+1][1] >= dp[i][j]+10-nd:
                dp[i+1][1] = dp[i][j]+10-nd
    #print(dp)
    print((dp[m][0]))

if __name__ == '__main__':
    main()
# Original solution
def main():
    s = list(str(eval(input())))
    s.reverse()
    for i in range(len(s)):
        s[i] = int(s[i])
    s += [0]
    m = len(s)

    dp = [[10**7, 10**7] for _ in range(len(s)+5)]
    # dp[i][0]: 繰り下がりなし
    # dp[i][1]: 繰り下がりあり

    dp[0][0] = 0

    for i in range(m):
        for j in range(2):
            nd = s[i]
            if j == 1:
                nd += 1
            if dp[i+1][0] >= dp[i][j]+nd:
                dp[i+1][0] = dp[i][j]+nd
            if dp[i+1][1] >= dp[i][j]+10-nd:
                dp[i+1][1] = dp[i][j]+10-nd
    #print(dp)
    print((dp[m][0]))

if __name__ == '__main__':
    main()

# Optimized solution
def main():
    s = list(str(eval(input())))
    s.reverse()
    s = [int(c) for c in s]
    s += [0]
    m = len(s)

    dp = [[10**7, 10**7] for _ in range(len(s)+5)]
    # dp[i][0]: 繰り下がりなし
    # dp[i][1]: 繰り下がりあり

    dp[0][0] = 0

    for i in range(m):
        for j in range(2):
            nd = s[i]
            if j == 1:
                nd += 1
            if dp[i+1][0] >= dp[i][j]+nd:
                dp[i+1][0] = dp[i][j]+nd
            if dp[i+1][1] >= dp[i][j]+10-nd:
                dp[i+1][1] = dp[i][j]+10-nd
    #print(dp)
    print((dp[m][0]))

if __name__ == '__main__':
    main()
# Original solution
# -*- coding: utf-8 -*-
N="0"+input()
l=len(N)

F=[ 0 for _ in range(l) ] #繰り上がりなし
T=[ 0 for _ in range(l) ] #繰り上がりあり
#初期化
T[0]="N"
x=int(N[l-1])
F[l-1]=x
T[l-1]=10-x

for i in range(l-1,0,-1):
    next_x=int(N[i-1])
    F[i-1]=min(F[i]+next_x, T[i]+next_x+1)
    T[i-1]=min(F[i]+10-next_x, T[i]+10-(next_x+1))

print(F[0])


# Optimized solution
# -*- coding: utf-8 -*-
N="0"+input()
l=len(N)

F=[ 0 for _ in range(l) ] #繰り上がりなし
T=[ 0 for _ in range(l) ] #繰り上がりあり
#初期化
x=int(N[l-1])
F[l-1]=x
T[l-1]=10-x

for i in range(l-1,0,-1):
    next_x=int(N[i-1])
    #繰上なしへの遷移。前の桁が繰上なしの場合は単に該当桁の数字を足す、
    #前の桁が繰上ありの場合は、今の桁の数字が1増える
    F[i-1]=min(F[i]+next_x, T[i]+next_x+1) 
    #繰上ありへの遷移。前の桁が繰上なしの場合は(10-該当桁の数字)を足す、
    #前の桁が繰上ありの場合は今の桁の数字が1増えているので(10-該当桁の数字+1)
    T[i-1]=min(F[i]+10-next_x, T[i]+10-(next_x+1))

print(F[0])
# Original solution
# https://atcoder.jp/contests/abc155/submissions/10175015

def main():
    n = list(map(int, input()[::-1])) + [0]
    s = 0
    res = 0
    for i, ni in enumerate(n[:-1]):
        k = ni + s
        if k < 5 or (k == 5 and int(n[i + 1]) < 5):
            res += k
            s = 0
        else:
            res += 10 - k
            s = 1
    res += s
    print(res)


if __name__ == '__main__':
    main()

# Optimized solution
def main():
    n = list(map(int, input()[::-1])) + [0]
    s = 0
    res = 0
    for i, ni in enumerate(n[:-1]):
        k = ni + s
        if k < 5 or (k == 5 and n[i + 1] < 5):
            res += k
            s = 0
        else:
            res += 10 - k
            s = 1
    res += s
    print(res)


if __name__ == '__main__':
    main()
# Original solution
s = [0] + list(map(int,list(input())))
dp = [+float('inf')] * len(s)

for j in range(len(s) - 1, -1, -1):
	a = s[j]
	if j+ 1 < len(dp): a += dp[j + 1] 
	dp[j] = min(a, dp[j])

	b = s[j] + 1
	q = 0
	for jj in range(j+1, len(s)):
		q += 9 - s[jj]
		dp[j] = min(dp[j], b + q + 1 +(dp[jj+1] if jj+1 < len(dp) else 0))

print(dp[0])





# Optimized solution
s = list(map(int,list(input())))
dp = [[0,0] for _ in range(len(s))]
for i in range(len(dp)):
	a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i]
	b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i]
	dp[i][0] = min(a,b)

	a = (dp[i - 1][0] if i - 1 >= 0 else 0) + s[i] + 1
	b = (dp[i - 1][1] if i - 1 >= 0 else 1) + 10 - s[i] - 1
	dp[i][1] = min(a,b)
print(dp[-1][0])
# Original solution
import sys

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()
    N = len(S)

    s = ["", ""]
    flag = True
    for i in range(N):
        s[0] += str(i%2)
        s[1] += str((i + 1)%2)

    cnt = [0, 0]
    for i in range(N):
        for j in range(2):
            if s[j][i] != S[i]: cnt[j] += 1

    print((cnt[0] if cnt[0] < cnt[1] else cnt[1]))


if __name__ == '__main__':
    main()

# Optimized solution
import sys

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()
    N = len(S)

    s = ["", ""]
    for i in range(N):
        for j in range(2):
            s[j] += str((i + j)%2)

    cnt = [0, 0]
    for i in range(N):
        for j in range(2):
            if s[j][i] != S[i]: cnt[j] += 1

    print((cnt[0] if cnt[0] < cnt[1] else cnt[1]))


if __name__ == '__main__':
    main()
# Original solution
import sys

def i2s():
    return sys.stdin.readline()

def ii2ss(n):
    return [sys.stdin.readline() for _ in range(n)]

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

def main(S):
    S = S.rstrip()
    c0 = 0
    c1 = 0
    for i, s in enumerate(S):
        if (i % 2) == int(s):
            c0 += 1
        else:
            c1 += 1
    cmin = min(c0, c1)
    print(cmin)

main(i2s())

# Optimized solution
# AtCoder Beginner Contest 124
# https://atcoder.jp/contests/abc124
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main(S):
    n1 = 0
    n2 = 0
    for i in range(len(S)):
        if i % 2 == 0:
            if S[i] == '0':
                n1 += 1
            else:
                n2 += 1
        if i % 2 == 1:
            if S[i] == '1':
                n1 += 1
            else:
                n2 += 1
    n = min(n1, n2)
    print(n)

S = i2s()
main(S)
# Original solution
#!/usr/bin/env python
import sys

def main():
    S = sys.stdin.readline().rstrip()
    N = len(S)
    s1 = ""
    s2 = ""
    for i in range(N):
        if i % 2 == 0:
            s1 = s1 + "1"
            s2 = s2 + "0"
        elif i % 2 == 1:
            s1 = s1 + "0"
            s2 = s2 + "1"

    ans = float("inf")
    tmp = 0
    for i, j in zip(S, s1):
        if i != j:
            tmp += 1
    ans = min(ans, tmp)
    tmp = 0
    for i, j in zip(S, s2):
        if i != j:
            tmp += 1
    ans = min(ans, tmp)
    print(ans)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python
import sys

def main():
    S = sys.stdin.readline().rstrip()
    N = len(S)

    ans = float("inf")
    tmp1 = 0
    tmp2 = 0
    for i in range(N):
        if i % 2 == 0:
            s1 = "1"
            s2 = "0"
            if S[i] != s1:
                tmp1 += 1
            elif S[i] != s2:
                tmp2 += 1
        elif i % 2 == 1:
            s1 = "0"
            s2 = "1"
            if S[i] != s1:
                tmp1 += 1
            elif S[i] != s2:
                tmp2 += 1
    print((min(tmp1, tmp2)))

if __name__ == '__main__':
    main()
# Original solution
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def func(q, S):
    ret = 0
    for s in S:
        if q == s:
            ret += 1
        q = '1' if q == '0' else '0'
    return ret


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(iss())
    print((min(func('0', S), func('1', S))))


if __name__ == '__main__':
    main()


# Optimized solution
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(iss())
    t = S[::2].count("0") + S[1::2].count("1")
    print((min(t, len(S) - t)))


if __name__ == '__main__':
    main()
# Original solution
N, K = list(map(int, input().split()))
l = []
i = 0
for x in input().split():
    A = int(x)
    if K < N - i:
        l.append(A)
    if i >= K:
        if l.pop(0) < A:
            print("Yes")
        else:
            print("No")
    i = i + 1


# Optimized solution
N, K = list(map(int, input().split()))
l = []
i = 0
for x in input().split():
    A = int(x)
    if K < N - i:
        l.insert(0, A)
    if i >= K:
        if l.pop() < A:
            print("Yes")
        else:
            print("No")
    i = i + 1
# Original solution
N,K = list(map(int,input().split()))
a = list(map(int,input().split()))
t = []; u = 1
for i in range(K):
    u *= a[K-i-1]
t.append(u)
for i in range(1,N-K+1):
    u = u / a[i-1]
    u = u * a[K+i-1]
    t.append(u)
    if t[i-1]<t[i]:
        print("Yes")
    else:
        print("No")

# Optimized solution
N,K = list(map(int,input().split()))
a = list(map(int,input().split()))
for i in range(1,N-K+1):
    if a[K+i-1]>a[i-1]:
        print("Yes")
    else:
        print("No")
# Original solution
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))

p=1
for i in range(k):
    p*=a[i]

p1=0
p2=k

last=p
for i in range(k,n):
    p = p//a[p1]
    p*=a[p2]
    p1+=1
    p2+=1
    if p>last:
        print('Yes')
    else:
        print('No')
    last=p



    


# Optimized solution
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))


p1=0
p2=k

for i in range(k,n):
    if a[p2]>a[p1]:
        print('Yes')
    else:
        print('No')
    p1+=1
    p2+=1