Harryxun/stf_run huggingface dataset:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

g = []
g.append(a)
g.append(b)
g.append(c)
g.append(d)
g.append(e)

G = []

A=a%10
B=b%10
C=c%10
D=d%10
E=e%10

G.append(A)
G.append(B)
G.append(C)
G.append(D)
G.append(E)

min_except0 = G

for i in range(4):
  min_except0.remove(0)

x = G.index(min(min_except0))

loop = [0,1,2,3,4]
loop.remove(x)

answer = 0
for i in loop:
  answer += g[i]
  answer += 10-G[i]
answer += g[x]

print(answer)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

g = []
g.append(a)
g.append(b)
g.append(c)
g.append(d)
g.append(e)

G = []

A=a%10
B=b%10
C=c%10
D=d%10
E=e%10

G.append(A)
G.append(B)
G.append(C)
G.append(D)
G.append(E)

min_except0 = G[:]

for i in range(4):
    try:
        min_except0.remove(0)
    except:
        pass
x = G.index(min(min_except0))

loop = [0,1,2,3,4]
loop.remove(x)

answer = 0
for i in loop:
  answer += g[i]
  answer += 10-G[i]
answer += g[x]

minas = 10*(5 - len(min_except0))

answer -= minas

print(answer)
x=int,input()

for v in range(x):
 for i in range(100000):
  print(Case i : v)

### FIXED CODE ###

i = 1

while True:

 x=int(input())
 if x==0:
  break
 print("Case {0}: {1}".format(i,x))
 i+=1
import sys
a,b=map(int,input().split())
if b==1:
  print("0")
  sys.exit()
p=1
ans=0
for i in range(0,20):
  p+=a-1
  ans+=1
  if p>=b:
    print(ans)
    sys.exit()

### FIXED CODE ###

s=input()
t=input()
count=0
for i in range(3):
  if s[i]==t[i]:
    count += 1
print(count)
S=list(input())
A=[0]*10
c=0
for i in range(10):
  if S[i]=="A" or S[i]=="G" or S[i]=="C" or S[i]=="T":
    A[c]+=1
  else:
    c+=1
print(max(A))

### FIXED CODE ###

S=list(input())
A=[0]*10
c=0
for i in range(len(S)):
  if S[i]=="A" or S[i]=="G" or S[i]=="C" or S[i]=="T":
    A[c]+=1
  else:
    c+=1
print(max(A))
a = y//4
if 2*(x-a)==y-4*a:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

x, y = map(int, input().split())
n = (4*x-y)/2
m = (y-2*x)/2
if y%2 ==1:
  print("No")
else:
  if n <0 or m <0:
    print("No")
  else:
    if n+m==x and 2*n+4*m==y:
      print("Yes")
    else:
      print("No")
N = int(input())
S = input()
max_shurui = 0
for n in range(1,N):
    X, Y = set(S[:n]), set(S[n:])
    max_shurui = max(len(X&Y), max_shurui)
print(max_shurui)

### FIXED CODE ###

A, B = map(int, input().split())
print(max(A+B, A-B, A*B))
M = 'abcdefghijklmnopqrstuvwxyz'
S = input()

if len(S) != 26:
    print(S + sorted(list(set(M) - set(S)))[0])
else:
    if S == 'zyxwvutsrqponmlkjihgfedcba':
        print(-1)
    else:
        for i in range(26):
            if S[i] != M[i]:
                if S[i] == 'z':
                    ans = S[: i - 1] + M[i]
                    break
                else:
                    ans = S[: i] +str(list(M)[list(M).index(S[i]) + 1])
                    break
        print(ans)

### FIXED CODE ###

S = input()
 
chars = "abcdefghijklmnopqrstuvwxyz"
char_set = set(chars)
 
if len(S) == 26:
    for i in range(len(S)-1, -1, -1):
        x = chars.index(S[i])
        y = sorted(set(chars[x+1:])-set(S[:i]))
        # print(i, y)
        if len(y):
            print(S[:i]+y[0])
            exit()
