Harryxun/stf_run huggingface dataset:
import collections
from itertools import combinations
import math
from functools import reduce
N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def gcd(*numbers):
    return reduce(math.gcd, numbers)

L = collections.Counter(prime_factorize(N-1))
# print(L)
A = 1
for i,v in L.items():
    A *= (v+1)
# 1を抜く
A -= 1 

c = collections.Counter(prime_factorize(N))
prime = list(dict(c).keys())
d = []
for i in range(1,len(c)):
    d += list(combinations(prime,i))
be = list(c.values())


D = 0
if len(be) > 1:
    # print(be)
    beki = gcd(be)
else:
    beki = be[0]
    while beki%2 == 0:
        beki = beki //2
        D += 1

# C = 1
# for i,v in L.items():
#     C *= (v+1)
# C -= 1

B = 1
# print(c)
for divisor in d:
    a = N
    b = 1
    # print(divisor)
    for i in divisor:
        a /= (i ** c[i])
        b = i
    # print(a,b)
    for j in range(c[i]):
        b = b**(j+1)
        if a > b:
            amari = a%b
            # print(b,a,amari)
            if amari == 1:
                B += 1

# print(A,B,D)
print(A+B+D)


### FIXED CODE ###

import math
N = int(input())
M = int(math.sqrt(N))
M2 = int(math.sqrt(N-1))
y = []
for i in range(1,M2+1):
    if (N-1)%i == 0:
        m = (N-1)//i
        if not m == 1:
            y.append(m)
        if i == 1 or i == m:
            continue
        else:
            y.append(i)
count = len(y)

y = []
for i in range(1,M+1):
    if N%i == 0:
        m = N//i
        y.append(m)
        if i == 1 or i == m:
            continue
        else:
            y.append(i)

for i in y:
    NN = N
    while NN%i == 0:
        NN /= i
    # print(NN)
    if int(NN) % i == 1:
        count += 1
        # print(i)

print(count)
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

def dfs(x):
    stack = [x]
    visited = []
    if checked[x] == 1:
        return 0
    while stack:
        node = stack.pop()
        if node not in visited:
            visited.append(node)
            checked[node] = 1
            for i in graph[node]:
                stack.append(i)
                checked[i] = 1
    return len(visited)

n, m = inm()
checked = [0] * (n+1)
graph = {}
for i in range(m):
    a, b = inm()
    if a not in graph:
        graph[a] = []
    if b not in graph:
        graph[b] = []
    graph[a].append(b)
    graph[b].append(a)
ans = 0
for i in range(1, n+1):
    if checked[i] == 0:
        ans = max(ans, dfs(i))
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().rstrip().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

def dfs(x):
    stack = [x]
    visited = 0
    checked[x] = 1
    while stack:
        visited += 1
        node = stack.pop()
        for i in graph[node]:
            if checked[i] == 0:
                stack.append(i)
                checked[i] = 1
    return visited
 
n, m = inm()
checked = [0] * (n+1)
graph = {}
for i in range(m):
    a, b = inm()
    if a not in graph:
        graph[a] = set()
    if b not in graph:
        graph[b] = set()
    graph[a].add(b)
    graph[b].add(a)
ans = 1
for i in graph:
    if checked[i] == 0:
        ans = max(ans, dfs(i))
print(ans)
a = input()
ans = 0
if a >= 105:
    ans+=1
if a >= 135:
    ans+=1
if a >= 165:
    ans+=1
if a >= 189:
    ans+=1
if a >= 195:
    ans+=1
print(ans)

### FIXED CODE ###

a = int(input())
ans = 0
if a >= 105:
    ans+=1
if a >= 135:
    ans+=1
if a >= 165:
    ans+=1
if a >= 189:
    ans+=1
if a >= 195:
    ans+=1
print(ans)
def binarySearch(key, lst):
    while len(lst) != 1:
        i = len(lst) / 2
        if lst[i] > key:
            lst = lst[:i]
        elif lst[i] < key:
            lst = lst[i + 1:]
        else:
            return True

    if lst[0] == key:
        return True
    else:
        return False

