Harryxun/stf_run huggingface dataset:
import numpy as np
import math

buf=input().split(" ")

N=int(buf[0])
D=int(buf[1])

arr = np.empty((0,D), int)

for i in range(N):
  buf=input().split(" ")
  buf = [int(s) for s in buf]

  arr=np.append(arr, [buf], axis=0)
  

buf=0
c=0

for i in range(N):
  for j in range(N):
    if i<j:
      for k in range(D):
        buf=math.sqrt(abs((arr[k:i]-arr[k:j])*(arr[k:i]-arr[k:j])))
        if buf.is_integer() == True:
          c=c+1
          
print(c)

### FIXED CODE ###

import numpy as np
import math

buf=input().split(" ")

N=int(buf[0])
D=int(buf[1])

arr = np.empty((0,D), int)

for i in range(N):
  buf=input().split(" ")
  buf = [int(s) for s in buf]

  arr=np.append(arr, [buf], axis=0)
  

buf=0
c=0

for i in range(N):
  for j in range(N):
    if i<j:
      for k in range(D):
        buf=abs((arr[i,k]-arr[j,k])*(arr[i,k]-arr[j,k]))+buf
      buf=math.sqrt(buf)
      if buf.is_integer() == True:
        c=c+1
      buf=0
          
print(c)
N = int(input())
 
ABI = sorted(((a, i) for i, a in enumerate(A, 1)), reverse=True)
prev = [0]
for k, (a,i) in enumerate(ABI):
  curr = [0]*(k+2)
  for l in range(k+1):
    curr[l] = max(curr[l], prev[l]+abs(N-i-k+l)*a)
    curr[l+1] = prev[l]+abs(i-l-1)*a
    
  prev = curr
 
print(max(prev))

### FIXED CODE ###

N = int(input())
A = [int(s) for s in input().split(" ")]
ABI = sorted(((a, i) for i, a in enumerate(A, 1)), reverse=True)
prev = [0]
for k, (a,i) in enumerate(ABI):
  curr = [0]*(k+2)
  for l in range(k+1):
    curr[l] = max(curr[l], prev[l]+abs(N-i-k+l)*a)
    curr[l+1] = prev[l]+abs(i-l-1)*a
    
  prev = curr
 
print(max(prev))
a = input()
 
if str.isupper(a):
  print("A")
else :
  ptint("a")

### FIXED CODE ###

a = input()
 
if str.isupper(a):
  print('A')
else :
  print('a')
N = int(input())
res = 0
while N > 0:
  x,u = map(int, input().split())
  res += x if u == 'JPY' else x*380000
  
  N -= 1
print(res)

### FIXED CODE ###

n = int(input())
jpy = 0
btc = 0
for i in range(n):
    num,cur_t = input().split()
    if cur_t =='JPY':
        jpy += int(num)
    else:
        btc += float(num)
print(jpy+btc*38*10**4)
A = [int(input()) for i in range(3)]

ans = sum(A) - max(A)
print(ans)


### FIXED CODE ###

A = list(map(int, input().split()))
ans = sum(A) - max(A)
print(ans)
(n,l)=map(int, input().split())
list1=list(input().split())
for i in range(n):
	print(list1[i],end="")

### FIXED CODE ###

[a,b,c]=map(int, input().split())
list1=[a,b,c]
list1.sort()
if list1==[5,5,7]:
	print("YES")
else:print("NO")
def main():
    N, M = map(int, input().split())
    lst = list(map(int, input().split()))
    mapk = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
    
    dp = [0 for _ in range(N+1)] # ちょうどi本使ったときの最大桁数
    for i in range(1, N+1):
        tmp = []
        for k in lst:
            if (i-mapk[k])>=0:
                tmp.append(dp[i-mapk[k]] + 1)
            else:
                tmp.append(-float('inf'))
        dp[i] = max(tmp)
    #print(dp)
    
    ans = ''
    X = N
    lst = sorted(lst, reverse=True)
    for _ in range(dp[N]):
        for k in lst:
            if dp[X - mapk[k]] == dp[X] - 1:
                ans += str(k)
                X -= mapk[k]
                break
    print(ans)
