Harryxun/stf_run huggingface dataset:
import math, numpy

n = int(input())

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

l = [0] * n
l[0] = 1

cumsum_a = numpy.cumsum(a[::-1])[::-1]

if (n > 0) and (a[0] > 0):
    print(-1)
else:
    for i in range(1, n):
        b_max1 = 2 * (l[i - 1] - a[i - 1])
        b_max2 = cumsum_a[i]

        if a[i] > 2 ** i - math.ceil(l[i-1]/2):
            l = -1
            break

        l[i] = min(b_max1, b_max2)

    if l != -1:
        l[-1] = a[-1]
        print(sum(l))
    else:
        print(-1)

### FIXED CODE ###

n = int(input())

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

cumsum_a = a.copy()

for i in range(n-1, -1, -1):
    cumsum_a[i] += cumsum_a[i+1]

ans = 0
childable_node = 1

for i in range(n + 1):
    if a[i] > childable_node:
        ans = -1
        break

    ans += childable_node

    if i < n:
        b_max1 = 2 * (childable_node - a[i])
        b_max2 = cumsum_a[i + 1]
        childable_node = min(b_max1, b_max2)

print(ans)
import sys
input = sys.stdin.readline

def GCD(a, b):
    if(b == 0):
        return a
    else:
        return GCD(b, a % b)

def LCM(a, b):
    return a * b / GCD(a, b)

n = int(input())
t = [int(input()) for i in range(n)]
ans = t[0]
for i in range(1,n):
    ans = LCM(ans, t[i])
print(int(ans))

### FIXED CODE ###

import sys
input = sys.stdin.readline

def GCD(a, b):
    if(b == 0):
        return a
    else:
        return GCD(b, a % b)

def LCM(a, b):
    return a * b // GCD(a, b)

n = int(input())
t = [int(input()) for i in range(n)]
ans = t[0]
for i in range(1,n):
    ans = LCM(ans, t[i])
print(ans)
n = int(input())
s = input()

for ss in s:
    i = ord(ss)
    i += n
    if i > 90:
        i -= 26
    ss = chr(i)
    print(ss,end="")

### FIXED CODE ###

s = input()
lis = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

ans = 7 - lis.index(s)
print(ans)
args=input().split()
n=int(args[0])
s=args[1]
print('No' if s[n:]!=s[:n] else 'Yes')

### FIXED CODE ###

n = int(input())
s = input()
if n % 2:
    print("No")
    exit()
half = s[0:n // 2]
print("Yes" if s == half + half else "No")
N = input()
A = input()
B = input()
if N == 1:
  print("Hello World")
else:
  print(int(A+B))


### FIXED CODE ###

if int(input()) == 1:
    print("Hello World")

else:
    A = int(input())
    B = int(input())
    print(A + B)
bilding = [[[0 for i in range(10)] for j in range(3)]for k in range(4)]

n = int(input())
for i in range(n)
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v

### FIXED CODE ###

bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)] 
n = int(input())
for k in range(n):
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v

for b in range(4):
    for f in range(3):
        print(" "+" ".join(map(str, bilding[b][f])))
    if b != 3:
        print("#"*20)
N=int(input())
#5
A=sorted(map(int,input().split()))
#24 11 8 3 16
B = A.copy()

for i in range(N):
	if A[i] != 0:
		for j in range(i+1,N):
				if A[j] % A[i] == 0:
					A[j] = 0

if A[0] == B[1]:
	A[0] = 0

print(sum([1 for a in A if a != 0]))



### FIXED CODE ###

N=int(input())
#5
A=sorted(map(int,input().split()))
#24 11 8 3 16

dp = [1]*max(A)
l = len(dp)

for a in A:
	if dp[a-1] == 1:
		dp[a-1] = 2
		for i in range(2*a, l+1, a):
			dp[i-1] = 0
	elif dp[a-1] == 2:
		dp[a-1] = 0

print(sum([1 for a in A if dp[a-1] != 0]))
rom math import ceil

D, G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]

