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

arr = [ 0 for x in range ( 1000 +1 ) ] ;
for k in range ( 1 , len( arr  ) ) : 
	arr[k] += ( k * ( k + 1 ) ) / k / 2 ;

N , K = map( int , input().strip().split(" ") ) ; 
LL = list( map( int , input().strip().split(" " ) ) );

m = 0  ;
for r in range ( N ) :
	if r + K > N : break ;
	v = sum ( map ( lambda x:arr[x] , LL[r:r+K] ) ) ; 
	m = max ( m , v) ; 
print ( "{0:.8f}".format(  m ) ) ;

### FIXED CODE ###


N , K = map( int , input().strip().split(" ") ) ; 
LL = [] ;
for x in input().strip().split(" " ) :
	k = int(x ) ;
	LL.append(  ( k * ( k + 1 ) ) / k / 2 ) ;

LL2 = [] ;
LL2.append( LL[0] ) ;
for x in range ( 1 , len( LL ) ) :
	LL2.append( LL2[-1] + LL[x] ) ;



v0 = 0 ;
for x in range ( K-1 , N  ) : 
	d = 0. if x - K < 0 else LL2[x-K];
	v = LL2[x] -d ;
	v0 = max ( v , v0 ) ;
print ( "{0:.8f}".format(  v0 ) ) ;
### BUGGY CODE ###

N = [int(i) for i in input().split()]

answerList = []

for i in range(N[0]):
    count = 0
    for j in range(N[0] + 1):
        if j > i > 0:
            calculateList = [abs(j - i),
                             abs(abs(N[1] - i) + + 1 + abs(j - N[2])),
                             abs(abs(N[2] - i) + + 1 + abs(j - N[1]))]

            answerList.append(min(calculateList))

for i in range(N[0] - 1):
    print(answerList.count(i + 1))


### FIXED CODE ###

N = [int(i) for i in input().split()]

answerList = []

for i in range(N[0]):
    answerList.append(0)

for i in range(N[0]):
    if i > 0:
        for j in range(N[0]):
            if j + 1 > i > 0:
                calculateList = [abs(j + 1 - i),
                                 abs(N[1] - i) + 1 + abs(j + 1 - N[2]),
                                 abs(N[2] - i) + 1 + abs(j + 1 - N[1])]
                answer = min(calculateList)
                answerList[answer] = answerList[answer] + 1

for i in range(N[0] - 1):
    print(answerList[i + 1])
### BUGGY CODE ###

s = input()
target = input()
for index in range(len(s)):
    ss = s[index]
    tt = target[index]
	
    if s[:index] != target[:index] or s==target:
        break
    if ss == tt:
        continue
    else: #ssとttを相互変換する
        s = s.replace(ss,"0").replace(tt,ss).replace("0",tt)

if s == target:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from collections import Counter
s=sorted(Counter(input()).values())
t=sorted(Counter(input()).values())
print("Yes" if t==s else "No")
### BUGGY CODE ###

import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# # input = sys.stdin.readline.rstrip()
# sys.setrecursionlimit(10**8)
# mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
A = sorted(inpl())
B = sorted(inpl())
C = sorted(inpl())

ans = 0
d = defaultdict(int)
for b in B:
    d[b] = len(C[bisect.bisect_right(C,b):])
for a in A:
    for b in B[bisect.bisect_right(B,a):]:
        ans += d[b]

print(ans)

### FIXED CODE ###

import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
# mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
A = sorted(inpl())
B = sorted(inpl())
C = sorted(inpl())

ans = 0
for b in B:
    tmp = bisect.bisect_right(C,b)
    tmp2 = bisect.bisect_left(A,b)
    ans += (n-tmp) * tmp2

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