main()

### FIXED CODE ###

def main():
    N, M = map(int, input().split())
    lst = list(map(int, input().split()))
    mapk = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
    
    dp = [0 for _ in range(N+1)] # ちょうどi本使ったときの最大桁数
    for i in range(1, N+1):
        tmp = []
        for k in lst:
            if (i-mapk[k])>=0:
                tmp.append(dp[i-mapk[k]] + 1)
            else:
                tmp.append(-float('inf'))
        dp[i] = max(tmp)
    #print(dp)
    
    ans = ''
    X = N
    lst = sorted(lst, reverse=True)
    for _ in range(dp[N]):
        for k in lst:
            if (X-mapk[k]>=0) and (dp[X - mapk[k]] == dp[X] - 1):
                ans += str(k)
                X -= mapk[k]
                break
    print(ans)
main()
n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n-1):
  a, b, c = map(int, input().split())
  a-=1
  b-=1
  graph[a].append((b, c))
  graph[b].append((a, c))
q, k = map(int, input().split())
xy = []
for _ in range(q):
  x, y = map(int, input().split())
  xy.append((x-1, y-1))

k-=1
seen = [False]*n
l = [0]*n
def DFS(node, length):
  l[node] = length
  seen[node] = True
  for i, j in graph[node]:
    if seen[i]:
      continue
    DFS(i, length+j)
DFS(k, 0)
for x, y in xy:
  print(l[x]+l[y])

### FIXED CODE ###

import sys
n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n-1):
    a, b, c = map(int, input().split())
    a-=1
    b-=1
    graph[a].append((b, c))
    graph[b].append((a, c))
q, k = map(int, input().split())
k -= 1
xy = []
for _ in range(q):
    x, y = map(int, input().split())
    x-=1
    y-=1
    xy.append((x, y))

def DFS(node, p_node, length):
    l[node] = length
    for i, j in graph[node]:
        if i==p_node:
            continue
        DFS(i, node, length+j)
sys.setrecursionlimit(2 * n)
l = [0]*n
DFS(k, -1, 0)
for x, y in xy:
    print(l[x]+l[y])