ans = float("inf")
for bit in range(1 << D):
    cnt = 0
    sum = 0
    remain = set(range(1,D+1))

    for i in range(D):
        if bit & (1 << i):
            cnt += pc[i][0]
            sum += pc[i][0]*(i+1)*100 + pc[i][1]
            remain.discard(i+1)

    if sum < G:
        use = max(remain)
        n = min(pc[use-1][0], ceil((G-sum)/(use*100)))
        """
        if use == 0:
            n = 0
        elif (G - sum)%(use%100) == 0:
            n = min(pc[use-1][0], (G - sum)//(use*100))
        else:
            n = min(pc[use-1][0], (G - sum)//(use*100)+1)
        """
        cnt += n
        sum += n*use*100

    if sum >= G:
        ans = min(ans,cnt)

print(ans)

### FIXED CODE ###

d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float("inf")

for bit in range(1 << d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))

    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.discard(i + 1)

    # G 点に満たなければ nokori のうち一番大きいものを解く
    if sum < g:
        use = max(nokori)
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)

print(ans)
def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if heap[left] > heap[i] and left < len(heap) else i
    largest = right if heap[right] > heap[largest] and right < len(heap) else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)

def buildMaxHeap(heap):
    for i in range(len(heap) // 2, -1, -1):
        maxHeapify(heap, i)

n = int(input())
heap = list(map(int, input().split()))
buildMaxHeap(heap)
print('', *heap)
'''
out = ''
for key in heap:
    out += (' {}'.format(str(key)))
print(out)
'''

### FIXED CODE ###

def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if left < len(heap) and heap[left] > heap[i] else i
    largest = right if right < len(heap) and heap[right] > heap[largest] else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)