else:
    t = sorted(set(chars)-set(S))[0]
    print(S+t)
    exit()
print(-1)
# coding: utf-8
def calc(state, print_state):
  times = 0
  while "BW" in print_state:
      for i in range(len(state)):
          if state[i] == "B":
              if i < len(state)-1 and state[i+1] == "W":
                  state[i] = "W"
                  state[i+1] = "B"
                  times += 1
                  print_state = "".join(state)            
  print(times)
    
if __name__ == "__main__":
  start = time.time()
  state = list(input())
  print_state = "".join(state)
  calc(state, print_state)

### FIXED CODE ###

# coding: utf-8

s = list(input())
time = 0
count = 0
for i in range(len(s)):
  if s[i] == "W":
    time += i - count
    count += 1

print(time)
from functools import lru_cache

n = int(input())
x = input()
x10 = int(x, 2)
lenx = len(x)

maxbit = x.count("1")

box = [0] * (maxbit + 1)

@lru_cache(maxsize=None)
def f(i):
  cnt = 1
  while i > 0:
    if box[i] != 0:
      return box[i] + cnt
    i %= bin(i).count("1")
    cnt += 1
  return cnt

xlist = []

for i in range(lenx):
  if x[i] == "0":
    t = x10 + 2 ** (lenx - 1 - i)
  else:
    t = x10 - 2 ** (lenx - 1 - i)
  t %= (maxbit - 1) 
  ans = f(t)
  box[t] = ans
  print(ans)

### FIXED CODE ###

n = int(input())
x = input()
x10 = int(x, 2)
lenx = len(x)

maxbit = x.count("1")
xc0 = x10 % (maxbit + 1)
xc1 = x10 % (maxbit - 1) if maxbit > 1 else 0

def f(ii):
  cnt = 0
  while ii > 0:
    ii %= bin(ii).count("1")
    cnt += 1
  return cnt

for i in range(lenx):
  if x[i] == "0":
    t = xc0 + pow(2, (lenx - 1 - i), maxbit + 1)
    ans = f(t % (maxbit + 1)) + 1
  else:
    if maxbit - 1 == 0:
      ans = 0
    else:
      t = xc1 - pow(2, (lenx - 1 - i), maxbit - 1)
      ans = f(t % (maxbit - 1)) + 1
  print(ans)
from itertools import product
from collections import Counter


def solve():
    N = int(input())
    *D, = map(int, input().split())

    if N==1:
        print(D[0])
        return
    else:
        l, m = [], []
        for i, j in Counter(D).items():
            if j>=3 or ((i==0 or i==12) and j>=2):
                print(0)
            elif j==2:
                l.append(i)
            elif j==1:
                m.append(i)

    size = len(m)
    ans = 0

    for i in product(range(2), repeat=size):
        c = []
        for j, k in enumerate(i):
            if k:
                c.append(m[j])
            else:
                c.append(24-m[j])
        for j in l:
            c.append(j)
            c.append(24-j)

        v = 24
        for j in range(N):
            for k in range(j+1, N):
                v = min(v, abs(c[j]-c[k]))
        ans = max(ans, v)

    print(ans)


if __name__ == "__main__":
    solve()


### FIXED CODE ###

from itertools import product
from collections import Counter


def solve():
    N = int(input())
    *D, = map(int, input().split())

    l, m = [], []
    for i, j in Counter(D).items():
        if j>=3 or (i==12 and j>=2) or i==0:
            print(0)
            return
        elif j==2:
            l.append(i)
        elif j==1:
            m.append(i)

    size = len(m)
    ans = 0

    for i in product(range(2), repeat=size):
        c = []
        for j, k in enumerate(i):
            if k:
                c.append(m[j])
            else:
                c.append(24-m[j])
        for j in l:
            c.append(j)
            c.append(24-j)

        v = 24
        for j in c:
            d = min(j, 24-j)
            v = min(v, d)

        for j in range(N):
            for k in range(j+1, N):
                d = abs(c[j]-c[k])
                v = min(v, min(d, 24-d))
        ans = max(ans, v)

    print(ans)