from collections import defaultdict
import heapq as hq
from itertools import permutations
def dijkstra(E, D, start,W):
    q = []
    V = [-1]*N
    V[start] = 0
    for i in range(start):
        V[i] = W[i][start]
        for e in E[i]:
            if e > start:
                hq.heappush(q, (V[i] + D[(i,e)], e))
    for e in E[start]:
        if V[e] == -1:
            hq.heappush(q, (D[start, e],e))
    # print(V, q)
    while q:
        d, v = hq.heappop(q)
        if V[v] >= 0:
            continue
        V[v] = d
        for e in E[v]:
            if V[e] == -1:
                hq.heappush(q, (D[v,e]+d, e))
    return V
N, M, r = map( int, input().split())
R = list( map( int, input().split()))
d = defaultdict( int)
E = [ [] for _ in range(N)]
for _ in range(M):
    a, b, c = map( int, input().split())
    a, b = a-1, b-1
    d[(a,b)] = d[(b,a)] = c
    E[a].append(b)
    E[b].append(a)
W = [ [-1]*N for i in range(N)]
for i in range(N):
    W[i] = dijkstra(E,d,i,W)
    # print(W)
ans = 10**9
for P in permutations( range(r)):
    now = R[P[0]]-1
    cans = 0
    for i in range(1,r):
        cans += W[now][R[P[i]]-1]
        now = R[P[i]]-1
    if cans < ans:
        ans = cans
print( ans)

### FIXED CODE ###

from collections import defaultdict
import heapq as hq
from itertools import permutations
def dijkstra(E, D, start,W):
    q = []
    V = [-1]*N
    V[start] = 0
    # for i in range(start):
    #     V[i] = W[i][start]
    #     for e in E[i]:
    #         if e > start:
    #             hq.heappush(q, (V[i] + D[(i,e)], e))
    for e in E[start]:
        if V[e] == -1:
            hq.heappush(q, (D[start, e],e))
    # print(V, q)
    while q:
        d, v = hq.heappop(q)
        if V[v] >= 0:
            continue
        V[v] = d
        for e in E[v]:
            if V[e] == -1:
                hq.heappush(q, (D[v,e]+d, e))
    return V
N, M, r = map( int, input().split())
R = list( map( int, input().split()))
d = defaultdict( int)
E = [ [] for _ in range(N)]
for _ in range(M):
    a, b, c = map( int, input().split())
    a, b = a-1, b-1
    d[(a,b)] = d[(b,a)] = c
    E[a].append(b)
    E[b].append(a)
W = [ [-1]*N for i in range(N)]
# for i in range(N):
#     W[i] = dijkstra(E,d,i,W)
    # print(W)
for i in range(r):
    W[R[i]-1] = dijkstra(E,d,R[i]-1,W)

ans = 10**9
for P in permutations( range(r)):
    now = R[P[0]]-1
    cans = 0
    for i in range(1,r):
        cans += W[now][R[P[i]]-1]
        now = R[P[i]]-1
    if cans < ans:
        ans = cans
print( ans)
### BUGGY CODE ###

#abc15047d
n=int(raw_input())
a=map(int,raw_input().split())
mod=10**9+7
res=0
for i in range(60):
 cnt=sum([1 for x in a if (x>>i & 1)])
 res+=cnt*(n-cnt)*(1<<i)
 res=res%mod
print res


### FIXED CODE ###

#abc15047d
n=int(raw_input())
a=map(int,raw_input().split())
mod=10**9+7
res=0
for i in range(60):
 cnt=sum([1 for x in a if (x>>i & 1)])
 res+=cnt*(n-cnt)*(1<<i)
 res=res%mod
print res
### BUGGY CODE ###

import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y


N,Q=LI()
TR=[[] for i in range(N+1)]
TR_score = [0] * (N+1)
RES = [-1]*(N+1)

for i in range(N-1):
    i,j=LI()
    TR[i].append(j)
    TR[j].append(i)

for i in range(Q):
    p, x = LI()
    TR_score[p] += x

ST = [(1, TR_score[1])]
while ST:
    i, score = ST.pop()
    RES[i] = score
    for j in TR[i]:
        if RES[j] == -1:
            ST.append((j, score + TR_score[j]))

for value in RES[1:-1]: print(value, end=" ")
print(RES[-1])


### FIXED CODE ###

import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y