def buildMaxHeap(heap):
    for i in range(len(heap) // 2, -1, -1):
        maxHeapify(heap, i)

n = int(input())
heap = list(map(int, input().split()))
buildMaxHeap(heap)

out = ''
for key in heap:
    out += (' {}'.format(str(key)))
print(out)
import numpy as np
import copy

h, w = map(int, input().split())
map = [input() for _ in range(h)]
mapB = np.zeros((h, w))
for i, ii in enumerate(map):
  for j, jj in enumerate(ii):
    if jj == '#':
      mapB[i, j] = 1
map = copy.deepcopy(mapB)
      
count = 0
done = False

while not done:
  count +=1
  for i in range(w):
    for j in range(h):
      if map[i, j] >= 1:
          mapB[max(0, i-1), j] = 1 
          mapB[i, max(0, j-1)] = 1 
          mapB[min(h-1, i+1), j] = 1 
          mapB[i, min(w-1, j+1)] = 1 

  if mapB.all():
    done = True
    break
  
  map = map + mapB
  
print(count)

### FIXED CODE ###

import numpy as np
from scipy import ndimage

h, w = map(int, input().split())
map = [input() for _ in range(h)]
mapB = np.zeros((h, w))
for i, ii in enumerate(map):
  for j, jj in enumerate(ii):
    if jj == '.':
      mapB[i, j] = 1
dist = ndimage.distance_transform_cdt(mapB, metric="taxicab")
print(dist.max())
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
ans=[]
xyz=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
if(m==0):
  print("0")
else:
 for j in xyz:
   x,y,z=j
   lst=[]
   for i in range(m):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      lst+=[b]
   for i in range(m,n):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      if(min(lst)<b):
         lst.remove(min(lst))
         lst+=[b]
   ans+=[sum(lst)]
print(max(ans))

### FIXED CODE ###

n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
ans=[]
xyz=[[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]
if(m==0):
  print("0")
else:
 for j in xyz:
   x,y,z=j
   lst=[]
   for i in range(m):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      lst+=[b]
   for i in range(m,n):
      b=a[i][0]*x+a[i][1]*y+a[i][2]*z
      if(min(lst)<b):
         lst.remove(min(lst))
         lst+=[b]
   ans+=[sum(lst)]
 print(max(ans))
n,p=map(int,input().split())
s=input()

count=0
if p==2:
    for i in range(n):
        if int(s[i])%2==0:
            count+=i+1
elif p==5:
    for i in range(n):
        if int(s[i])%5==0:
            count+=i+1
else:
    u=[]
    num=0
    for i in range(n):
        u.append(int(s[i:n]%p))
    u.append(0)
    for i in range(n):
        for j in range(i,n):
            if (u[i]-u[j+1])%p==0:
                count+=1
print(count)

### FIXED CODE ###

n,p=map(int,input().split())
s=input()

count=0
if p==2:
    for i in range(n):
        if int(s[i])%2==0:
            count+=i+1
elif p==5:
    for i in range(n):
        if int(s[i])%5==0:
            count+=i+1
else:
    lis=[1]
    for i in range(n-1):
        lis.append((lis[i]*10)%p)
    lis.reverse()
    for i in range(n):
        lis[i]=(int(s[i])*lis[i])%p
    unum=[1]
    for i in range(p-1):
        unum.append(0)
    num=0
    for i in range(n):
        num=(num+lis[n-i-1])%p
        unum[num]+=1
    for i in range(p):
        unumi=unum[i]
        count+=(unumi*(unumi-1))*0.5
print(round(count))
deata = list(input())
count = 0
for i in range(1, len(data)):
  if data[i] == data[i-1]:
    if data[i] == "0":
      data[i] = "1"
    else:
      data[i] = "0"
    count += 1
print(count)

### FIXED CODE ###

data = list(input())
count = 0
for i in range(1, len(data)):
  if data[i] == data[i-1]:
    if data[i] == "0":
      data[i] = "1"
    else:
      data[i] = "0"
    count += 1
print(count)
D,T,S=map(int,input().split())
if D/S <= T:
    print("Yes")
else:
    prnit("No")


### FIXED CODE ###

D,T,S=map(int,input().split())
if D/S <= T:
    print("Yes")
else:
    print("No")
salmo
h, w = map(int, input().split())
a = [list(input()) for i in range(h)]
for i in range(h):
    if set(a[h-i-1]) == {'.'}:
        del(a[h-i-1])
for i in range(w):
    if set([j[w-i-1] for j in a]) == {"."}:
        for j in a:
            del(j[w-i-1])
for i in a:
    print(''.join(i))

### FIXED CODE ###

h,w=map(int,input().split())
a=[]
for i in range(h):
    j=list(input())
    if '#' in j:
        a.append(j)
aa=zip(*[i for i in zip(*a) if '#' in i])
for i in aa:
    print(''.join(i))
N = input()
print("Yes" if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else "No")


### FIXED CODE ###

n = input()
print("Yes" if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else "No")
s = list(input())
k = input()

if k == '1':
    print(s[0])
else:
    n = int(k)-1
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
    if f:
        print(s[n])

### FIXED CODE ###

s = list(input())
k = input()

if k == '1':
    print(s[0])
else:
    n = min(int(k), len(s))
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
            break
    if f:
        print(1)
ort math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
K = int(input())
B = list()
a = int()
b = int()
c = int()
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(i,j,k)
print(ans)

### FIXED CODE ###

import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
K = int(input())
B = list()
a = int()
b = int()
c = int()
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(i,j,k)
print(ans)
# -*- coding: utf-8 -*-

from sys import stdin
import math
from functools import reduce

n,x = [int(x) for x in stdin.readline().split()]
limit = int(math.pow(x, (1.0/n)))

def factorize(x, g):
    p = 2
    if x % p == 0:
        p_n = math.pow(p, n)
        if x % p_n == 0:
            g = factorize(x / p_n, g)
            g.append(p)
            return g

    for p in range(3, limit, 2):
        if x % p == 0:
            p_n = math.pow(p, n)
            if x % p_n == 0:
                g = factorize(x / p_n, g)
                g.append(p)
                return g
    return g

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    g = factorize(x, [])
    ans = reduce(lambda a,b: a*b, g)
    print(ans)


### FIXED CODE ###

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

from sys import stdin

n,x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0/n)) + 1

