Harryxun/stf_run huggingface dataset:
import collections

n = int(input())
vlist = list(map(int, input().split(" ")))

import collections
c = collections.Counter(vlist)

head = c.most_common()[0][0]
if c.most_common()[0][1] == n:
    foll = -1
else:
    foll = c.most_common()[1][0]


for i in range(len(vlist)):
    if vlist[i] == head:
        break
    if vlist[i] == foll:
        head, foll == foll, head
        break

count = 0
for i in range(len(vlist)):
    if i % 2 == 0 and vlist[i] != head:
        count += 1
    if i % 2 == 1 and vlist[i] != foll:
        count += 1

print(count)

### FIXED CODE ###

intput_ = list(input())
output = ""
for s_ in intput_:
  if s_ == '1':
    output += "9"
  elif s_ == '9':
    output += "1"
  else:
    output += s_

print(output)
def func():

    n = int(input())
    data = []
    for i in range(n):
        data.append(list(map(int,input().split())))

    for cx in range(101):
        for cy in range(101):
            for line in data:
                x = line[0]
                y = line[1]
                h = line[2]
                disx = x-cx
                disy = y-cy
                h1 = h + abs(disx) + abs(disy)
                if not h1 in dict:
                    dict[h1] = 0
                else:
                    dict[h1] += 1
                if h == 0:
                    for i in range(h1):
                        if not h1 in dict:
                            dict[h1] = 0
                        else:
                            dict[h1] += 1

                for key in dict.keys():
                    if dict[key] == n-1:
                        print(cx,end=" ")
                        print(cy,end=" ")
                        print(key)
                        return 0

func()



### FIXED CODE ###



def func():

    n = int(input())
    data = []
    for i in range(n):
        data.append(list(map(int,input().split())))

    for cx in range(101):
        for cy in range(101):
            for line in data:
                if line[2] != 0:
                    x = line[0]
                    y = line[1]
                    h = line[2]
                    H_max = h + abs(cx - x) + abs(cy - y)
                    break
            flag = True
            for i in range(n):
                    x = data[i][0]
                    y = data[i][1]
                    h = data[i][2]
                    if h != 0:
                        if not H_max == h + abs(cx-x) + abs(cy-y):
                            flag = False
                            break
                    else:
                        if not H_max <=  abs(cx-x) + abs(cy-y):
                            flag = False
                            break
            if flag:
                print(cx,cy,H_max)
                return 0

func()
import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * (110000)
def find(x):
    if root[x] >= 0:
        r = find(x)
    root[x] = r
    return r

def unite(a, b):
    a = find(a)
    b = find(b)
    if a != b:
        root[a] += root[b]
        root[b] = a
        

for _ in range(m):
    a, b = map(int, input().split())
    unite(a, b)

ans = 0
for i in range(1, n+1):
    if root[i]  < 0:
        ans += 1
print(ans-1)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n
def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]
    

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
        

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)

ans = len([i for i in root if i < 0]) - 1
print(ans)
r,g,b = map(int, input().split())


print("YES" if (g*10+b)%4===0 else "NO")

### FIXED CODE ###

r,g,a = map(int, input().split())


print("YES" if (g*10+a)%4==0 else "NO")
s=input()
def c(b):
  return b=='A' or b=='G' or b=='T' or b=='C'

suc=[]
ct=0
for let in s:
  if c(let):
    ct+=1
  else:
    suc.append(ct)
    suc=0
suc.append(ct)
print(max(suc))

### FIXED CODE ###

s=input()
def c(b):
  return b=='A' or b=='G' or b=='T' or b=='C'

suc=[]
ct=0
for let in s:
  if c(let):
    ct+=1
  else:
    suc.append(ct)
    ct=0
suc.append(ct)
print(max(suc))
n = int(input())
a = list(map(int, input().split()))
s, ans, i = 0, 0, 0
while a[i] == 0 and i < n:
    ans += 2
    i += 1
ans = max(0, ans - 1)
if i == n:
    print(ans)
    exit()

if ans > 0:
    if abs(a[i]) == 1:
        ans += 1
        s = a[i] // abs(a[i])
else:
    s = a[0]