if __name__ == "__main__":
    solve()
n = int(input())
a=list(map(int, input().split()))

tasug=[]
hikug=[]
for i in range(n):
  if a[i]<0:
    hikug.append(a[i])
  else:
    tasug.append(a[i])

if len(hikug)==0:
  tasug.sort()
  ans=sum(tasug)-2*tasug[0]
  print(ans)
  for i in range(len(tasug)-1):
    if i ==0:
      print(tasug[0],tasug[1])
      a=tasug[0]-tasug[i]
    elif i==1:
      continue
    else:
      print(a,tasug[i])
      a=a-tasug[i]
  if not n==2:
    print(tasug[len(tasug)-1],a)
  
  
elif len(tasug)==0:
  hikug.sort()
  ans=-sum(hikug)+2*hikug[n-1]
  print(ans)
  for i in range(n-1):
    if i ==0:
      a=hikug[n-1]

    print(a,hikug[i])
    a=a-hikug[i]

else:
  ans=sum(tasug)-sum(hikug)
  print(ans)
  for i in range(len(tasug)-1):
    if i ==0:
      print(hikug[0],tasug[i])
      a=hikug[0]-tasug[i]
    else:
      print(a,tasug[i])
      a=a-tasug[i]

  print(tasug[len(tasug)-1],a)
  a=tasug[len(tasug)-1]-a

  for i in range(1,len(hikug)):
    print(a,hikug[i])
    a=a-hikug[i]


  
  
  

### FIXED CODE ###

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

tasug=[]
hikug=[]
for i in range(n):
  if a[i]<0:
    hikug.append(a[i])
  else:
    tasug.append(a[i])

if len(hikug)==0:
  tasug.sort()
  ans=sum(tasug)-2*tasug[0]
  print(ans)
  for i in range(len(tasug)-1):
    if i ==0:
      print(tasug[0],tasug[1])
      a=tasug[0]-tasug[i]
    elif i==1:
      continue
    else:
      print(a,tasug[i])
      a=a-tasug[i]
  if not n==2:
    print(tasug[len(tasug)-1],a)
  
  
elif len(tasug)==0:
  hikug.sort()
  ans=-sum(hikug)+2*hikug[n-1]
  print(ans)
  for i in range(n-1):
    if i ==0:
      a=hikug[n-1]

    print(a,hikug[i])
    a=a-hikug[i]

else:
  ans=sum(tasug)-sum(hikug)
  print(ans)
  if len(tasug)==1:
    for i in range(len(hikug)):
      if i ==0:
        print(tasug[0],hikug[i])
        a=tasug[0]-hikug[i]
      else:
        print(a,hikug[i])
        a=a-hikug[i]
  else:
    for i in range(len(tasug)-1):
      if i ==0:
        print(hikug[0],tasug[i])
        a=hikug[0]-tasug[i]
      else:
        print(a,tasug[i])
        a=a-tasug[i]

    print(tasug[len(tasug)-1],a)
    a=tasug[len(tasug)-1]-a
  
    for i in range(1,len(hikug)):
      print(a,hikug[i])
      a=a-hikug[i]
X = int(input())
count = 0
money = 100

while money < X:
  money *= 1.01
  count++

print(count)


### FIXED CODE ###

X = int(input())
count = 0
money = 100

while True:
  money = int(money * 1.01)
  count += 1
  if money >= X:
    print(count)
    break
a = input()
b = input()
print  a*b + 2*(a+b) 

### FIXED CODE ###

w, h = map(int, raw_input().split(" "))
print w*h, 2*(w+h)
#! /usr/bin/env python3

alp = 'abcdefghijklmnopqrstuvwxyz'
S = input()
if S == alp[::-1]:
    print(-1)