N,Q=LI()
TR=[[] for i in range(N+1)]
TR_score = [0] * (N+1)
RES = [-1]*(N+1)

for i in range(N-1):
    i,j=LI()
    TR[i].append(j)
    TR[j].append(i)

for i in range(Q):
    p, x = LI()
    TR_score[p] += x

ST = [(1, TR_score[1])]
while ST:
    i, score = ST.pop()
    RES[i] = score
    for j in TR[i]:
        if RES[j] == -1:
            ST.append((j, score + TR_score[j]))

for value in RES[1:-1]: print(value, end=" ")
print(RES[-1])
### BUGGY CODE ###

n = int(input())
s = list(input())
r = 0
g = 0
b = 0

for c in s:
    if c == "R":
        r += 1
    if c == "G":
        g += 1
    if c == "B":
        b += 1
ans = r*g*b

for i in range(n):
    for j in range(i+1,n):
        k = 2*j - i
        if k > n-1:
            continue
        x = s[i]
        y = s[j]
        z = s[k]

        if x!= y and y != z and z != x:
            ans -= 1

print(ans)

### FIXED CODE ###

n = int(input())
s = list(input())
r = 0
g = 0
b = 0

for c in s:
    if c == "R":
        r += 1
    if c == "G":
        g += 1
    if c == "B":
        b += 1
ans = r*g*b

for i in range(n):
    for j in range(i+1,n):
        k = 2*j - i
        if k > n-1:
            continue
        x = s[i]
        y = s[j]
        z = s[k]
        if x!= y and y != z and z != x:
            ans -= 1

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