i += 1
for j in range(i, n):
    if abs(a[j]) > abs(s) and a[j] // abs(a[j]) != s // abs(s):
        s += a[j]
    else:
        pre_s = s
        s = -1 * s // abs(s)
        ans += abs(a[j] - s + pre_s)

print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans1, ans2 = 0, 0
s = 0
plus = True
for i in range(n):
    if plus:
        if s + a[i] > 0:
            s += a[i]
        else:
            ans1 += abs(1 - (s + a[i]))
            s = 1
    if not plus:
        if s + a[i] < 0:
            s += a[i]
        else:
            ans1 += abs(-1 - (s + a[i]))
            s = -1
    plus = not plus

s = 0
plus = False
for i in range(n):
    if plus:
        if s + a[i] > 0:
            s += a[i]
        else:
            ans2 += abs(1 - (s + a[i]))
            s = 1
    if not plus:
        if s + a[i] < 0:
            s += a[i]
        else:
            ans2 += abs(-1 - (s + a[i]))
            s = -1
    plus = not plus
print(min(ans1, ans2))
def comp(ext,list0,dev):
    if list0[int((ext[0]+ext[1])/2)]>dev:
        return ext[0],int((ext[0]+ext[1])/2)
    else:
        return int((ext[0]+ext[1])/2),ext[1]


def bis(a,b,list0,dev):
    ls=[a,b]
    while ls[0]+1<ls[1]:
        ls=comp(ls,list0,dev)
    if list0[ls[0]]==dev:
        return ls[0]-1
    elif list0[ls[1]]==dev:
        return ls[1]-1
    else:
        return ls[0]


n=int(input())
l=[int(x) for x in input().split()]
l.sort()
s=0
for a in range(0,n-2):
    for b in range(a+1,n-1):
        if l[a]+l[b]>l[n-1]:
            c=n-1
        elif l[a]+l[b]<l[b+1]:
            c=b
        else:
            c=bis(b+1,n-1,l,l[a]+l[b])
        s=s+c-b
print(s)

### FIXED CODE ###

def bis_right(lis,dev):
    a=0
    b=len(lis)-1
    while a<b:
        c=(a+b)//2
        if lis[c]>dev:
            b=c
        else:
            a=c+1
    if lis[a]<=dev:
        return a
    return a-1



n=int(input())
l=[int(x) for x in input().split()]
l.sort()
s=0
for a in range(n-2):
    for b in range(a+1,n-1):
        c=bis_right(l[b+1:],l[a]+l[b]-1)
        s+=c+1