else:
    if len(S) == len(alp):
        p = ''
        for i, j in zip(alp, S):
            if i != j : break
            p += i
        S = p

    for i in set(S) : alp = alp.replace(i, '')
    print(S+alp[0])

### FIXED CODE ###

#! /usr/bin/env python3

alp = 'abcdefghijklmnopqrstuvwxyz'
S = input()
if S == alp[::-1]:
    print(-1)
else:
    if len(S) == len(alp):
        l = list(S)
        s = []
        for i in range(1, len(S))[::-1]:
            s += [l[i]]
            r = sorted(x for x in s if x > l[i-1])
            if r:
                l = l[:i-1] + [r[0]]
                break
        print(''.join(l))
    else:
        for i in S : alp = alp.replace(i, '')
        print(S+alp[0])
S_list = list(map(int,input().split()))
n,a,b = S_list
print(min(n * a ,b)

### FIXED CODE ###

S_list = list(map(int,input().split()))
n,a,b = S_list
print(min(n * a ,b))
a,b=input().split()
k=(a+b)/2
g=(a+b)//2
if(k==g):
    print(k)
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

l=list(map(int,input().rstrip().split()))
a=l[0]
b=l[1]
k=(a+b)/2
g=int(k)
if(k==g):
    print(g)
else:
    print("IMPOSSIBLE")
N=int(input())
ans=1
def test(n):
    buf=0
    for i in range(1,n):
        if i**2 > n:
            break
        if i**2 == n:
            buf+=1
            break
        if n%i==0:
            buf+=2
    return buf

def ans(n):
    if n==2:
        return 1
    return test(n-1) + ans(n - 1)

print(ans(N))


### FIXED CODE ###

N=int(input())
def test(n):
    buf=0
    for i in range(1,n):
        if i**2 > n:
            break
        if i**2 == n:
            buf+=1
            break
        if n%i==0:
            buf+=2
    return buf

ans=0
for i in range(N-1):
    ans+=int((N-1)/(i+1))

print(ans)
import itertools
n = int(input())

a = []
xys = [[] for i in range(n)]

for j in range(n):
    a.append(int(input()))
    for i in range(a[j]):
        xys[j].append(list(map(int,input().split())))


ps = []
p = [0 for i in range(n)]
for i in range(n+1):
    for combi in itertools.combinations(range(n),i):
        p = [0 for i in range(n)]
        combi = list(combi)
        for i in combi:
            p[i] = 1
        ps.append(p)


for l in range(2**n):
    for i in range(n):
        if  (ps[l])[i] == 1:
            for j in range(a[i]):
                if ps[l][xys[i][j][0] - 1] != xys[i][j][1]:
                    ps[l] = [0,0,0]

print(max(sum(ps[l]) for l in range(2**n)))

### FIXED CODE ###

n = int(input())

a = []
xys = [[] for i in range(n)]

for j in range(n):
    a.append(int(input()))
    for i in range(a[j]):
        xys[j].append(list(map(int,input().split())))


ans = 0
for i in range(1,2**n):
    cont = True
    for j in range(n):
        if (i >> j) & 1 == 1:
            for x,y in xys[j]:
                if (i >> (x-1)) & 1 != y:
                    cont = False
                    break
        if not cont:
            break
    if cont:
        ans = max(ans,bin(i)[2:].count('1'))

print(ans)
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    ss=readline().rstrip()
    j=len(ss)
    ans=0
    for i in range(len(ss)):
        if ss[i]=="W":
            j-=1
            while ss[j]!="R":
                j-=1
            if j > i:
                ans+=1
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

### FIXED CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    ss=readline().rstrip()
    j=len(ss)
    ans=0
    if j==1:
        print(0)
        return
    for i in range(len(ss)):
        if ss[i]=="W":
            j-=1
            if j >= 0:
                while ss[j]!="R":
                    j-=1
                    if j < 0:
                        break
            if j > i:
                ans+=1
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl_int(): return list(map(int, input().split()))
def inpl_str(): return list(map(int, input().split()))

N = int(input())
aa = inpl_int()

i = 1
while True:
	if aa.count(i)==2:
		X1 = aa.index(i)
		aa[X1] = 0
		X2 = aa.index(i)
		break
	i += 1

L,R = X1,N-X2
ALL = 1


def Pascal(N):
	if N == 1:
		return [1]
	else:
		tb1 = [1,1]
		for i in range(2,N+1):
			tb2=[1]
			for j in range(1,i):
				tb2.append((tb1[j-1]+tb1[j])%mod)
			tb2.append(1)
			tb1 = tb2[:]
		return tb1

ALL = Pascal(N+1)
daburi = Pascal(L+R)


for i in range(1,N+2):
	if L+R+1 >= i:
		print(i,ALL[i]-daburi[i-1])
	else:
		print(i,ALL[i])

### FIXED CODE ###

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl_int(): return list(map(int, input().split()))
def inpl_str(): return list(map(int, input().split()))

def Comb(n):
    gyakugen = [1]*(n+1)
    fac = [1]*(n+1)

    for i in range(1,n+1):
        fac[i] = (fac[i-1]*i)%mod

    gyakugen[n] = pow(fac[n],mod-2,mod)

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

    com = [1]*(n+1)

    for i in range(1,n+1):
        com[i] = (fac[n]*gyakugen[i]*gyakugen[n-i])%mod

    return com

N = int(input())
aa = inpl_int()

i = 1
dd = defaultdict(int)
for i,a in enumerate(aa):
	if dd[a] == 0:
		dd[a] = i+1
	else:
		X1 = dd[a]-1
		X2 = i

L,R = X1,N-X2
ALL = 1

ALL = Comb(N+1)
daburi = Comb(L+R)

for i in range(1,N+2):
	if L+R+1 >= i:
		print((ALL[i]-daburi[i-1])%mod)
	else:
		print(ALL[i]%mod)
n,m=map(int,input().split())
graph=[[] for i in range(n+1)]
for i in range(m):
	x,y=map(int,input().split())
	graph[x].append(y)

def dfs(node):
	ans=0
	if(vis[node]):
		return dp[node]
	vis[node]=1
	for child in graph[node]:
		ans=max(ans,1+dfs(child))
	dp[node]=ans
	return ans
vis=[0 for i in range(n+1)]
dp=[0 for i in range(n+1)]
ans=float('-inf')
for i in range(1,n+1):
    dp[i]=dfs(i)
print(max(dp))

### FIXED CODE ###

from sys import stdin, setrecursionlimit as srl
from threading import stack_size
srl(int(1e9)+7)
stack_size(int(1e8))

def get(i, value, vis):
    if vis[i]:
        return value[i]
    vis[i] = True
    ans = 0
    for j in adj[i]:
        ans = max(ans, 1+get(j, value, vis))
    value[i] = ans
    return ans


n, m = map(int, input().split())
adj = {}
for i in range(n):
    adj[i] = []
for i in range(m):
    x, y = map(int,input().split())
    adj[x-1].append(y-1)
vis = [False for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
    value[i] = get(i, value, vis)
x = 0
for i in value:
    x = max(x, i)
print(x)
import fraction
n, x = map(int, input().split())
xl = [int(_) for _ in input().split()]
for i in range(n):
    if x > xl[i]:
        xl[i] = x - xl[i]
    else:
        xl[i] = xl[i] - x
x_gcd = xl[0]
if n > 1:
    for i in range(1, n):
        x_gcd = fraction.gcd(x_gcd, xl[i])
print(x_gcd)


### FIXED CODE ###

n, x = map(int, input().split())
xl = [int(_) for _ in input().split()]
for i in range(n):
    if x > xl[i]:
        xl[i] = x - xl[i]
    else:
        xl[i] = xl[i] - x


def gcd(a, b):
    if a < b:
        x_a = b
        x_b = a
    else:
        x_a = a
        x_b = b
    while(1):
        if x_a < x_b:
            tmp = x_a
            x_a = x_b
            x_b = tmp
        x_a %= x_b
        if x_a == 0:
            break
    return x_b

    
x_gcd = xl[0]
if n > 1:
    for i in range(1, n):
        x_gcd = gcd(x_gcd, xl[i])
print(x_gcd)
from collections import deque

N = int(input())
        
G = [[] for i in range(N)]
for _ in range(N - 1):
    a, b, c = map(int, input().split())
    G[a - 1].append([b - 1, c])
    G[b - 1].append([a - 1, c])
    
color = [-1] * N
color[0] = 0
Q = deque()
Q = [0]

while len(Q) != 0:
    cur = Q.popleft()
    for to, dist in G[cur]:
        if color[to] == -1:
            color[to] = (color[cur] + dist) % 2
            Q.append(to)
            
for i in range(N):
    print(color[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 8)

N = int(input())
        
G = [[] for i in range(N)]
for _ in range(N - 1):
    a, b, c = map(int, input().split())
    G[a - 1].append([b - 1, c])
    G[b - 1].append([a - 1, c])
    
color = [0] * N

def dfs(v, c):
    if color[v] == 0:
        color[v] = c
    for i in range(len(G[v])):
        if color[G[v][i][0]] == 0:
            if G[v][i][1] % 2 == 0:
                dfs(G[v][i][0], color[v])
            else:
                dfs(G[v][i][0] , -color[v])
                
for i in range(N):
    dfs(i, 1)
    # print(color)
    
for i in range(N):
    if color[i] == 1:
        print(0)
    else:
        print(1)
# 解説を参考に作成

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
import math
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N, K, As):
    ans = max(As)
    l, r = 1, ans
    for _ in range(30):
        if l == r:
            break
        m = (l + r) // 2
        cnt = 0
        for A in As:
            cnt += math.ceil(A / m) - 1
        if cnt <= K:
            ans = min(ans, m)
            r = m - 1
        else:
            l = m + 1
    print(ans)


if __name__ == '__main__':
    # S = input()
    # N = int(input())
    N, K = map(int, input().split())
    As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, K, As)


### FIXED CODE ###

# 解説を参考に作成

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
import math
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N, K, As):
    ans = max(As)
    l, r = 1, ans
    for _ in range(30):
        m = (l + r) // 2
        if m <= 0:
            break
        cnt = 0
        for A in As:
            cnt += math.ceil(A / m) - 1
        if cnt <= K:
            ans = min(ans, m)
            r = m - 1
        else:
            l = m + 1
    print(ans)