def devide_counter(x, p):
    count = 1
    x /= p
    while x % p == 0:
        count += 1
        x /= p
    return x, count

def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        x, count = devide_counter(x, p)
        if count >= n:
            ans = ans * (p ** (count // n))

    for p in range(3, limit, 2):
        if x % p == 0:
            x, count = devide_counter(x, p)
            if count >= n:
                ans = ans * (p ** (count // n))
        if x < p * p:
            break
    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)
r = 1
for i in range(input().split(' ')):
 r ^= int(i)
print(r)

### FIXED CODE ###

r = 1
for i in input().split(' '):
 r ^= int(i)
print(r)
n,k=map(int,input().split())
a=[]
for i in range(n):
  a.append(int(input()))
b=sorted(a)
print(b[n-1]-b[n-k])


### FIXED CODE ###

d=int(input())
print('Christmas' if d==25 else 'Christmas Eve' if d==24 else 'Christmas Eve Eve' if d==23 else 'Christmas Eve Eve Eve')
money = [0,1,2,3,4,5]
n = int(input())
p = 0
lm = n//100
need = n - (lm*100)
def dfs( cur,limit):
    global p,need
    if not p:
        for i in range(6):
            now = cur+money[i]
            if limit+1 == lm:
                if now == need:
                    p =1
                    break
            elif limit+1<=lm:
                dfs(now,limit+1)
if n>=100:
    dfs(0,0)
    print(1 if p else 0)
else:
    print(0)

### FIXED CODE ###

money = [0,1,2,3,4,5]
n = int(input())
p = 0
lm = n//100
need = n - (lm*100)
if n>=100:
    print(1 if lm*5>= need else 0)
else:
    print(0)
n = int(input())
cnt = 0
for i in range(200005):
    if n < 10:
        cnt += n
        break
    cnt += (n % 10)
    n = int(n / 10)
if cnt % 9 == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = input()
cnt = 0
for i in range(len(n)):
    cnt += int(n[i])
if cnt % 9 == 0:
    print('Yes')
else:
    print('No')
s = input()
l,r,ans = 0,len(s)-1,0
while l!=r:
	if s[l]==s[r]: l,r = l+1,r-1
	elif s[l]=="x": l,ans = l+1,ans+1
	elif s[r]=="x": r,ans = r-1,ans+1
	else: break
if l==r: print(ans)
else: print(-1)

### FIXED CODE ###

s = input()
l,r,ans = 0,len(s)-1,0
while l<r:
	if s[l]==s[r]: l,r = l+1,r-1
	elif s[l]=="x": l,ans = l+1,ans+1
	elif s[r]=="x": r,ans = r-1,ans+1
	else: break
if l>=r: print(ans)
else: print(-1)
d = int(input())
if d==25:
    print(Christmas)
if d==24:
    print(Christmas Eve)
if d==23:
    print(Christmas Eve Eve)
if d==22:
    print(Christmas Eve Eve Eve)


### FIXED CODE ###

d = int(input())
if d==25:
    print("Christmas")
if d==24:
    print("Christmas Eve")
if d==23:
    print("Christmas Eve Eve")
if d==22:
    print("Christmas Eve Eve Eve")
s=input()
l=['A','C','G','T']
ans=[];ct=0
for i in range(len(s)):
  if s[i] in l:
    ct+=1
  else:
    ans.append(ct)
print(max(ans))

### FIXED CODE ###

s=input()
l=['A','C','G','T']
ans=[];ct=0
for i in range(len(s)):
  if s[i] in l:
    ct+=1
  else:
    ans.append(ct)
    ct=0
ans.append(ct)
print(max(ans))
a,b=map(int,input().split())
c=a-2*b
if c>o:
    print(c)
else:
    print(0)

### FIXED CODE ###

a,b=map(int,input().split())
c=a-2*b
if c>0:
    print(c)
else:
    print(0)
N = int(input())
if N % 2 = 0:
  a = N / 2
else:
  a = (N+1)/2
print(a)

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
  print(int(N/2))

else:
  print(int((N+1)/2))
import sys
sys.setrecursionlimit(10000000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
n=int(input())
t=[int(i) for i in sys.stdin]
if n==1:
  print(t[0])
  exit()
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)
S = input()
K = int(input())
for i in range(len(S):
    if S[i] != 1:
        print(S[i])
        exit()

### FIXED CODE ###

S = input()
K = int(input())
if K == 1:
    print(S[0])
    exit()
else:
    for i in range(K):
        if S[i] != "1":
            print(S[i])
            exit()
print(1)
n = int(input())
long ans = 0
li = []
for i in range(n):
    a, b = map(int, input().split())
    li.append([a+b, a, b])

li = sorted(li)
for i in range(n):
    if i%2 == 0:
        ans += li[i][1]
    if i%2 == 1:
        ans -= li[i][2]

print(ans)

### FIXED CODE ###

n, a, b = map(int, input().split())
print(str(min(a, b)) + " " + str(max(0, a+b-n)))
N=int(input())
a_list=list(map(int,input().split()))
Q=int(input())

N_list=[0]*(10001)
sumn=0

for a in a_list:
    N_list[a]+=1
    sumn+=a


for i in range(Q):
    b,c=map(int,input().split())
    henka=(c-b)*N_list[b]

    sumn+=henka

    N_list[c]+=N_list[b]
    N_list[b]=0

    print(sumn)

### FIXED CODE ###

N=int(input())
a_list=list(map(int,input().split()))
Q=int(input())

N_list=[0]*(100001)
sumn=0

for a in a_list:
    N_list[a]+=1
    sumn+=a


for i in range(Q):
    b,c=map(int,input().split())
    henka=(c-b)*N_list[b]

    sumn+=henka

    N_list[c]+=N_list[b]
    N_list[b]=0

    print(sumn)
while True:
    m=input().split()
    h=int(m[0])
    w=int(m[1])
    if a==0 & b==0:
      break
    for i in range(h):
       print("#"*w)
    
    


### FIXED CODE ###

while True:
    v=input().split()
    a=int(v[0])
    b=int(v[1])
    if a==0 and b==0:
       break
    for i in range (a):
        print('#'*b)
    print()
n, k = list(map(int, input().split(" ")))
a = abs(n-k)
n = n - a * (n // a)
print(n)

### FIXED CODE ###

n, k = list(map(int, input().split(" ")))
n = n - k * (n // k)
n_last = abs(n - k)
if n_last < n:
    n = n_last
print(n)
X,K,D = map(int,input().split())
List = []

if K == 1:
    print(min(abs(X-D),abs(X+D)))
elif K == 2:
    print(min(abs(X+D+D),abs(X-D-D),abs(X)))
elif K == 3:
    print(min(abs(X+D+D+D),abs(X+D),abs(X-D),abs(X-D-D-D)))
else:
    for i in range(3):
        if abs(X - D) >= abs(X+D):
            List.append(abs(X+D))
            X = X+D
        else:
            List.append(abs(X-D))
            X = X-D

    for i in range(K-3):
        if List[i] == List[i+2]:
            if K%2 == i%2:
                print(List[i+1])
            else:
                print(List[i])
            break
        else:
            if abs(X - D) >= abs(X+D):
                List.append(abs(X+D))
                X = X+D
            else:
                List.append(abs(X-D))
                X = X-D
        print(List[K-1])
                

### FIXED CODE ###

X,K,D = map(int,input().split())

t = abs(X) // D
s = abs(X) % D

if abs(X) > K*D:
    print(abs(X) - K*D)
elif t%2 == K%2:
    print(s)
else:
    print(D-s)
X, A = [int(xa) for xa input().split()]
if X < A:
  print(0)
else:
  print(10)

### FIXED CODE ###

X, A = [int(xa) for xa in input().split()]
if X < A:
  print(0)
else:
  print(10)
s=input()
array=[]
array+=(int(x) for x in input().split())
array.sort()
def judge(array,s):
  for i in range(int(s)-1):
    if array[i] == array[i+1]:
        return "NO"
  return "YES"

print(judge(array,s))

### FIXED CODE ###

a,b=input().split()
a_num,b_num=input().split()
c=input()
 
if c==a:
  a_num=int(a_num)-1
elif c==b:
  b_num=int(b_num)-1
print(a_num,b_num)
N = int(input())
for i in range(1, N**0.5):
  if N%i == 0:
    print(i+N//i-2)

### FIXED CODE ###

N = int(input())
minstep = 9999999999999999999999999999999
for i in range(1, int(N**0.5+1)):
  if N%i == 0:
    minstep = min(minstep, i+N//i-2)
print(minstep)
n = int(input())
V = list(map(int, input().split()))

E = V[::2]
O = V[1::2]

from collections import Counter
Ed = Counter(E)
Od = Counter(O)
Edn = Ed.most_common(2)
Odn = Od.most_common(2)
print(Edn,Odn)
if Edn[0][0] != Odn[0][0]:
    print(n- Edn[0][1] - Odn[0][1])
else:
    if len(Edn) == 1:
        if len(Odn) == 1:
            print(n//2)
        else:
            print(n//2-Odn[1][1])
    if len(Odn) == 1:
        print(n//2-Edn[1][1])
    else:
        print(min(n-Edn[0][1]-Odn[1][1],m-Edn[1][1]-Odn[0][1]))

### FIXED CODE ###

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

Dic = [[i,0] for i in range(1,(10**5)+1)]
Dic2 = [[i,0] for i in range(1,(10**5)+1)]
for i in range(n):
    if i%2 == 0:
        Dic[V[i]-1][1] += 1
    else:
        Dic2[V[i]-1][1] += 1
Dic.sort(key = lambda x:x[1],reverse = True)
Dic2.sort(key = lambda x:x[1], reverse = True)
#print(Dic,Dic2)
cn = 0
if Dic[0][0] != Dic2[0][0]:
    cn += n - Dic[0][1] - Dic2[0][1]
else:
    cn += n - max((Dic[0][1]+Dic2[1][1]), (Dic[1][1]+Dic2[0][1]))
print(cn)
N = int(input())
S = input()

ans = []
for i in range(1, N):
    if S[i-1] != S[i]:
        ans.append(S[i-1])
if S[-1] != S[-2]:
    ans.append(S[-1])
if len(set(S)) == 1:
    ans.append(S[0])
print(len(ans))


### FIXED CODE ###

N = int(input())
S = input()

ans = [S[0]]
for i in range(1, N):
    curr = S[i]
    if ans[-1] != curr:
        ans.append(curr)

print(len(ans))
import fractions
import collections
A, B = map(int, input().split())
tmp_list = collections.defaultdict(int)


def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass


def make_divisors(n):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            tmp_list[i] += 1
            if i != n // i:
                tmp_list[n//i] += 1


prime_list = primes(min(A, B))
ans = 1
for i in range(2, min(A, B)+1):
    if A % i == 0 and B % i == 0:
        if i in prime_list:
            ans += 1

print(ans)


### FIXED CODE ###

from math import sqrt, ceil
import fractions
A, B = map(int, input().split())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


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)

    return divisors


ans = 1

tmp = make_divisors(fractions.gcd(A, B))

for x in tmp:
    if is_prime(x):
        ans += 1

print(ans)
A, B, C = sorted(map(int, input().split()))

def calculate(P, Q, R):
    num = 0
    if abs(P - Q) % 2 == 0:
        num += abs(P - Q) // 2
    else:
        num += 1 + (abs(P - Q) + 1) // 2
        P += 1
        R += 1

    if abs(P - R) % 2 == 0:
        num += abs(P - R) // 2
    else:
        num += 1 + (abs(P - R) + 1) // 2

    return num

ans = min(calculate(C, B, A), calculate(C, A, B), calculate(B, A, C))

print(ans)

### FIXED CODE ###

S = input()
if len(S) == 3 and "a" in S and "b" in S and "c" in S:
    print("Yes")
else:
    print("No")