import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    AA = []
    for i in range(N):
        heapq.heappush(AA, A[i] * (-1))

    for i in range(M):
        maxaa = -1 * heapq.heappop(AA)
        if max(A) == 0:
            print("0")
            exit()
        heapq.heappush(AA,  maxaa // 2 * (-1))
    print(sum(AA) * (-1))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    for i in range(N):
        A[i] *= -1
    heapq.heapify(A)

    for i in range(M):
        maxa = -1 * heapq.heappop(A)
        if maxa == 0:
            print("0")
            exit()
        heapq.heappush(A,  maxa // 2 * (-1))
    print(sum(A) * (-1))


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

import fractions
import itertools

# nの約数をすべて求める
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

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

# 最大公約数gcd
gcd = fractions.gcd(A,B)
# 公約数=最大公倍数gcdの約数
cd = make_divisors(gcd)

# 公約数のすべての選び方
# i個取り出す場合
ans = 1 # 最低1つはある
for i in range(2,len(cd)+1):
    for comb in itertools.combinations(cd,i):
        # combから2つ取り出したものがすべて互いに素
        if all([fractions.gcd(*pair)==1 for pair in itertools.combinations(comb,2)]):
            ans = i
            break
        
print(ans)

### FIXED CODE ###

import fractions
import itertools

# nの約数をすべて求める
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

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

# 最大公約数gcd
gcd = fractions.gcd(A,B)
# 公約数=最大公倍数gcdの約数
cd = make_divisors(gcd)
cd = sorted(cd)

# 小さいものから1つずつ
ans = set()
for x in cd:    
    if len(ans) == 0:
        # 集合が空なら
        ans.add(x)
    else:
        # 集合のどの要素ともxが互いに素なら，追加
        if all([fractions.gcd(x,y)==1 for y in ans]):
            ans.add(x)

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

X=int(input())
for A in range(X):
  for B in range(-X,X):
    if A*A*A*A*A-B*B*B*B*B==X:
      print(A,B)
      exit()

### FIXED CODE ###

X=int(input())
for A in range(-120,120):
  for B in range(-120,120):
    if A**5-B**5==X:
      print(A,B)
      exit()
### BUGGY CODE ###

def main():
    n, a, b, c = map(int, input().split())
    arr = [int(input()) for i in range(n)]

    min_cost = float("inf")
    for i in range(1, 2 ** n):
        bin_i = "{:08b}".format(i)[::-1]
        arr_i = [arr[x] for x in range(n) if bin_i[x] == "1"]
        cost_i = (len(arr_i) - 1) * 10
        sum_i = sum(arr_i)
    
        for j in range(1, 2 ** n):
            bin_j = "{:08b}".format(j)[::-1]
    
            if any([x == "1" and y == "1" for x, y in zip(bin_i, bin_j)]):
                continue
    
            arr_j = [arr[x] for x in range(n) if bin_j[x] == "1"]
            cost_j = (len(arr_j) - 1) * 10
            sum_j = sum(arr_j)
    
            for k in range(1, 2 ** n):
                bin_k = "{:08b}".format(k)[::-1]
    
                if any([x == "1" and y == "1" for x, y in zip(bin_i, bin_k)]):
                    continue
    
                if any([x == "1" and y == "1" for x, y in zip(bin_j, bin_k)]):
                    continue
    
                arr_k = [arr[x] for x in range(n) if bin_k[x] == "1"]
    
                cost_k = (len(arr_k) - 1) * 10
                sum_k = sum(arr_k)
    
                cost = abs(sum_i - a) + abs(sum_j - b) + abs(sum_k - c) + cost_i + cost_j + cost_k
    
                if min_cost > cost:
                    min_cost = cost
    
    print(min_cost)


main()


### FIXED CODE ###

from itertools import product


def main():
    n, *target = map(int, input().split())
    arr = [int(input()) for i in range(n)]

    tests = product("0123", repeat=n)
    test_arr = [[] for _ in range(3)]
    min_cost = float("inf")

    for test in tests:
        cost = 0

        if "1" not in test or "2" not in test or "3" not in test:
            continue

        for i in range(3):
            test_arr[i] = [arr[x] for x in range(n) if test[x] == str(i + 1)]
            cost += (len(test_arr[i]) - 1) * 10
            cost += abs(sum(test_arr[i]) - target[i])

        if min_cost > cost:
            min_cost = cost

    print(min_cost)


main()
### BUGGY CODE ###

import sys
from collections import Counter
readline = sys.stdin.buffer.readline

n = int(readline())
a = Counter(map(int, readline().split()))
q = int(readline())
L = []
for i in range(q):
  L.append(list(map(int, readline().split())))

for b, c in L:
  # print(a)
  if b in a:
    a[c] += a[b]
    del a[b]
  print(sum(x * y for x, y in a.items()))



### FIXED CODE ###

import sys
from collections import Counter
readline = sys.stdin.buffer.readline
 
n = int(readline())
a = Counter(map(int, readline().split()))
q = int(readline())
L = []
for i in range(q):
  L.append(list(map(int, readline().split())))
 
s = sum(x * y for x, y in a.items())
for b, c in L:
  # print(a)
  if b in a:
    s += (c - b) * a[b]
    a[c] += a[b]
    del a[b]
  print(s)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
mod=10**6+3
n_max=mod
F,FI=[0]*(n_max+1),[0]*(n_max+1)
F[0],FI[0]=1,1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod
  FI[i+1]=pow(F[i+1],mod-2,mod)
for i in range(int(input())):
  x,d,n=map(int,input().split())
  print(((d**n)*F[(x*pow(d,mod-2,mod)+n-1)%mod]*FI[(x*pow(d,mod-2,mod)-1)%mod])%mod)


### FIXED CODE ###

import sys
input = sys.stdin.readline
mod=10**6+3
n_max=mod
F,FI=[0]*(n_max+1),[0]*(n_max+1)
F[0],FI[0]=1,1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod
  FI[i+1]=pow(F[i+1],mod-2,mod)
for i in range(int(input())):
  x,d,n=map(int,input().split())
  if d==0:
    print(pow(x,n,mod))
  else:
    s=(x*pow(d,mod-2,mod)-1)%mod
    if s+n>=mod:
      print(0)
    else:
      g=(x*pow(d,mod-2,mod)+n-1)%mod
      print(((pow(d,n,mod))*F[g]*FI[s])%mod)
### BUGGY CODE ###

n,m=map(int,input().split())
if m%n==0:
  print(m//n)
else:
  x=m//n
  for i in range(x,0,-1):
    if m%i==0 and m//i>=n:
      print(i)
      break

### FIXED CODE ###

n,m=map(int,input().split())
p=1
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    if m//i>=n:
      if i>=n:
        p=max(i,m//i,p)
      else:
        p=max(p,i)
print(p)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(4100000)

N = int(input())
a = list(map(int, input().split()))
b = []
for i in range(N, 0, -1):
  s = a[i - 1]
  if i * 2 <= N:
    s += sum([1 for k in range(2, N // i + 1) if i * k in b])
  if s % 2 == 1:
  	b.append(i)
print(len(b))
print(*b)


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
b = []
arr = [-1] * N
for i in range(N, 0, -1):
  s = 0
  j = i * 2
  while j <= N:
    s += arr[j - 1]
    j += i
  if s % 2 != a[i - 1]:
    arr[i - 1] = 1
    b.append(i)
  else:
    arr[i - 1] = 0
print(len(b))
print(*b)
### BUGGY CODE ###

import itertools
k,s = map(int,input().split())
c=0
for i in itertools.product(range(k+1), repeat=3):
    c += 1*(sum(i)==s)
print(c)

### FIXED CODE ###

k,s = map(int,input().split())
c=0
for i in range(k+1):
    for j in range(k+1):
         c += 1*(0 <= s - i -j <= k)
print(c)
### BUGGY CODE ###

N = int(input())
S = [list(input()) for _ in range(N)]
ans = 0

for A in range(N):
    sym = True
    for i in range(N):
        for j in range(i+1, N):
            if S[(i+A)%N][j] != S[(j+A)%N][i]:
                sym = False
                break
        else:
            continue
        break
    if sym:
        ans += N

print(ans)

### FIXED CODE ###

N = int(input())
S = [list(input()) for _ in range(N)]
#N = 300
#S = [["a"]*N for _ in range(N)]
ans = 0

for A in range(N):
    if all([S[(i+A)%N][j] == S[(j+A)%N][i] for i in range(N) for j in range(i+1, N)]):
        ans += N
print(ans)
### BUGGY CODE ###

import numpy as np

n = int(input())
h = np.array(list(map(int, input().split())))
ans = 0
loc = 0
for i in range(n-1):
    if h[i] > n - i - 1:
        continue
    diff = h[i]
    num = min(n, i + h[i] + 1)
    length = n - num
    t = np.count_nonzero((np.array(h[num:]) - np.arange(n - num) - 1))
    ans += length - t
print(ans)

### FIXED CODE ###

from collections import Counter

n = int(input())
h = list(map(int, input().split()))
a = []
b = []
for i in range(n):
    a.append(i + h[i])
    b.append(i - h[i])

x = Counter(a)
y = Counter(b)

z = set(a)
ans = 0
for i in z:
    ans += x[i] * y[i]

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

n,m,q=map(int,input().split())
Q=[list(map(int,input().split())) for i in range(q)]
ans=0
#めっちゃfor分あるならdfs
def dfs(d,s):
    global n,m,Q,ans
    if d==n-1:
        ans_=0
        for k in Q:
            a,b,c,d=k
            if int(s[b-1])-int(s[a-1])==c:
                ans_+=d
        ans=max(ans,ans_)
    else:
        l=int(s[-1])
        for i in range(l,m+1):
            dfs(d+1,s+str(i))
for i in range(1,m+1):
    dfs(0,str(i))

print(ans)

### FIXED CODE ###

n,m,q=map(int,input().split())
Q=[list(map(int,input().split())) for i in range(q)]
ans=0
#めっちゃfor分あるならdfs
R=[range(i,m) for i in range(m)]
def dfs(d,s):
    global n,m,Q,ans
    if d==n:
        ans_=0
        for k in Q:
            a,b,c,e=k
            if int(s[b-1])-int(s[a-1])==c:
                ans_+=e
        ans=max(ans,ans_)
    else:
        l=int(s[-1])
        for i in R[l]:
            dfs(d+1,s+str(i))
for i in R[0]:
    dfs(1,str(i))

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

import math

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

def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a

def primelist(n):
    P = [2]
    flag = 0
    for i in range(3,n+1,2):
        for j in range(len(P)):
            if math.sqrt(i) < P[j]:
                break
            else:
                if i%P[j] == 0:
                    flag += 1
                    break
        if flag == 0:
            P.append(i)
        flag = 0
    P.append(1)
    return(P)

def maxsoin(n):
    x = n
    i = 2
    prime_factors = []
    while x > 1:
      if x % i == 0:
        prime_factors.append(i)
        x = x / i
      else:
        i += 1
    result = max(prime_factors)
    return(result)

N=gcd(A,B)

if N==1:
    print(1)
else:
    ms = maxsoin(N)
    pl = primelist(ms)
#    print(N,ms,pl)
    ans=0
    for i in range(len(pl)):
        if N%pl[i]==0:
            ans+=1
    print(ans)

### FIXED CODE ###

import collections

def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a

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

A,B=map(int, input().split())
N=gcd(A,B)
c = collections.Counter(prime_factorize(N))
print(len(list(c.keys()))+1)
### BUGGY CODE ###

from itertools import product

N = int(input())
r = range(N)
A = [list(map(int, input().split())) for _ in r]

possible = True
ans = 0
for i,j in product(r, r) :
    for k in r:
        if k == i or k == j:
            continue
        if A[i][j] < A[i][k] + A[k][j]:
            continue
        elif A[i][j] == A[i][k] + A[k][j]:
            break
        else:
            possible = False
        break
    else:
        ans += A[i][j]
print(ans//2 if possible else -1)

### FIXED CODE ###

def main():
    inf=float("inf")
    n=int(input())
    alst=[list(map(int,input().split())) for _ in range(n)]
 
    for i in range(n):
        alst[i][i]=inf
 
    sm=0
    token=0
 
    for i in range(n):
        for j in range(i+1,n):
            for k in range(n):
                if alst[i][k]+alst[k][j]>alst[i][j]:
                    continue
                elif alst[i][k]+alst[k][j]==alst[i][j]:
                    break
                else:
                    token=1
                    break
            else :
                sm+=alst[i][j]
    
    if token : sm=-1
 
    print(sm)
 
main()
### BUGGY CODE ###

def leave_rewrite(vi_list):
    if len(set(vi_list)) > 1:
        sort_vi_list = sorted([(i, vi_list.count(i)) for i in set(vi_list)], key=lambda x: -x[1])
        return sort_vi_list[0][0], len(vi_list) - sort_vi_list[0][1], len(vi_list) - sort_vi_list[1][1]
    else:
        return vi_list[0], 0, 0

N = int(input())
v_list = input().split()

if len(set(v_list)) == 1:
    print(len(v_list) // 2)
    exit()

v1_list = v_list[::2]
v2_list = v_list[1::2]

l1_leave, rewrite_v1, second_v1 = leave_rewrite(v1_list)
l2_leave, rewrite_v2, second_v2 = leave_rewrite(v2_list)

if l1_leave != l2_leave:
    print(rewrite_v1 + rewrite_v2)
elif rewrite_v1 > rewrite_v2:
    print(rewrite_v2 + second_v1)
else:
    print(rewrite_v1 + second_v2)

### FIXED CODE ###

from collections import *

N = int(input())
v_list = input().split()

if len(set(v_list)) == 1:
    print(len(v_list) // 2)
    exit()

v1_list = v_list[::2]
v2_list = v_list[1::2]

v1_count_list = Counter(v1_list).most_common()
v2_count_list = Counter(v2_list).most_common()

if v1_count_list[0][0] != v2_count_list[0][0]:
    print(len(v_list) - v1_count_list[0][1] - v2_count_list[0][1])
else:
    countor1 = len(v_list) - v1_count_list[1][1] - v2_count_list[0][1]
    countor2 = len(v_list) - v1_count_list[0][1] - v2_count_list[1][1]
    print(min(countor1, countor2))