if __name__ == '__main__':
    # S = input()
    # N = int(input())
    N, K = map(int, input().split())
    As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, K, As)
N=int(input())
h=list(map(int,input().split()))
s=0
mini=100
def garden(N,h,s,mini):
  p=[]
  a=0
  b=0
  size=0
  for i in range (N):
    if mini>h[i]:
      mini=h[i]
    if i!=N-1:
      if h[i]>h[i+1]:
        p.append(h[i])
        a+=h[i]
        size+=1
    if i!=N-1 and i!=0:
      if h[i]<h[i+1] and (h[i]-h[i-1])*(h[i+1]-h[i])<=0:
        p.append(h[i])
        b+=h[i]
        size+=1
    if i==N-1:
      if h[i-1]<h[i]:
        p.append(h[i])
        a+=h[i]
        size+=1
  s+=a
  s-=b
  flag=0
  for j in range (1,size-1):
    if (p[j]-p[j-1])*(p[j+1]-p[j])>0:
      flag=1
  if flag==1:
    garden(size,p,s,mini)
  if s==0 and h[0]!=0:
    s+=1
  print(s)
  
garden(N,h,s,mini)

### FIXED CODE ###

N=int(input())
h=list(map(int,input().split()))
s=h[0]
for i in range (1,N):
  if h[i]>h[i-1]:
    s+=(h[i]-h[i-1])