print(s)
N = int(input())
l = [list(map(int,input().split())) for _ in range(N)]
for i in range(101):
    for j in range(101):
        H = set()
        for k in range(len(l)):
            x = l[k]
            h = abs(i - x[0]) + abs(j - x[1]) + x[2]
            if h >= 1:
              H.add(h)
       
        if len(H) == 1:
          for x in H:
            h = x
          for k in range(len(l)):
            x = l[k]
            f = True
            f *= x[3] == max(0,h - abs(i - x[0], abs(i - x[1]) )
        if f == True:
          print(i,j,h)

### FIXED CODE ###

N = int(input())
L = []
M = []
for _ in range(N):
    l = list(map(int,input().split()))
    if l[2] != 0:
        L.append(l)
    else:
        M.append(l)

for i in range(101):
    for j in range(101):
        tmp = -1
        for x in L:
            H = abs(x[0]-i) + abs(x[1]-j) + x[2]
            if H < 1:
                break
            if tmp != -1 and tmp != H:
                break
            else:
                tmp = H
        else:
            for x in L:
                if x[2]==max(0,H-abs(x[0]-i)-abs(x[1]-j)):
                    pass
                else:
                    break
            else:
                for x in M:
                    if x[2]==max(0,H-abs(x[0]-i)-abs(x[1]-j)):
                        pass
                    else:
                        break
                else:
                    print(i,j,H)
n = int(input())
l = list(map(int, input().split()))


count = 0

for i in l:
    for j in l:
        for k in l:
            if l[i]+l[j]>l[k] & l[j]+l[k]>l[i] & l[k]+l[i]>l[j] & l[i!=j!=k:
                    count += 1

print(count)

### FIXED CODE ###

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

count = 0

for i in range(0,n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j] and l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k]:
                count += 1
                
print(count)
import sys
list=[]
for i in sys.stdin.readlines():
    if int(i) != 0:
        list.append(int(i))
    else:
        print list.pop()

### FIXED CODE ###

import sys
list=[]
for i in sys.stdin:
    if i.strip() != '0':
        list.append(i.strip())
    else:
        print list.pop()
from sys import stdin
import re
import bisect
import numpy as np

n, k = map(int(), stdin.readline().rstrip().split())
data = np.zeros((n,k),dtype=bool)
for i in range(k):
    _ = stdin.readline()
    line = map(int(), stdin.readline().rstrip().split())
    for j in line:
        data[i][j] = True

count = int(0)
for i in range(n):
    if (data.T[n]).all() == True:
        count += 1
print(count)

### FIXED CODE ###

from sys import stdin
import re
import bisect
import numpy as np

N, K = map(int, stdin.readline().rstrip().split())
frag = np.zeros((K,N), dtype=bool)
for i in range(K):
    _ = stdin.readline()
    line = map(int, stdin.readline().rstrip().split())
    for j in line:
        j -= 1
        frag[i][j] = True
        
count = int(0)
frag = frag.T
for i in range(N):
    if np.count_nonzero(frag[i] == 1) == 0:
        count += 1
print(count)
import math

n,x=map(int,input().split())
l=[abs(c-x) for c in list(map(int,input().split()))]
l.append(math.gcd(l[0],l[1]))
for x in range(n-2):
	l.append(math.gcd(l[-1],l[x+2]))
print(l[-1])

### FIXED CODE ###

def gcd(a,b):
        while b:
            a,b=b,a%b
        return a
def solve(lis,x):
    if len(lis)==1:
        return abs(lis[0]-x)
    lis=[abs(c-x) for c in lis]
    ans=gcd(lis[0],lis[1])
    for x in lis[2:]:
        if x!=0:
            ans=gcd(ans,x)
    return ans 
n,x=map(int,input().split())
l=list(map(int,input().split()))
print(solve(l,x))
N, u, v = (int(i) for i in input().split())
adj=[]
for i in range(N+1):adj.append([])
for i in range(N-1):
	a,b = map(int,input().split())
	adj[a]+=[b]
	adj[b]+=[a]
	
prof = [0]*(N+1)
haut = [0]*(N+1)
parent = [-1]*(N+1)

def enraciner(sommet):
	for s in adj[sommet]:
		if s!=parent[sommet]:
			parent[s] = sommet
			prof[s] = 1+prof[sommet]
			enraciner(s)
	haut[sommet] = 1
	# ~ tmp = [haut[s]for s in adj[sommet] if s!=parent[sommet]]
	# ~ if tmp: haut[sommet]+=max(tmp)

enraciner(v)

# ~ print("parent",parent)
# ~ print("haut",haut)
# ~ print("prof",prof)

ans = 0

#montee
pu = prof[u]
pv = prof[v]
m = (pu - pv -1)//2
pu-=m
pv+=m
# ~ print("m",m)
ans+=m
for i in range(m):
	u = parent[u]

mx = 0
if len(adj[u])>1:mx = max(haut[i] for i in adj[u] if i!= parent[u])
# ~ print("mx",mx)
ans+= mx

last = (pu-pv)//2
# ~ print("last",last)
ans+=last

print(ans)



### FIXED CODE ###

N, u, v = (int(i) for i in input().split())
adj=[]
for i in range(N+1):adj.append([])
for i in range(N-1):
	a,b = map(int,input().split())
	adj[a]+=[b]
	adj[b]+=[a]

def distances(sommet):
	d = [-1]*(N+1)
	File = [sommet]
	d[sommet] = 0
	while File:
		s = File.pop()
		for x in adj[s]:
			if d[x]==-1:
				d[x] = 1+d[s]
				File.append(x)
	return d


t = distances(u)
a = distances(v)

# ~ print(t)
# ~ print(a)

ans = -1
for i in range(1,N+1):
	if t[i]<a[i]:
		ans = max(ans, a[i]-1)
		
print(ans)
#!/usr/bin/env python3

import math, itertools, operator
from math import *
from math import factorial as fact
from functools import reduce
from statistics import mean, median, median_low, median_high, mode
# Before Python 3.5
from fractions import gcd
#import numpy
#import scipy, scipy.special
#from sympy import isprime, nextprime
#from sympy.ntheory import factorint

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(inp = input, sep = ' ', conv = int):
    return map(conv, inp().split(sep = sep))

################################################################################

N = input_ints()
H = input_ints()

curmax = -inf
cnt = 0
for Hi in H:
    if curmax <= Hi:
        cnt += 1
        curmax = Hi
print(cnt)


### FIXED CODE ###

#!/usr/bin/env python3

import math, itertools, operator
from math import *
from math import factorial as fact
from functools import reduce
from statistics import mean, median, median_low, median_high, mode
# Before Python 3.5
from fractions import gcd
#import numpy
#import scipy, scipy.special
#from sympy import isprime, nextprime
#from sympy.ntheory import factorint

inf = float('inf')

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(inp = input, sep = ' ', conv = int):
    return map(conv, inp().split(sep = sep))

################################################################################

N = input_ints()
H = input_ints()

curmax = -inf
cnt = 0
for Hi in H:
    if curmax <= Hi:
        cnt += 1
        curmax = Hi
print(cnt)
import math

h,w,k = map(int,input().split())
s = [str(input()) for i in range(h)]
ans = h * w

if h == 1:
    onecnt = 0
    for i in range(w):
        if s[0][i] == "1":
            onecnt += 1
    print(math.ceil(onecnt/k))
    exit()

for i in range(2 ** (h-1)):
    ss = str(format(i,"b").zfill(h-1))
    cnt = 0
    zerocnt = 0
    for j in range(len(ss)):
        if ss[j] == "0":
            zerocnt += 1
    now = [0 for i in range(zerocnt+1)]
    for j in range(w):
        next = []
        num = 0
        for n in range(h):
            if s[n][j] == "1":
                num += 1
            if num > k:
                break
            if n < h-1 and ss[n] == "0":
                next.append(num)
                num = 0
        next.append(num)
  #        print(next,now)
        for n in range(zerocnt+1):
            if now[n] + next[n] > k:
                now = next
                cnt += 1
                break
            else:
                now[n] += next[n]
  #    print(now)
  #    print(ans,cnt,zerocnt)
    ans = min(ans,cnt+zerocnt)
print(ans)



### FIXED CODE ###

n,m = map(int,input().split())
print((n*(n-1))//2+(m*(m-1))//2)
import sys
input = sys.stdin.readline
n,m = map(int, input().split())
a = list(map(int,input().split()))
D = []
idx = 0
j = 0
for _ in range(m):
    b,c = map(int, input().split())
    D += [c]*b
D.sort(reverse=True)
for i in range(n):
    if a[i] < D[j]:
        a[i] < D[j]
        j += 1

print(sum(a[idx:]))

### FIXED CODE ###

from heapq import heappop, heappush


n,m = map(int,input().split())
A = list(map(int,input().split()))
pq = []
ans = 0

for a in A:
    heappush(pq, [-a, 1])
    
for _ in range(m):
    b,c = map(int,input().split())
    heappush(pq, [-c, b])

for i in range(n):
    c,b = heappop(pq)
    c = -c
    ans += c
    if b > 1:
        b -= 1
        heappush(pq, [-c, b])
        
print(ans)
a,b=map(int,input().split())
d=a//b
r=a%b
f=a/b
print(d r f)

### FIXED CODE ###

a,b=map(int, input().split())
print(a//b, a%b, "{0:.5f}".format(a/b))
a=input()
c=int(a)
b=input()
d=int(b)
  
if a*b%2=0:
    print('Even')
else:
    print('Odd')

### FIXED CODE ###

def main():
    a, b = [int(_) for _ in input().split()]
    print("Even") if a * b % 2 == 0 else print("Odd")

main()
T = list(input())

for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i and T[i-1] == "P":
      T[i] = "D"
    elif T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif T[i+1] == "D":
      T[i] = "P"
      
print("".join(T))
  

### FIXED CODE ###

T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i and T[i-1] == "P":
      T[i] = "D"
    elif i < len(T)-1 and T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif i < len(T)-1 and T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))
from scipy.sparse.csgraph import floyd_warshall as wf
n=int(input())
s=[list(map(float,input().split()))for i in range(n)]
a=wf(s,directed=False).tolist()
if s!=a:
    print(-1)
else:
    c=0
    for i in range(n-1):
        for j in range(i+1,n):
            for d in range(n):
                if d!=i and d!=j:
                    if s[i][j]>=s[i][d]+s[d][j]:
                        break
            else:
                c+=int(s[i][j])
print(c)

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import floyd_warshall as wf
n=int(input())
s=np.array([list(map(int,input().split()))for i in range(n)])
if np.any(s!=wf(s,directed=False)):
    print(-1)
else:
    c=0
    for i in range(n):
        s[i][i]=10**10
    for i in range(n):
        for j in range(i+1,n):
            d=np.min(s[i]+s[j])
            if s[i,j]!=d:
                c+=s[i,j]
    else:
        print(c)
import itertools

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


combi = []
perm = []

# 1からn桁の[1, 2]の数字の組み合わせのうち合計値がnになるものをcombiに代入
for i in range(n / 2, n + 1):
    tmp_combi = list(itertools.combinations_with_replacement([1, 2], i))
    for c in (tmp_combi):
        if sum(c) == n:
            combi.append(c)

# combiの順列を作成しpermに入れる
# setを使いユニークにしている
# 1, 1, 2 -> 1 1 2, 1 2 1, 2 1 1
for c in combi:
    for p in list(set(list(itertools.permutations(c)))):
        perm.append(p)

# 順列1つずつに対しコストを計算して最小値をmin_costに代入
min_cost = 10 ** 10
for p in perm:
    cost = 0
    p = list(p)
    pos = p.pop(0)
    if pos != 1:
        continue
    for j in p:
        cost += abs(h[pos - 1] - h[pos + j - 1])
        pos += j
    if cost < min_cost:
        min_cost = cost

print(min_cost)

### FIXED CODE ###

N = int(input())
blank = 2
h = list(map(int,input().split())) + [0] * blank
INF = 10 ** 9 + 1
dp = [INF] * (N + blank)
dp[0] = 0
for i in range(N):
  dp[i + 1] = min(dp[i] + abs(h[i + 1] - h[i]), dp[i + 1])
  dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 2])
  