n=int(input())
a=[tuple(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans += 

### FIXED CODE ###

n=int(input())
a=[tuple(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans += ((a[i][0] - a[j][0])**2 +(a[i][1] - a[j][1])**2 )**0.5
    
print(ans / n*2)
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef long long ll;

void solve() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    sort(a.begin(), a.end());
    int n = a[N - 1], k = n / 2;
    cout << n << " ";
    auto i = lower_bound(a.begin(), a.end(), k);
    if (*(i + 1) - k < k - *i) cout << *(i + 1) << endl;
    else cout << *i << endl;
    return;
}

int main() {
    solve();
}

### FIXED CODE ###

import bisect
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = a[-1] / 2
i = bisect.bisect(a, b)
if a[i] - b < b - a[i - 1]:
    print(a[-1], a[i])
else:
    print(a[-1], a[i - 1])
from collections import defaultdict, deque
from itertools import combinations

N, M, Q = map(int, input().split())
ABCD = [tuple(map(int, input().split())) for _ in range(Q)]

D = defaultdict(set)
for a, b, c, d in ABCD:
  D[b-1].add((a-1, c, d))

for j in range(N-1, 0, -1):
  for x, y in combinations(D[j], 2):
    if x[0] == y[0]:
      continue
    if x[0] > y[0]:
      x, y = y, x
    if x[1] > y[1]:
      for a, c, d in D[y[0]]:
        if a == x[0] and c == x[1] - y[1]:
          break
      else:
        D[y[0]].add((x[0], x[1] - y[1], 0))

for j in range(1, N):
  for a, c, d in D[y[0]]:
    if a == j-1 and c == 0:
      break
  else:
    D[j].add((j-1, 0, 0))

que = deque([([1], 0)])
ans = 0
while que:
  L, score = que.popleft()
  if len(L) == N:
    if score > ans:
      ans = score
  else:
    for a, c, d in D[len(L)]:
      l = L[a] + c
      if l <= M:
        que.append((L + [l], score + sum(d for a, c, d in D[len(L)] if l - L[a] == c)))
print(ans)

### FIXED CODE ###

from collections import defaultdict, deque
from itertools import combinations

N, M, Q = map(int, input().split())
ABCD = [tuple(map(int, input().split())) for _ in range(Q)]

D = defaultdict(dict)
for a, b, c, d in ABCD:
  D[b-1][(a-1, c)] = d

for j in range(N-1, 0, -1):
  for x, y in combinations(D[j], 2):
    if x[0] == y[0]:
      continue
    if x[0] > y[0]:
      x, y = y, x
    if x[1] > y[1]:
      if (x[0], x[1] - y[1]) not in D[y[0]]:
        D[y[0]][(x[0], x[1] - y[1])] = 0

for j in range(1, N):
  if (j-1, 0) not in D[j]:
    D[j][(j-1, 0)] = 0

que = deque([([1], 0)])
memo = set([(1,)])
ans = 0
while que:
  L, score = que.popleft()
  if len(L) == N:
    if score > ans:
      ans = score
  else:
    for a, c in D[len(L)]:
      l = L[a] + c
      if L[-1] <= l <= M:
        x = tuple(L + [l])
        if x not in memo:
          memo.add(x)
          que.append((L + [l], score + sum(d for v, d in D[len(L)].items() if l - L[v[0]] == v[1])))
print(ans)
h, w, d = map(int, input().split())
a = []
for i in range(h):
    a+=list(map(int, input().split()))
n = len(a)
q = int(input())
max_dbl_line = 10

def dist(i, j):
    dw = abs(i%w - j%w)
    dh = abs(i//w - j//w)
    return dw + dh

idx_table = [0] * n
for i in range(n):
    idx_table[a[i]-1] = i

# ダブンリングテーブル作成
dbl = [[0] * n for i in range(max_dbl_line)]
tmp = []
for i in range(n):
    if a[i]+d in a:
        next_node = a.index(a[i]+d)-1
    else:
        next_node = -1
    if next_node!=-1:
        next_d = dist(idx_table[i], next_node)
    else:
        next_d = float('inf')
    tmp.append((next_node, next_d))
dbl[0] = tmp
for i in range(max_dbl_line-1):
    temp = []
    for j in range(n):
        next_node = dbl[i][dbl[i][j][0]][0]
        next_d = dbl[i][j][1]+dbl[i][dbl[i][j][0]][1]
        temp.append((next_node, next_d))
    dbl[i+1] = temp

def f(l, r):
    cnt = (r-l)//d
    ret = 0
    now = a.index(l)-1
    if cnt==0:
        return ret
    for i in range(max_dbl_line):
        if cnt & 1<<i:
            ret+=dbl[i][now][1]
            now = now + d*2**i
    return ret

for i in range(q):
    l, r = map(int, input().split())
    print(f(l,r))

### FIXED CODE ###

import sys
input = sys.stdin.readline

h, w, d = map(int, input().split())
n = h*w
a = [0]*n
for i in range(h):
    t = list(map(int, input().split()))
    for j in range(w):
        a[w*i+j] = t[j]-1

def dist(i, j):
    dh = abs(i//w - j//w)
    dw = abs(i%w - j%w)
    return dh + dw

idx_list = [0] * n
for i in range(n):
    idx_list[a[i]] = i

dist_list = [0]*n
for i in range(n):
    if i < d:
        dist_list[i] = 0
    else:
        dist_list[i] = dist_list[i-d] + dist(idx_list[i-d], idx_list[i])

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    l-=1; r-=1
    print(dist_list[r] - dist_list[l])
k, x = map(int, input().split())
for i in range(x-k+1 , x+k):
    print(i+' ', end='')


### FIXED CODE ###

k, x = map(int, input().split())
for i in range(x-k+1 , x+k):
    print(str(i)+' ', end='')
k=int(input())
s=input()

U=10**6+1
mod=10**9+7

fact=[1]*(U+1)
fact_inv=[1]*(U+1)

for i in range(1,U+1):
    fact[i]=(fact[i-1]*i)%mod
fact_inv[U]=pow(fact[U],mod-2,mod)

for i in range(U,0,-1):
	fact_inv[i-1]=(fact_inv[i]*i)%mod

def comb(n,k):
    if k<0 or k>n:
        return 0
    x=fact[n]
    x*=fact_inv[k]
    x%=mod
    x*=fact_inv[n-k]
    x%=mod
    return x
m=len(s)
ans=0
for i in range(k+1):
    ans=(ans+pow(25,i,mod)*comb(m+i-1,m-1)*pow(26,k-i,mod))%mod
print(ans)

### FIXED CODE ###

k=int(input())
s=input()

U=2*10**6+1
mod=10**9+7

fact=[1]*(U+1)
fact_inv=[1]*(U+1)

for i in range(1,U+1):
    fact[i]=(fact[i-1]*i)%mod
fact_inv[U]=pow(fact[U],mod-2,mod)

for i in range(U,0,-1):
	fact_inv[i-1]=(fact_inv[i]*i)%mod

def comb(n,k):
    if k<0 or k>n:
        return 0
    x=fact[n]
    x*=fact_inv[k]
    x%=mod
    x*=fact_inv[n-k]
    x%=mod
    return x
m=len(s)
ans=0
for i in range(k+1):
    ans=(ans+pow(25,i,mod)*comb(m+i-1,m-1)*pow(26,k-i,mod))%mod
print(ans)
a,b = input()

answer = "Odd"
if a*b%2 == 0:
  answer = "Even"
print(answer)

### FIXED CODE ###

a,b = input().split()
answer = "Odd"
if (int(a)*int(b)%2) == 0:
  answer = "Even"
print(answer)
a, b = input().split()

result = a * int(100 * b) // 100

print(result)

### FIXED CODE ###

import decimal

a, b = input().split()

a = int(a)
b = decimal.Decimal(b)

result = a * b

print(int(result))
def solve(N, T, A, ls_H):
    dosi = []
    titen = []
    titen1 = []
    ti = 100000
    for x in ls_H :
        do = T - x * 0.006
        dosi.append(do)
    #print(dosi)
    
    for y in dosi :
        ti = A - y
        titen.append(ti)
    #print(titen)
    
    for z in titen :
        titen1.append(abs(z))
    #print(titen1)
    
    for i in titen1 :
        if ti > i :
            ti = i
    #print(ti)
    return titen1.index(ti) + 1
 
 
def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    T = int(ws[0])
    A = int(ws[1])
    ws = sys.stdin.readline().strip().split()
    ls_H = list(map(int, ws))
    return (N, T, A, ls_H)
 
def main():
    print(solve(*readQuestion()))
 
# Uncomment before submission
main()

### FIXED CODE ###

import sys
 
def solve(N, T, A, ls_H):
    return min([(abs(A - (T - h * 0.006)), i) for (i, h) in enumerate(ls_H, start=1)])[1]
 
def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    ws = sys.stdin.readline().strip().split()
    T = int(ws[0])
    A = int(ws[1])
    ws = sys.stdin.readline().strip().split()
    ls_H = list(map(int, ws))
    return (N, T, A, ls_H)
 
def main():
    print(solve(*readQuestion()))
 
# Uncomment before submission
main()
N=int(input())
S=list(input())
T=list(input())  
sum=""
for i in range(n):
  sum= sum+s[i]+t[i]
print(sum)

### FIXED CODE ###

N=int(input())
S,T=input().split()
sum=""
for i in range(N):
  sum+=S[i]
  sum+=T[i]
print(sum)
a,b,c = input().split(/)
A = a + b + c
if A <= "20190430" :
    print("Heisei")
else :
    print("TBD")

### FIXED CODE ###

a,b,c = input().split("/")
A = a + b + c
if A <= "20190430" :
    print("Heisei")
else :
    print("TBD")
n , q = map(int, input().split())
r = [[]for i in range(n)]
s = [0]*n
v = [0]*n
for i in range(n-1):
    a , b = map(int, input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)
for i in range(q):
    p , x = map(int, input().split())
    s[p-1]+=x

def dfs(now):
    v[now]=1
    for i in r[now]:
        if v[i]==0:
            s[i]+=s[now]
            dfs(i)
dfs(0)
print(' '.join(list(map(str,s))))


### FIXED CODE ###

from collections import deque

n , q = map(int, input().split())
r = [[]for i in range(n)]
s = [0]*n
v = [0]*n
for i in range(n-1):
    a , b = map(int, input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)
for i in range(q):
    p , x = map(int, input().split())
    s[p-1]+=x
d= deque()
d.append(0)
def bfs(now):
    v[now]=1
    while d:
        i = d.popleft()
        for j in r[i]:
            if v[j]==0:
                s[j]+=s[i]
                v[j]=1
                d.append(j)
    return
bfs(0)
print(' '.join(list(map(str,s))))
S=int(input())
m=0
count=0
for s in S:
    if s in "A":count+=1
    elif s in "C":count+=1
    elif s in "G":count+=1
    elif s in "T":count+=1
    else:count=0
    m=max(m,count)
print(m)

### FIXED CODE ###

S=input()
m=0
count=0
for s in S:
    if s in "A":count+=1
    elif s in "C":count+=1
    elif s in "G":count+=1
    elif s in "T":count+=1
    else:count=0
    m=max(m,count)
print(m)
""" AtCoder """

A, s, C = map(int, input().split())

print('A' + s[0] + 'C')


### FIXED CODE ###

""" AtCoder """

A, s, C = input().split()

print('A' + s[0] + 'C')
h,w=map(int,input().split())
l=[]
n=0
m=0
cou=0
for i in range(h):
    x=input()
    if x==("."*w):
        cou+=1
        continue
    l.append(list(x))
for i in range(w):
    k=0
    for j in range(h-cou-1):
        if l[j][i]=="#":
            break
        else:
            k+=1
    if k==h-cou:
        for d in range(h-cou):
            del l[d][i]
for i in range(h-cou):
    l[i]="".join(l[i])
    print(l[i])



### FIXED CODE ###

g=[0]*5
for _ in range(3):
    a,b=map(int,input().split())
    g[a]+=1
    g[b]+=1
if g.count(1)==2:
    print("YES")
else:
    print("NO")
S = input()
N = len(S)+1
A = [0] * N
B = [0] * (N+1)

for i in range(N-1):
	if S[i] == '<':
		A[i+1] = A[i]+1
for i in range(N-2, -1, -1):
    if S[i] == '>':
        B[i+i] = B[i]+1

print(sum(A)+sum(B))


### FIXED CODE ###

s = input()
n = len(s)
dp = [0]*(n+1)
t = 0
for e,i in enumerate(s,1):
    if i=='<' :
        dp[e]=dp[e-1]+1
# print(dp)
t = 0
for e in range(n-1,-1,-1):
    i = s[e]
    # print(t)
    if i=='>' :
        dp[e]=max(dp[e],dp[e+1]+1)
# print(dp)
print(sum(dp))
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(int(10**5))

N = int(input())
a = [int(input()) - 1 for _ in range(N)[1:]]

children = [[] * N for i in range(N)]
for i in range(N)[:-1]:
    children[a[i]].append(i + 1)

def dfs(n):
    if children[n] == []:
        return 0
    dp = [dfs(child) for child in children[n]]
    dp.sort(reverse=True)
    return max(dp[i] + (i + 1) for i in range(len(dp)))

print(dfs(0))


### FIXED CODE ###

#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

N = int(input())

children = [[] * N for i in range(N)]
for i in range(N)[1:]:
    a = int(input()) - 1
    children[a].append(i)

def dfs(n):
    if children[n] == []:
        return 0
    dp = [dfs(child) for child in children[n]]
    dp.sort(reverse=True)
    return max(dp[i] + (i + 1) for i in range(len(dp)))

print(dfs(0))
Copy
Copy
N = int(input())
lst = []
for _ in range(N):
  d1, d2 = map(int, input().split(' '))
  lst.append((d1, d2))
  
idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = lst[idx]
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

### FIXED CODE ###

N = int(input())
lst = []
for _ in range(N):
  d1, d2 = map(int, input().split(' '))
  lst.append((d1, d2))
  
idx = 0
flag = False
while idx < N-2:
  cnt = 0
  for i in range(3):
    d1, d2 = lst[i+idx]
    if d1 == d2:
      cnt += 1
  if cnt == 3:
    flag = True
    break
  else:
    idx += 1
 
print('Yes' if flag else 'No')
N, M= (int(i) for i in input().split())

 ans = set(range(1,N+1))

 for i in range(M):
     L_tmp, R_tmp = map(int, input().split())
     ans = ans & set(range(L_tmp,R_tmp+1))

 print(len(ans))


### FIXED CODE ###

N, M= (int(i) for i in input().split())

L_max = 1
R_min = N

for i in range(M):
    L, R = map(int, input().split())
    L_max = max(L_max,L)
    R_min = min(R_min,R)

ans = set(range(L_max,R_min+1))

print(len(ans))
w,h,x,y,r=map(int,input().split())
if w-r>=x and h-r>=y


### FIXED CODE ###

w,h,x,y,r=map(int,input().split())
if w-r>=x and h-r>=y and x>=r and y>=r:
    print('Yes')
else:
    print('No')
def main():
    H, W, A, B = map(int, input().split())
    mod = 10**9 + 7
    ans = 0

    # 予め階乗を計算しておく
    f = [1]
    for i in range(H+W-B):
        f.append(f[i]*(i+1)%mod)

    # 組み合わせ関数
    def comb_mod(n, r, p):
        return f[n] * pow(f[r], p-2, p) * pow(f[n-r], p-2, p)

    for i in range(H-A):
        ans += (comb_mod(i+B-1,B-1,mod) * comb_mod(H-1-i+W-B-1,W-B-1,mod))%mod

    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    H, W, A, B = map(int, input().split())
    mod = 10**9 + 7
    ans = 0

    # 予め階乗を計算しておく
    f = [1]
    for i in range(H+W):
        f.append(f[i]*(i+1)%mod)

    # 組み合わせ関数
    def comb_mod(n, r, p):
        return f[n] * pow(f[r], p-2, p) * pow(f[n-r], p-2, p)

    for i in range(H-A):
        ans += comb_mod(i+B-1,B-1,mod) * comb_mod(H-1-i+W-B-1,W-B-1,mod)

    print(ans%mod)

if __name__ == '__main__':
    main()
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = sorted(a)
    
    def seach(x):
        l = 0
        r = n - 1
        while True:
            i = (l + r) // 2
            if r - l <= 1:
                if b[r] == x:
                    return r
                else:
                    return l
            if b[i] < x:
                l = i
            elif f(i) > x:
                r = i
            else: 
                return i
    
    for i in range(n):
        j = seach(a[i])
        c = b[:j] + b[j+1:]
        print(c[n // 2 - 1])

        
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = sorted(a)
    
    for i in range(n):
        if a[i] <=  b[n // 2 - 1]:
            print(b[n // 2])
        elif a[i] >  b[n // 2 - 1]:
            print(b[n // 2 - 1])
        
        
if __name__ == '__main__':
    main()
from collections import Counter

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

v_odd[1::2]
v_even[0::2]

v_odd_mc = Counter(v_odd).most_common()
v_even_mc = Counter(v_even).most_common()

v_odd_mc.append((0, 0))
v_even_mc.append((0, 0))

if v_odd_mc[0] != v_even_mc[0]:
    print(n-v_odd_mc[0][1]-v_even_mc[0][1])
else:
    print(n - max(v_odd_mc[0][1] + v_even_mc[1][1], v_odd_mc[1][0]+v_even_mc[0][1]))

### FIXED CODE ###

from collections import Counter
 
n = int(input())
v_array = list(map(int,input().split()))
 
v_odd = v_array[0::2]
v_even = v_array[1::2]
 
v_odd_common = Counter(v_odd).most_common()
v_even_common = Counter(v_even).most_common()
 
v_odd_common.append((0,0))
v_even_common.append((0,0))
 
if v_odd_common[0] != v_even_common[0]:
    print(n-v_odd_common[0][1]-v_even_common[0][1])
else:
    print(min(n-v_odd_common[0][1]-v_even_common[1][1],n-v_odd_common[1][1]-v_even_common[0][1]))
x = int(input())

for a in range(1, x):
    for b in range(-a, a):
        if pow(a, 5) - pow(b, 5) == x:
            break
    if pow(a, 5) - pow(b, 5) == x:
         break
            
print(a, b)

### FIXED CODE ###

x = int(input())

for a in range(1, 120):
    for b in range(-a, a):
        if pow(a, 5) - pow(b, 5) == x:
            break
    if pow(a, 5) - pow(b, 5) == x:
         break
            
print(a, b)
import math
while True:
    n = int(input())
    if n == 0:
        break
    s = [int(i) for i in input().split(" ")]
    m = sum(s) / n
    print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2]) / n)

### FIXED CODE ###

import math
while True:
    n = int(input())
    if n == 0:
        break
    s = [int(i) for i in input().split(" ")]
    m = sum(s) / n
    print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2 for x in s]) / n)))
H, W, A, B = list(map(int, input().split()))
for _ in range(B):
    print('1' * A+ '0' * (W - A) )
for _ in range(H - B):
    print('0' * A + '1' * (W - A) )

### FIXED CODE ###

H, W, A, B = list(map(int, input().split()))
for _ in range(B):
    print('0' * A + '1' * (W - A))
for _ in range(H - B):
    print('1' * A + '0' * (W - A))
n=int(input())
l=list(map(int,input().split()))

s=sum(l)
m=0
i=0
while m<s//2:
    m+=l[i]
    i+=1

print(min(2*m-s,s-2*(m-l[i])))


### FIXED CODE ###

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

s=sum(l)
m=0
i=-1
while m<s//2:
    i+=1
    m+=l[i]
    


print(min(2*m-s,s-2*(m-l[i])))
s=input()
x,y=map(int,input().split())
xpossible=[0]
ypossible=[0]
j=0
while s[j]=='F':
  xpossible[0]+=1
  if j==len(s):
    break
counter=0
for i in range(j,len(s)):
  current=0
  while s[i]=='F':
    i+=1
    current+=1
    if i==len(s):
      break
  r=set()
  if counter==0:
    for j in xpossible:
      r.add(j+current)
      r.add(j-current)
    xpossible=[]
    for j in r:
      xpossible.append(j)
  else:
    for j in ypossible:
      r.add(j+current)
      r.add(j-current)
    ypossible=[]
    for j in r:
      ypossible.append(j)
  current=0
  while s[i]=='T':
    i+=1
    current+=1
    if i==len(s):
      break
  counter=(counter+current)%2
if x in xpossible and y in ypossible:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s=input()
x,y=map(int,input().split())
xpossible=[0]
ypossible=[0]
j=0
while s[j]=='F':
  j+=1
  xpossible[0]+=1
  if j==len(s):
    break
counter=0
i=j
while i<len(s):
  current=0
  while s[i]=='F':
    i+=1
    current+=1
    if i==len(s):
      break
  r=set()
  if counter==0:
    for j in xpossible:
      r.add(j+current)
      r.add(j-current)
    xpossible=[]
    for j in r:
      xpossible.append(j)
  else:
    for j in ypossible:
      r.add(j+current)
      r.add(j-current)
    ypossible=[]
    for j in r:
      ypossible.append(j)
  if i==len(s):
    break
  current=0
  while s[i]=='T':
    i+=1
    current+=1
    if i==len(s):
      break
  counter=(counter+current)%2
if x in xpossible and y in ypossible:
  print('Yes')
else:
  print('No')
a, b, c = map(int, input().split(' '))
N = int(input())
max_ = max([a, b, c]
print(a+b+c+max_**N-max_)

### FIXED CODE ###

a, b, c = list(map(int, input().split(' ')))
N = int(input())
max_ = max([a, b, c])
print(a+b+c+max_*(2**N)-max_)