print(s)
n=int,input()
k=int,input()
s=input()
S='s[0:k-1]'+'s[k-1].lower()'+'s[k:]'
print(S)


### FIXED CODE ###

n,k=map(int,input().split())
s=input()
S=s[0:k-1]+s[k-1].lower()+s[k:]
print(S)
N, Q = map(int, raw_input().split())
tree = [set() for i in range(N)]
ans = [0 for i in range(N)]


def func(_x, _p):
    ans[_x-1] += _p
    for x in tree[_x-1]:
        func(x, _p)


for i in range(0, N-1):
    a, b = map(int, raw_input().split())
    tree[a-1].add(b)

for i in range(0, Q):
    v, p = map(int, raw_input().split())
    func(v, p)

print ' '.join(map(str, ans))


### FIXED CODE ###

N, Q = map(int, raw_input().split())
ans = [0 for i in range(N)]
tree_s = ['' for i in range(N-1)]

for i in range(0, N-1):
    a, b = map(int, raw_input().split())
    tree_s[i] = str(a).zfill(8) + '-' + str(b)

tree_s.sort()

for i in range(0, Q):
    v, p = map(int, raw_input().split())
    ans[v-1] += p

for i in range(0, N-1):
    ab = tree_s[i].split("-")
    ans[int(ab[1])-1] += ans[int(ab[0])-1]