print(dp[N - 1])
n,k,x = (int(x) for x in input().split())
C = []
A = []
for i in range(n):
    list = [int(i) for i in input().split()]
    C.append(list[0])
    A.append(list[1:])
case = [0]*(2**n)
chk = []
for i in range(2**n):
    chk.append([0]*m)

for i in range(2 ** n):
    for j in range(n):  
        if ((i >> j) & 1):  
            case[i] += C[j]
            for l in range(m):
                chk[i][l] += A[j][l]

ans = []
flag = [True]*(2**n)
for i in range(2**n):
    for j in range(m):
        if chk[i][j]<x:
            flag[i] = False
    if flag[i]:
        ans.append(case[i])

if ans==[]:
    print(-1)
else:
    print(min(ans))


### FIXED CODE ###

n,m,x = (int(x) for x in input().split())
C = []
A = []
for i in range(n):
    list = [int(i) for i in input().split()]
    C.append(list[0])
    A.append(list[1:])
i = 0
case = [0]*(2**n)
chk = []
for i in range(2**n):
    chk.append([0]*m)
i = 0
for i in range(2 ** n):
    for j in range(n):
        if ((i >> j) & 1):
            case[i] += C[j]
            for l in range(m):
                chk[i][l] += A[j][l]
i = 0
j = 0
ans = []
flag = [True]*(2**n)
for i in range(2**n):
    for j in range(m):
        if chk[i][j]<x:
            flag[i] = False
    if flag[i]:
        ans.append(case[i])