if __name__ == "__main__":
    input()
    S = map(int, raw_input().split())
    input()
    T = map(int, raw_input().split())

    n = 0
    for t in T:
        if binarySearch(t, S):
            n += 1
    print n

### FIXED CODE ###

def binarySearch(key, lst):
    start = 0
    end = len(lst) - 1
    while end - start >= 0:
        i = (end - start) / 2 + start
        if lst[i] > key:
            end = i - 1
        elif lst[i] < key:
            start = i + 1
        else:
            del lst[i]
            return True
    return False

if __name__ == "__main__":
    input()
    S = map(int, raw_input().split())
    input()
    T = map(int, raw_input().split())

    n = 0
    for t in T:
        if binarySearch(t, S):
            n += 1
    print n
#N = int(input())
#A = list(map(int, input()))

top = 1
for a in A:
    top = top * a

bottom = 0
for i in range(N):
    bottom += top / A[i]

ans = top / bottom
print(ans)

### FIXED CODE ###

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

top = 1
for a in A:
    top = top * a

bottom = 0
for i in range(N):
    bottom += top / A[i]

ans = top / bottom
print(round(ans, 6))
n, m,k = list(map(int, input().split()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
count = 0
for i in range(n + m):
    print(k)
    if a_list[0] >= b_list[0] and len(a_list) >= 1:
        k -= a_list.pop(0)
    else:
        k -= b_list.pop(0)
        
    if k > 0:
        count += 1
    else:
        break
        
print(count+1)

### FIXED CODE ###

import numpy as np
n,m,k = list(map(int, input().split()))
a_list = np.array(input().split()).astype(int)
b_list = np.array(input().split()).astype(int)
a_sum =[0]
b_sum=[0]
for i in range(n):
    a_sum.append(a_sum[-1]+ a_list[i])
for i in range(m):
    b_sum.append(b_sum[-1] + b_list[i])
#print(a_sum, b_sum)
total = 0
num = m

for i in range(n+1):
    
    if a_sum[i] > k:
        break
    while (k - a_sum[i]) < b_sum[num]:
        num -=1
        #print(i, num)
        if num == -1:
            break
    total = max(i+num, total)
    
    
print(total)
a, b = map(int, input().split())
if b % a == 0:
  print(a + b)
else:
  pritn(b - a)

### FIXED CODE ###

a, b = map(int, input().split())
if b % a == 0:
  print(a + b)
else:
  print(b - a)
n,m=map(int,input().split())
l=[-1]*(n+1)
for i in range(m):
    idx=int(input())
    l[idx]=0
mod=10**9+7
if l[1]==-1:
    if l[2]==-1:
        l[1]=1;l[2]=2
    else:
        l[1]==1
else:
    if l[2]==-1:
        l[2]=1

for i in range(3,n+1):
    if l[i]==-1:
        l[i]=(l[i-1]+l[i-2])%mod
    else:
        continue
print(l[-1])


### FIXED CODE ###

n,m=map(int,input().split())
l=[-1]*(n+1)
for i in range(m):
    idx=int(input())
    l[idx]=0
mod=10**9+7
if n!=1:
    if l[1]==-1:
        if l[2]==-1:
            l[1]=1;l[2]=2
        else:
            l[1]==1
    else:
        if l[2]==-1:
            l[2]=1
    if n>2:
        for i in range(3,n+1):
            if l[i]==-1:
                l[i]=(l[i-1]+l[i-2])%mod
            else:
                continue
    print(l[-1])
else:
    if l[1]==-1:
        print(1)
    else:
        print(0)
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math

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

lst=A[:N]
_sum=sum(lst)
heapify(lst)

sumlst=[0 for i in range(N*3)]
sumlst[0]=_sum
for i in range(N,2*N):
    heappush(lst,A[i])
    a=heappop(lst)
    _sum+=A[i]-a
    sumlst[i-N+1]=_sum
lst=A[N*2:]
_sum=sum(lst)
lst=[-i for i in lst]
heapify(lst)
sumlst[-1]=_sum
for i in range(2*N-1,N-1,-1):
    heappush(lst,-A[i])
    a=heappop(lst)
    _sum-=-a
    _sum+=A[i]
    sumlst[i+N-1]=_sum

print(max([sumlst[i]-sumlst[2*N-1+i] for i in range(3*N//2)]))


### FIXED CODE ###

from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math

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

lst=A[:N]
_sum=sum(lst)
heapify(lst)

sumlstleft=[0 for i in range(N+1)]
sumlstleft[0]=_sum
for i in range(N,2*N):
    heappush(lst,A[i])
    a=heappop(lst)
    _sum+=A[i]-a
    sumlstleft[i-N+1]=_sum
lst=A[N*2:]
_sum=sum(lst)
lst=[-i for i in lst]
heapify(lst)
sumlstright=[0 for i in range(N+1)]
sumlstright[-1]=_sum
for i in range(2*N-1,N-1,-1):
    heappush(lst,-A[i])
    a=heappop(lst)
    _sum-=-a
    _sum+=A[i]
    sumlstright[i-N]=_sum
print(max([sumlstleft[i]-sumlstright[i] for i in range(N+1)]))
N = int(input())
Flag = False
MAXC = 0
Cont = 0
for TN in range(0,N):
    D1,D2 = (int(T) for T in input().split())
    if Flag==False and D1==D2:
        Flag = True
        Cout = 1
    elif Flag==True and D1==D2:
        Cout += 1
    elif Flag==True and D1!=D2:
        Flag = False
        MAXC = max(MAXC,Cout)
MAXC = [MAXC,max(MAXC,Cout)][Flag]
print(['No','Yes'][MAXC>=3])

### FIXED CODE ###

N = int(input())
Flag = False
MAXC = 0
Cout = 0
for TN in range(0,N):
    D1,D2 = (int(T) for T in input().split())
    if Flag==False and D1==D2:
        Flag = True
        Cout = 1
    elif Flag==True and D1==D2:
        Cout += 1
    elif Flag==True and D1!=D2:
        Flag = False
        MAXC = max(MAXC,Cout)
MAXC = [MAXC,max(MAXC,Cout)][Flag]
print(['No','Yes'][MAXC>=3])
import numpy as np

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

urdl = [(0,-1,0), (1,0,1), (0,1,2), (-1,0,3)]

move_records = []

for i in range(H):
    for j in range(W):
        if field[i][j] % 2 == 0:
            continue
        adj_values = np.array([10, 10, 10, 10])
        if not j == 0:
            adj_values[0] = field[i][j-1]
        if not j == W-1:
            adj_values[2] = field[i][j+1]
        if not i == 0:
            adj_values[3] = field[i-1][j]
        if not i == H-1:
            adj_values[1] = field[i+1][j]

        if sum(adj_values[adj_values != 10] % 2) == 0:
            
            h,w,k = urdl[np.where(adj_values != 10)[0][0]]
            field[i][j] -= 1
            field[i+h][j+w] += 1
            
        else:
            # import ipdb; ipdb.set_trace()
            for h,w,k in urdl:
                if adj_values[k] == 10:
                    continue

                if adj_values[k] % 2 != 0:
                    field[i][j] -= 1
                    field[i+h][j+w] += 1
                    break
        
        move_records.append([i+1,j+1,i+h+1,j+w+1])

M = len(move_records)
print(M)
for i in range(M):
    print('{} {} {} {}'.format(move_records[i][0],
                               move_records[i][1],
                               move_records[i][2],
                               move_records[i][3]))

### FIXED CODE ###

import numpy as np
H, W = map(int, input().split())
field = []
for i in range(H):
    field.append(list(map(int, input().split())))
rd = [(0,1,0), (1,0,1)]
move_records = []
if H != 1 or W != 1:
    for i in range(H):
        for j in range(W):
            if field[i][j] % 2 == 0:
                continue
            if i == H-1 and j == W-1:
                continue
            if i == H-1 and j == W-2:
                # import ipdb; ipdb.set_trace()
                if (field[H-1][W-1] + field[H-1][W-2]) % 2 != 0:
                    continue
                else:
                    field[H-1][W-2] -= 1
                    field[H-1][W-1] += 1
                    move_records.append([i+1,j+1,i+1,j+2])
            elif j != W-1:
                field[i][j] -= 1
                field[i][j+1] += 1
                move_records.append([i+1,j+1,i+1,j+2])
            else:
                field[i][j] -= 1
                field[i+1][j] += 1
                move_records.append([i+1,j+1,i+2,j+1])
M = len(move_records)
print(M)
for i in range(M):
    print('{} {} {} {}'.format(move_records[i][0],
                               move_records[i][1],
                               move_records[i][2],
                               move_records[i][3]))
N, K = map(int, input().split())
Alist = list(map(int, input().split()))

# ループする数を求める
loop_num = 0
loop_start_index = 0
point = 1
route_list = [1]

for i in range(K):
    point = Alist[point - 1]
    if point in route_list:
        loop_start_index = route_list.index(point)
        loop_num = i + 1 - loop_start_index
        break

    route_list.append(point)

print(route_list[loop_start_index  + ((K-loop_start_index) % loop_num)])

### FIXED CODE ###

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

# ループする数を求める
loop_num = 2 * 10 ** 5
loop_start_point = -1
point = 1
count_list = [-1] * N

for i in range(K):
    #print("point:", point)
    count_list[point - 1] = i
    nextPoint = Alist[point - 1]

    if count_list[nextPoint - 1] != -1:
        loop_start_point = nextPoint
        loop_num = i - count_list[loop_start_point - 1] + 1
        break
    
    point = nextPoint

if loop_start_point == -1:
    print(point)
else:
    point = loop_start_point
    progress_num = (K - count_list[loop_start_point-1]) % loop_num
    for i in range(progress_num):
        point = Alist[point - 1]
    #print("pro:", progress_num)
    #print("ls:", loop_start_point)
    #print("ln:", loop_num)
    print(point)
[N,Q] = list(map(int,input().split()))
locate= [-1]*N

str=input()
s = list(str)

k=1
locate=[-1]*N

for i in range (N):
    if s[i]=='A' and s[i+1]=='C':
        locate[k]=i
        k+=1

locate[k]=100000000

numL=1
numR=k-1

for i in range(Q):
    a = list(map(int, input().split()))
    L=a[0]-1
    R=a[1]-1

    for j in range(1,k):
        if L>locate[j-1] and L<=locate[j]:
            numL=j
            break
 


    for j in range(1,k):
        if R>locate[j] and R<=locate[j+1]:
            numR=j
            break
    
    
    print(numL,numR,numR-numL+1)


### FIXED CODE ###


[N,Q] = list(map(int,input().split()))
locate= [-1]*N

str=input()
s = list(str)

num_a=[0]*N
tmp=0

for i in range(1,N):
    if s[i-1]=='A' and s[i]=='C':
        tmp+=1
    num_a[i]=tmp
        

for i in range(Q):
    a = list(map(int, input().split()))
    L=a[0]-1
    R=a[1]-1
    print(num_a[R]-num_a[L])
N = int(input())
S = list(input())
f=0
ijk = list()
for i in range(N):
    for j in range(N):
        for k in range(N):
            if(k>j and j>i):
                if(k == j+(j-i)):
                    pass
                elif(i == j-(j-k)):
                    pass
                else:
                    ijk.append([i+1,j+1,k+1])

for i in range(len(ijk)):
    if(S[ijk[i][0]]!= S[ijk[i][1]] and
       S[ijk[i][0]]!= S[ijk[i][2]] and
       S[ijk[i][1]]!= S[ijk[i][2]]):
       f+=1
print(f)

### FIXED CODE ###

n=int(input())
s=input()
r=g=b=0
for i in s:
  if i=="R":r+=1
  elif i=="G":g+=1
  else:b+=1

ans=r*g*b
for i in range(n):
  for j in range(i+1,n):
    k_ = j+(j-i)
    if(k_ >=n):
      break
    ans -= int(s[i]!= s[j] and s[i] != s[k_] and s[j] != s[k_])

print(ans)
n = int(innput())
f = 4
s = 7
for i in range(30):
  f = f*i
  for j in range(30):
    s = s*j
    if n%s == 0 or n%f == 0 or n%(f+s)==0:
      print('Yes')
      quit()
    if n < f+s:
      break
print('No')

### FIXED CODE ###

n = int(input())
for i in range(100):
  for j in range(100):
    if 4*i+7*j == n:
        print('Yes')
        exit(0)
print('No')
n = int(input())
a = []
a = map(int,input().split())
ans = 1
for val in a:
    ans *= val
if ans > 10**18:
    print("-1")
    break
else:
    print(ans)

### FIXED CODE ###

n = int(input())
a = []
a = map(int,input().split())
a = sorted(a)
ans = 1
for val in a:
    ans *= val
    if ans > 10**18:
        print(-1)
        break
else:
    print(ans)
S=input()
if (S[-1:]==s):
  print(S+"es")
else:
  print(S+"s")

### FIXED CODE ###

S=input()
if (S[-1:]=="s"):
  print(S+"es")
else:
  print(S+"s")
weather = input()
if: weather == "Sunny":
    print("Cloudy")
elif weather == "Cloudy":
    print("Rainy")
else:
    print("Sunny")

### FIXED CODE ###

a = input()
if a == "Sunny":
    print("Cloudy")
elif a == "Cloudy":
    print("Rainy")
else :
    print("Sunny")
# -*- coding: utf-8 -*-

# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


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

    from collections import defaultdict
    l = defaultdict(0)
    r = defaultdict(0)
    for i, h in enumerate(a):
        no = i + 1
        l[no + h] += 1
        r[no - h] += 1

    ret = 0
    for i in range(1, n + 1):
        ret += (l.get(i, 0) * r.get(i, 0))

    return ret


if __name__ == "__main__":
    print(main())


### FIXED CODE ###

# -*- coding: utf-8 -*-

# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


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

    from collections import defaultdict
    l = defaultdict(int)
    r = defaultdict(int)
    for i, h in enumerate(a):
        no = i + 1
        l[no + h] += 1
        r[no - h] += 1

    ret = 0
    for i in range(1, n + 1):
        ret += (l.get(i, 0) * r.get(i, 0))

    return ret


if __name__ == "__main__":
    print(main())
s = input()
for w in s:
    a = s.index(w)
    if w == s[a+1]:
        print("Bad")
        break
    else:
        continue
else:
    print("Good")


### FIXED CODE ###

s = input()
for w in range(3):
    if s[w] == s[w+1]:
        print("Bad")
        break
    else:
        continue
else:
    print("Good")
n, m = map(int, input().split(" "))

count = [0 for i in range(0,n)]

for i in range(0, m):
    a, b = map(int, input().split(" "))
    count[a] += 1
    count[b] += 1

for i in range(0, n):
    print(count[i])


### FIXED CODE ###

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

count = [0 for i in range(0,n)]

for i in range(0, m):
    a, b = map(int, input().split(" "))
    count[a-1] += 1
    count[b-1] += 1

for i in range(0, n):
    print(count[i])
class ModTools:
    def __init__(self, MAX, MOD):
        MAX += 1
        self.MAX = MAX
        self.MOD = MOD
        factorial = [1] * MAX
        factorial[0] = factorial[1] = 1
        for i in range(2, MAX):
            factorial[i] = factorial[i-1] * i % MOD
        inverse = [1] * MAX
        inverse[MAX-1] = pow(factorial[MAX-1], MOD-2, MOD)
        for i in range(MAX-2, 0, -1):
            inverse[i] = inverse[i+1] * (i+1) % MOD
        self.fact = factorial
        self.inv = inverse

    def nCr(self, n, r):
        if n < r: return 0
        r = min(r, n-r)
        numerator = self.fact[n]
        denominator = self.inv[r] * self.inv[n-r] % self.MOD
        return numerator * denominator % self.MOD

N, a, b = map(int,input().split())
mod = 10**9+7
fact = ModTools(N, mod)
sum = 1
for i in range(N) :
    sum = (sum * 2) % mod

sum = (sum - fact.nCr(N,a) - fact.nCr(N,b) - 1) % mod
print(sum)


### FIXED CODE ###

n, a, b = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod):
    X = 1
    Y = 1
    for i in range(1,r+1):
        X = (X*(n-i+1))%mod
        Y = (Y*i)%mod
    return (X*pow(Y, mod-2, mod))%mod

ans = (pow(2, n, mod) -1 - comb(n, a, mod) - comb(n, b, mod))%mod
print(ans)
import math

def lcm(x, y):
    return ((x * y) // math.gcd(x, y))


A, B, C, D = map(int, input().split())

# 変数C の倍数が A, B 区間内に存在しうる数
Ccount = (B // C) - ((A - 1) // C)

# 変数D の倍数が A, B 区間内に存在しうる数
Dcount = (B // D) - ((A - 1) // D)

# 変数C, D の最小公倍数が A, B 区間内に存在しうる数
CDcross = (B // lcm(C, D)) - ((A - 1) // lcm(C, D))

# Cが存在しうる数と Dが存在しうる数を引き、重複する（＝最小公倍数）数は引きすぎなので戻す
print((B-A+1) - ((Ccount + Dcount - CDcross)))

### FIXED CODE ###

from fractions import gcd

def lcm(x, y):
    return ((x * y) // gcd(x, y))


A, B, C, D = map(int, input().split())

# 変数C の倍数が A, B 区間内に存在しうる数
Ccount = (B // C) - ((A - 1) // C)

# 変数D の倍数が A, B 区間内に存在しうる数
Dcount = (B // D) - ((A - 1) // D)

# 変数C, D の最小公倍数が A, B 区間内に存在しうる数
CDcross = (B // lcm(C, D)) - ((A - 1) // lcm(C, D))

# Cが存在しうる数と Dが存在しうる数を引き、重複する（＝最小公倍数）数は引きすぎなので戻す
print((B-A+1) - ((Ccount + Dcount - CDcross)))
N = int(input())
lis = []
for i in range(N):
    lis.append(tuple(map(int, input().split())))

dic = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        val = (lis[i][0]-lis[j][0], lis[i][1]-lis[j][1])
        if val in dic:
            dic[val] += 1
        else:
            dic[val] = 1
#print(dic)
print(N-max(dic.values()))


### FIXED CODE ###

N = int(input())
lis = []
for i in range(N):
    lis.append(tuple(map(int, input().split())))
if N == 1:
    print(1)
    exit()

dic = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        val = (lis[i][0]-lis[j][0], lis[i][1]-lis[j][1])
        if val in dic:
            dic[val] += 1
        else:
            dic[val] = 1
#print(dic)
print(N-max(dic.values()))
from  itertools import combinations
n,C=map(int,input().split())
d=[list(map(int,input().split())) for _ in range(C)]
c=[list(map(int,input().split())) for _ in range(n)]
a=[[0]*C for _ in range(3)]
for i in range(n):
	for j in range(n):
		a[(i+j)%3][c[i][j]-1]+=1
ans=10**9
for v in combinations(range(C),3):
	tmp=0
	for i in range(3):
		for j in range(30):
			tmp+=a[i][j]*c[j][v[i]]
	ans=min(ans,tmp)
print(ans)

### FIXED CODE ###

from itertools import permutations
n,C=map(int,input().split())
d=[list(map(int,input().split())) for _ in range(C)]
c=[list(map(int,input().split())) for _ in range(n)]
a=[[0]*C for _ in range(3)]
for i in range(n):
	for j in range(n):
		a[(i+j)%3][c[i][j]-1]+=1
ans=10**9
for v in permutations(range(C),3):
	tmp=0
	for i in range(3):
		for j in range(C):
			tmp+=a[i][j]*d[j][v[i]]
	ans=min(ans,tmp)
print(ans)
num = input()
num_char = list(num)
if num_char[0] == "0":
	for i in range(0, int(len(num_char)),2):
		num_char[i] = 0
		num_char[i + 1] = 1
else:
	for i in range(0, int(len(num_char)),2):
		num_char[i] = 1
		num_char[i + 1] = 0
for i in num_char:
  print(i, end = "")

### FIXED CODE ###

s = input()
cnt1 = 0
cnt2 = 0
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == "0":
            cnt1 += 1
        else:
            cnt2 += 1
    else:
        if s[i] == "1":
            cnt1 += 1
        else:
            cnt2 += 1
print(min(cnt1,cnt2))