print ' '.join(map(str, ans))
x, y, z = map(int, input()split())
print(x * y / 2)


### FIXED CODE ###

x, y, z = map(int, input().split())
print(int(x * y / 2))
import sys

def jeat(a, f, x, K):
    N = 0
    for i in range(len(a)):
        if a[i]*f[i] > x:
            N += a[i] - x // f[i]
    if N > K:
        return False
    if N <= K:
        return True

N,K = map(int, input().split(' '))
A = list(map(int, input().split(' ')))
F = list(map(int, input().split(' ')))
if K >= sum(A):
    print(0)
    sys.exit()
A.sort()
F.sort(reverse = True)
a = 0
b = 10**18
while (a<b):
    z = (a+b)//2
    if jeat(A,F,z,K) == True:
        if jeat(A,F,z-1,K) == False:
            break
        b = z-1
    else:
        if jeat(A,F,z+1,K) == True:
            z -= 1
            break
        a = z+1

print(z)

### FIXED CODE ###

x,y=map(int,input().split())
if x<=9 and y<=9:
  print(x*y)
else:
  print(-1)
n,k=[int(i)for i in input().split()]
s=str(input())
print(s.replace(s[k-1],s[k-1].lower))

### FIXED CODE ###

n,k = map(int, input().split())
s = input()
 
t = s[:k-1]+str.lower(s[k-1])+s[k:]
print(t)
n,x = map(int,raw_input().split())
print '%d' %(n + ((n/x) - 1)*2*x + 3*(n%x))


### FIXED CODE ###

n = int(raw_input())
a = map(int,raw_input().split())
a.sort()
s_l = 0
for i in xrange(0,2*n,2) :
    s_l += a[i]
print s_l
N = input()
A = input()
B = input()
if (B-A)%2==1:
  	print(A)
else:
    print((B-A)//2)


### FIXED CODE ###

x=[]
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print((B-A)//2)
else:
    c=(A-1)+(B-A+1)//2
    d=(N-B)+(B-A+1)//2
    print(min(c,d))
from math import gcd
n, x = map(int, input().split())
x_list = [abs(int(i)-x) for i in input().split()]
a = x_list[0]
for i in range(1, n):
    a = gcd(a, x_list[i])
print(a)

### FIXED CODE ###

def gcd(p, q):
    if p < q:
        p, q = q, p
    while q > 0:
        p, q = q, p%q
    return p
n, x = map(int, input().split())
x_list = [abs(int(i)-x) for i in input().split()]
a = x_list[0]
for i in range(1, n):
    a = gcd(a, x_list[i])
print(a)