if ans==[]:
    print(-1)
else:
    print(min(ans))
import itertools


def main():
    length = {}
    v = set()
    d = {}

    N, M, R = list(map(int, input().split(' ')))

    r = [int(a) for a in input().split()]

    for _ in range(M):
        a, b, c = list(map(int, input().split(' ')))
        length[(a, b)] = c
        length[(b, a)] = c
        v.add(a)
        v.add(b)
        length[(a, a)] = 0
        length[(b, b)] = 0

    res = float('inf')

    v = list(v)

    for a in v:
        for b in v:
            for c in v:
                length[(b, c)] = min([length[(b, c)], length[(b, a)]+length[(a, c)]])

    # print(length)

    for perm in itertools.permutations(r):
        a = 0
        for i in range(len(perm)-1):
            a += length[(perm[i], perm[i+1])]
        if a < res:
            # print(perm, a)
            res = a

    print(res)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import itertools
import sys

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

def read_int_list():
    return list(map(int, readline().split()))

def read_int():
    return int(readline())

def main():
    N, M, R = map(int, input().split())
    r = map(int, input().split())

    inf = float("inf")
    d = [[inf] * (N + 1) for _ in range(N + 1)]
    for n in range(1, N + 1):
        d[n][n] = 0

    for _ in range(M):
        a, b, c = map(int, input().split())
        d[a][b] = c
        d[b][a] = c

    for k in range(1, N + 1):
        for i in range(1, N + 1):
            for j in range(1, N + 1):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]

    min_cost = inf
    for p in itertools.permutations(r):
        cost = 0
        for i in range(len(p) - 1):
            src, dst = p[i:i + 2]
            cost += d[src][dst]
        min_cost = min(min_cost, cost)

    print(min_cost)


if __name__ == '__main__':
    main()
A,B,X=map(int, input().split())
C=2*X/(A*B)
if C<=A:
    math.atan(B/C)*(180)/math.pi
    C=2*X/(A*B)
    print(math.atan(B/C)*(180)/math.pi)
else:
    C=2*Y/(A*A)
    Y=A*A*B-X
    C=2*Y/(A*A)
    print(math.atan(C/A)*(180)/math.pi)
    

### FIXED CODE ###

import math
A,B,X=map(int, input().split())
C=2*X/(A*B)
if C<=A:
    math.atan(B/C)*(180)/math.pi
    C=2*X/(A*B)
    print(math.atan(B/C)*(180)/math.pi)
else:
    Y=A*A*B-X
    C=2*Y/(A*A)
    
    C=2*Y/(A*A)
    print(math.atan(C/A)*(180)/math.pi)
def main():
	linie = input()
	vector = [int(x) for x in linie.split()]	
	x = vector[0]
	y = vector[1]
	h = vector[2]
	print(((x + y) * h) // 2)
 
if __name__ == "__main__":
	main()

### FIXED CODE ###


	
def main():	
	x = int(input())
	y = int(input())
	h = int(input())
	print(((x + y) * h) // 2)
 
if __name__ == "__main__":
	main()
tmp = Input()
ans = chr(ord(tmp) + 1)
print(ans)

### FIXED CODE ###

tmp = input()
ans = chr(ord(tmp) + 1)
print(ans)
S = input()
ans = True
for i in range(0,len(S),2):
  if S[i] != "h" or S[i+1] != "i":
    ans = False
    break

if ans:
  print("Yes")
else:
  print("No")
 


### FIXED CODE ###

S = input()
ans = True
for i in range(0,len(S)-1,2):
  if S[i] != "h" or S[i+1] != "i":
    ans = False
    break
if not ans or len(S)%2 == 1:
  print("No")
else:
  print("Yes")
N, M = map(int, input().split())
P = [input().split() for i in range(M)]

A=[int(P[0][0]), int(P[0][1])]

for i in range (1, M):
	if int(P[i][0]) <= A[1]:
		A[0] = max(A[0], int(P[i][0]))
		A[1] = min(A[1], int(P[i][1]))
	else:
		A=[]

if len(A) >0:
	choniki = list(range(A[0], A[1]+1))           
	print(len(choniki))
else:
	print(0)

### FIXED CODE ###

N, M = map(int, input().split())

P = [0]*(N+1)

for i in range (0, M):
	A, B = map(int, input().split())
	P[A-1]+=1
	P[B]-=1
    
for i in range (1, N+1):
	P[i]+=P[i-1]
    
P = sorted(P, reverse = True)

count = 0

for i in range (0, N+1):
	if P[i] == M:
		count+=1
	else:
		print(count)
		exit()
c = 0
while True:
    a = map(int, raw_input().split())
    if a == 0: break
    c += 1
    print 'Case %d: %d' %(c, a)

### FIXED CODE ###

c = 0
while True:
    a = int(raw_input())
    if a == 0: break
    c += 1
    print 'Case %d: %d' %(c, a)