Harryxun/stf_run huggingface dataset:
N,Q = map(int, input().split())
s = input()
gorem=[1]*len(s)
t = [input().split(" ") for i in range(Q)]
for i in t:
    tmp=[j for j in range(len(s)) if s[j]==i[0]]
    if i[1]=='L':
        for _ in tmp:
            if _ == 0:
                gorem[_]=0
            else:
                gorem[_-1]+=gorem[_]
                gorem[_]-=gorem[_]
    else:
        for _ in tmp:
            if _ == len(s)-1:
                gorem[_]=0
               
            else:
                gorem[_+1]+=gorem[_]
                gorem[_]-=gorem[_]
print(sum(gorem))

### FIXED CODE ###

a = list(map(int, input().split()))
print('Yes') if a[0]==a[1]==a[2] else print('No')
#!python
# -*- coding: utf-8 -*-

import sys

sys.setswitchinterval(10**9)


next_s = ((-1, 1), (0, 1), (1, 1),
          (-1, 0), (1, 0),
          (-1, -1), (0, -1), (1, -1))


def DFS(x, y):
    if not (0 <= x < W and 0 <= y < H):
        return
    if map_[y][x] == 0:
        return

    map_[y][x] = 0

    for dx, dy in next_s:
        DFS(x + dx, y + dy)


while True:
    W, H = map(int, input().split())
    if W == 0 and H == 0:
        break
    map_ = [list(map(int, input().split())) for h in range(H)]
    island_num = 0
    for x in range(W):
        for y in range(H):
            if map_[y][x] == 1:
                DFS(x, y)
                island_num += 1
    print(island_num)



### FIXED CODE ###

#!python
# -*- coding: utf-8 -*-

import sys

sys.setrecursionlimit(10**6)


next_s = ((-1, 1), (0, 1), (1, 1),
          (-1, 0), (1, 0),
          (-1, -1), (0, -1), (1, -1))


def DFS(x, y):
    if not (0 <= x < W and 0 <= y < H):
        return
    if map_[y][x] == 0:
        return

    map_[y][x] = 0

    for dx, dy in next_s:
        DFS(x + dx, y + dy)


while True:
    W, H = map(int, input().split())
    if W == 0 and H == 0:
        break
    map_ = [list(map(int, input().split())) for h in range(H)]
    island_num = 0
    for x in range(W):
        for y in range(H):
            if map_[y][x] == 1:
                DFS(x, y)
                island_num += 1
    print(island_num)
import fractions
from functools import reduce
def gcd(i):
    return reduce(fractions.gcd, i)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    tmp = 0
    if gcd(A) == max(A):
        print(gcd(A))
        exit()
    else:
        for i in range(N):
            if i == 0 :
                tmp.append(gcd(A[1:]))
            elif i == N-1:
                tmp.append(gcd(A[:N-1]))
            else:
                tmp.append(gcd(A[:i]+A[i+1:]))
    print(max(tmp))
if __name__ == "__main__":
    main()

### FIXED CODE ###

import fractions
from functools import reduce
def gcd(*i):
    return reduce(fractions.gcd, i)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    L=[0]
    R=[0]
    for i in range(N):
        L.append(gcd(L[i],A[i]))
        R.append(gcd(R[i],A[-(i+1)]))
    R=R[::-1]
    ans=[]
    for i in range(N):
        ans.append(gcd(L[i],R[i+1]))
    print(max(ans))
if __name__ == "__main__":
    main()
x = [int(input()) for i in range(5)]

x_1 = [int(i / 10) for i in x]
x_2 = [(i % 10) for i in x]

ans = sum(x_1)*10 

for i in range(x_2.count(0)):
    x_2.remove(0)

ans += min(x_2)
ans += (len(x_2)-1)*10

print(ans)

### FIXED CODE ###

x = [int(input()) for i in range(5)]

x_1 = [int(i / 10) for i in x]
x_2 = [(i % 10) for i in x]

ans = sum(x_1)*10 

for i in range(x_2.count(0)):
    x_2.remove(0)

if(x_2 != []):
    ans += min(x_2)
    ans += (len(x_2)-1)*10

print(ans)
import sys

def main():
  input = sys.stdin.readline
  n, i = map(int, input().split())
  print(N-i+1)


if __name__ == '__main__':
  main()

### FIXED CODE ###

import sys

def main():
  input = sys.stdin.readline
  n, i = map(int, input().split())
  print(n-i+1)


if __name__ == '__main__':
  main()
a, b, c = input().split()

if a == R:
    if b == R:
        if c == R:
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if b == R:
        if c == R:
            print(2)
        else:
            print(1)
    else:
        if c == R:
            print(1)
        else:
            print(0)

### FIXED CODE ###

A = list(input())

n = A.count('R')
if n != 2:
    print(n)
else:
    m = A.index('S')
    if m == 1:
        print(1)
    else:
        print(2)
n=int(input())
lst=[[[0]*10 for i in range(0,3)] for j in range(0,4)]
for k in range(n):
    b,f,r,v = map(int,input().split())
    lst[b-1][f-1][r-1] +=v
x=0
for i in range (4):
    if x!=0: print("#"*20)
    +=x
    for a in range(3):
        for b in range(10):
            print((lst[i][a][b]),end="")
        print()



### FIXED CODE ###

n= int(input())
tbl=[[[0]*10 for i in range(0,3)] for j in range(0,4)]
for k in range(n):
    b,f,r,v = map(int,input().split())
    tbl[b-1][f-1][r-1] +=v
x=0
for i in range (4):
    if x !=0 : print("#"*20)
    x +=1
    for a in range(3):
        for b in range(10):
            print(" %d"%(tbl[i][a][b]),end="")     
        print()
def main()
  def dfs(x):
    m=x//2
    if m not in dp or dp[m]>dp[x]+abs(2*m-x)*d+a:
      dp[m]=dp[x]+abs(2*m-x)*d+a
      dfs(m)
    m=0--x//2
    if m not in dp or dp[m]>dp[x]+abs(2*m-x)*d+a:
      dp[m]=dp[x]+abs(2*m-x)*d+a
      dfs(m)
    m=x//3
    if m not in dp or dp[m]>dp[x]+abs(3*m-x)*d+b:
      dp[m]=dp[x]+abs(3*m-x)*d+b
      dfs(m)
    m=0--x//3
    if m not in dp or dp[m]>dp[x]+abs(3*m-x)*d+b:
      dp[m]=dp[x]+abs(3*m-x)*d+b
      dfs(m)
    m=x//5
    if m not in dp or dp[m]>dp[x]+abs(5*m-x)*d+c:
      dp[m]=dp[x]+abs(5*m-x)*d+c
      dfs(m)
    m=0--x//5
    if m not in dp or dp[m]>dp[x]+abs(5*m-x)*d+c:
      dp[m]=dp[x]+abs(5*m-x)*d+c
      dfs(m)
  def solve():
    dp[n]=0
    dfs(n)
    return min(dp[i]+abs(i)*d for i in dp)
  for _ in range(int(input())):
    n,a,b,c,d=map(int,input().split())
    dp={}
    print(solve())
if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
input=sys.stdin.readline
def main():
  def dfs(x):
    m=x//2
    if m not in dp or dp[m]>dp[x]+abs(2*m-x)*d+a:
      dp[m]=dp[x]+abs(2*m-x)*d+a
      dfs(m)
    m=0--x//2
    if m not in dp or dp[m]>dp[x]+abs(2*m-x)*d+a:
      dp[m]=dp[x]+abs(2*m-x)*d+a
      dfs(m)
    m=x//3
    if m not in dp or dp[m]>dp[x]+abs(3*m-x)*d+b:
      dp[m]=dp[x]+abs(3*m-x)*d+b
      dfs(m)
    m=0--x//3
    if m not in dp or dp[m]>dp[x]+abs(3*m-x)*d+b:
      dp[m]=dp[x]+abs(3*m-x)*d+b
      dfs(m)
    m=x//5
    if m not in dp or dp[m]>dp[x]+abs(5*m-x)*d+c:
      dp[m]=dp[x]+abs(5*m-x)*d+c
      dfs(m)
    m=0--x//5
    if m not in dp or dp[m]>dp[x]+abs(5*m-x)*d+c:
      dp[m]=dp[x]+abs(5*m-x)*d+c
      dfs(m)
  def solve():
    dp[n]=0
    dfs(n)
    return min(dp[i]+abs(i)*d for i in dp)
  for _ in range(int(input())):
    n,a,b,c,d=map(int,input().split())
    dp={}
    print(solve())
if __name__ == "__main__":
  main()
n=list(input())
print(n.count('2))

### FIXED CODE ###

n=list(input())
print(n.count('2'))
def main():
        a,b = map(float,input().split())
        x = a*b
        y = x%1
        z = int(x-y)
        if x-y-z > z+1-(x-y):
            print(z+1)
            return
        else:
            print(z)
            return
    main()

### FIXED CODE ###

def main():
    from decimal import Decimal
    a,b = map(Decimal,input().split())
    print(int(a*b))
    return
main()
from math import ciel
a,b=[int(x) for x in input().split()]
if b==1:
    print(0)
else :
    print(ciel((b-1)/(a-1)))

### FIXED CODE ###

a,b=map(int,input().split())
now=a
i=1
if b>1:
    while now<b:
        now+=a-1
        i+=1
    print(i)
else:
    print(0)
import math

def lcm(x,y):
    return(x*y)//math.gcd(x,y)

a,b = map(int,input().split())
print(lcm(a,b))

### FIXED CODE ###

import fractions

def lcm(x,y):
    return(x*y)//fractions.gcd(x,y)

a,b = map(int,input().split())
print(lcm(a,b))
str = input()
a = str[-1:]
if a == "3"
	result = "bon"
  elseif (a == "0") or (a == "1") or (a == "6") or (a == "8")
  	result ="pon"
  else 
  	result = "hon"
    
print(result)

### FIXED CODE ###

str = input()
a = str[-1:]
if a == "3":
	result = "bon"
elif (a == "0") or (a == "1") or (a == "6") or (a == "8"):
  	result = "pon"
elif (a == "2") or (a == "4") or (a == "5") or (a == "7") or (a == "9"):
  	result = "hon"
else:
  	result = "ng"
    
print(result)
from string import ascii_lowercase


def main():
    all_s = input()
    k = int(input())
    ind = {a: [] for a in ascii_lowercase}
    if len(all_s) == 1:
        print(all_s)
    else:
        for i in range(len(all_s)):
            ind[all_s[i]].append(i)
        for s, index in ind.items():
            if not index:
                continue
            else:
                substr = {s}
                i = 1
                all_substr = len(all_s) * len(index) - sum(index) - 1
                if all_substr < k:
                    k -= all_substr
                    continue
                before_len = 0
                while len(substr) != before_len:
                    before_len = len(substr)
                    for j in index:
                        substr.add(all_s[j:i + j + 1])
                    i += 1
                substr = list(substr)
                substr.sort()
                print(substr[k - 1])
                break


if __name__ == '__main__':
    main()



### FIXED CODE ###

def main():
    all_s = input()
    k = int(input())
    substr = set()
    for i in range(len(all_s)):
        for j in range(1, k + 1):
            substr.add(all_s[i:i + j])
    substr = list(substr)
    substr.sort()
    print(substr[k - 1])


if __name__ == '__main__':
    main()
if __name__ == "__main__":
    val = input()
    ans = val^3
    print(ans)

### FIXED CODE ###

#if __name__ == "__main__":
#    val = input()
#    ans = val**3
#    print(ans)

#!/usr/bin/env python
# -*- coding: utf-8 -*-


if __name__ == '__main__':
    n = int(input())
    print(n**3)
def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  for i in range(len(a)):
    start = max(0, i-a[i])
    for j in range(start, i+a[i]+1):
      ret[j] += 1
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)

for i in range(k-1):
  num_light = count_num_light(num_light)
  if sum(num_light) == n**2:
    break

print(*num_light)


### FIXED CODE ###

def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  n = len(a)
  for i in range(n):
    start = max(0, i-a[i])
    end = min(n-1, i+a[i])
    ret[start] += 1
    if end+1 < n:
      ret[end+1] -= 1
  for i in range(1,n):
    ret[i] += ret[i-1]
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)
 
for i in range(k-1):
  num_light = count_num_light(num_light)
  if sum(num_light) == n**2:
    break
    
print(*num_light)
a=int(input("a:"))
b=int(input("b:"))
area=a*b
pm=2*a+2*b
print(area,pm)


### FIXED CODE ###

a,b=map(int,input().split())
area=a*b
pm=2*a+2*b
print(area,pm)
a,b = map(int, input().split())
c,d = map(int, inout().split())
if c == a+1:
  print(1)
else:
  print(0)
a,b = map(int, input().split())
c,d = map(int, inout().split())
if c = a+1:
  return 1
else:
  return 0


### FIXED CODE ###

li = []
for i in range(2):
  a,b = map(int, input().split())
  li.append(a)
  
if li[1] == li[0]+1:
  print(1)
else:
  print(0)
import numpy as np
n,w=map(int,input().split())
#重さをdpにする
#dp=[[0]*n,[0]*w] #n番目の品,重さ。価値が値として入る
dp=np.zeros((n+1,w+1))

W=[]
V=[]
for i in range(n):
    a,b=map(int,input().split())
    W+=[a]
    V+=[b]

#print(dp[0][0])
#print(W)
for i in range(n):
    #print(i)
    for sum_w in range(w+1):
        #print(sum_w)
        #足した時に価値が上がるケース
        if sum_w>=W[i]:
            dp[i+1][sum_w]=max(dp[i][sum_w],dp[i][sum_w - W[i]] + V[i])
    
        #選ばない時
        else:
            dp[i+1][sum_w]=dp[i][sum_w]

#print(dp)
print(int(dp[n][w]))

### FIXED CODE ###

#import numpy as np
n,w=map(int,input().split())
#重さをdpにする
#dp=[[0]*n,[0]*w] #n番目の品,重さ。価値が値として入る
#dp=np.zeros((n+1,w+1))
dp=[[0] * (w+1) for i in range(n+1)]
#print(dp)
#print(len(dp[0]))
#print(len(dp[n][w]))
W=[]
V=[]
for i in range(n):
    a,b=map(int,input().split())
    W+=[a]
    V+=[b]

#print(dp[0][0])
#print(W)
for i in range(n):
    #print(i)
    for sum_w in range(w+1):
        #print(sum_w)
        #足した時に価値が上がるケース
        if sum_w>=W[i]:
            dp[i+1][sum_w]=max(dp[i][sum_w],dp[i][sum_w - W[i]] + V[i])
    
        #選ばない時
        else:
            dp[i+1][sum_w]=dp[i][sum_w]

#print(dp)
print(int(dp[n][w]))
n = int(input())
h = list(map(int, input().split()))
h.append(10000000000)
max = 0
flag = 0

for i in range(n):

    if h[i+1]<h[i]:
        h[i]=h[i]-1
    if h[i]>=max and h[i+1]>=h[i]:
        max = h[i]
    else:
        flag = 1
        break
if flag == 1:
    print('No')
else:
    print('Yes')


### FIXED CODE ###

a,b,c = map(int, input().split())
d = c-(a-b)
if(d<0):
    d = 0
print(d)
n,m = map(int,input().split())
a,b = [0 for _ in range(n)],[0 for _ in range(n)]

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

bought = 0
ans = 0
while(bought <= m):
    remain = m - bought
    if b[a.index(min(a))] <= remain:
        ans += min(a)*b[a.index(min(a))]
        bought += b[a.index(min(a))]
        b.remove(b[a.index(min(a))])
        a.remove(min(a))
    else:
        ans += min(a)*remain
        break
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort(key = lambda a:a[0])
bought = 0
price = 0
for i in range(n):
    remain = m - bought
    if a[i][1] < remain:
        bought += a[i][1]
        price += a[i][0] * a[i][1]
    else:
        price += a[i][0]*remain
        print(price)
        exit()
o = input()
s = list(o)
sample = [chr(i) for i in range(97, 97+26)]
if len(s) == 26:
    if s == sample[::-1]:
        out = -1
    else:
        for i, s1 in enumerate(sample):
            if s[i] != s1:
                out = ''.join(s[:i-1]) + s1
                break
else:
    for i1,i2 in zip(sorted(s), sample):
        if i1 != i2:
            out = o + i2
            break
print(out)

### FIXED CODE ###

s = input()
t = set(map(chr, range(ord('a'), ord('z')+1))) - set(s)
if t:
    print(s + min(t))
else:
    u = {s[-1]}
    for i in range(len(s)-1)[::-1]:
        x = [c for c in u if s[i]<c]
        if x:
            print(s[:i] + min(x))
            break
        u.add(s[i])
    else:
        print(-1)
import sys
sys.setrecursionlimit(100000)

def lcm(x,y):
    return (x*y)//gcd(x,y)

def gcd(x,y):
    if y <= 0:
        return x
    else:
        return gcd(y,x%y)

N = int(input())
T = [int(input()) for _ in range(N)]
ans = lcm(T[0],T[1])
for i in range(2,N):
    ans = lcm(ans,T[i])
print(ans)

### FIXED CODE ###

import sys
import os
sys.setrecursionlimit(100000000)

def lcm(x,y):
    return (x*y)//gcd(x,y)

def gcd(x,y):
    if y <= 0:
        return x
    else:
        return gcd(y,x%y)

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T[0])
    sys.exit()

ans = lcm(T[0],T[1])
for i in range(2,N):
    ans = lcm(ans,T[i])
print(ans)
ABC = input().split()
list_ABC= list(ABC)
​
if list_ABC[0] == list_ABC[1] and list_ABC[0] == list_ABC[2]:
    print('Yes')
else:
    print('No')
2 2 2

### FIXED CODE ###

ABC = input().split()
list_ABC= list(ABC)

if list_ABC[0] == list_ABC[1] and list_ABC[0] == list_ABC[2]:
    print('Yes')
else:
    print('No')
,K=map(int,input().split())
def f(b):
  d=max(b-K,0)*(N//b)+max(N%b-K+1,0)
  return d
ans=0
if K==0:
  print(N**2)
  exit()
  
for i in range(1,N+1):
  ans+=(f(i))
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
def f(b):
  d=max(b-K,0)*(N//b)+max(N%b-K+1,0)
  return d
ans=0
if K==0:
  print(N**2)
  exit()
  
for i in range(1,N+1):
  ans+=(f(i))
print(ans)
myinput=raw_input()
a=[int(x) for x in myinput.split()]
if abs(a[0]-a[1])<abs(a[0]-a[2]):
    print("A")
else:
    print("B")

### FIXED CODE ###

myinput=input()
a=[int(x) for x in myinput.split()]
if abs(a[0]-a[1])<abs(a[0]-a[2]):
    print("A")
else:
    print("B")
n=int(input())
a = [int(i) for i in input().split()] 
A=0
B=0
C=0
for i in range(n):
  if i%2==0:
    A += max(a)
    del a(a.index(max(a))
  else :
    B += max(a)
    del a(a.index(max(a))      
  
C=A-B          
print(C)          

### FIXED CODE ###

n=int(input())
a = [int(i) for i in input().split()] 
A=0
B=0
C=0
k=0
for i in range(n):
  if i%2==0:
    k=max(a)
    A += k
    del a[a.index(k)]
  else :
    k=max(a)      
    B += k
    del a[a.index(k)]   
  
C=A-B          
print(C)
A, B, K = list(map(int, input().split()))

S = [1]

for i in range(2,min(A,B)):
    if A % i == 0 and B % i == 0:
        S.append(i)

S.reverse()

print(S[K-1])

### FIXED CODE ###

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

S = [1]

for i in range(2,min(A+1,B+1)):
    if A % i == 0 and B % i == 0:
        S.append(i)

S.sort(reverse=True)

print(S[K-1])
import collections
import numpy as np

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

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
	S = i * (i-1) / 2
    ans+=S
print(int(ans))

### FIXED CODE ###

import collections
import numpy as np

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

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))
x = int(input())
if x => 30:
  print("Yes")
else:
  print("No")
  


### FIXED CODE ###

x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(n):
    if i+1 == p[i]:
        temp = p[i]
        p[i] = p[i+1]
        p[i+1] = temp
        ans += 1

print(ans)


### FIXED CODE ###

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

ans = 0
for i in range(n):
    if i == n-1 and i+1 == p[i]:
        ans += 1
    elif i+1 == p[i]:
        temp = p[i]
        p[i] = p[i+1]
        p[i+1] = temp
        ans += 1


print(ans)
import itertools
n,m=map(int,input().split())
s=[set(map(int,input().split())) for _ in range(n)]

ans=0
x=[i for i in range(2,n+1)]
print(x)
cand=itertools.permutations(x)
print(cand)
for i in cand:
  crnt=1
  for nxt in i:
    if set([crnt,nxt]) in s:
      crnt=nxt
    else:
      break
  else:
    ans+=1
print(ans)

### FIXED CODE ###

from itertools import permutations
n,m=map(int,input().split())
s=[set(map(int,input().split())) for _ in range(m)]

ans=0
x=[i for i in range(2,n+1)]
cand=permutations(x)
for i in cand:
  crnt=1
  for nxt in i:
    if set([crnt,nxt]) in s:
      crnt=nxt
    else:
      break
  else:
    ans+=1
print(ans)
n,k = map(int, input().split())
mod = 10**9+7
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    else:
        a = cmb(n-k+1,i)
        print((a*(i**(k-i)))%mod)

### FIXED CODE ###

n,k = map(int, input().split())
mod = 10**9+7
from scipy.misc import comb

for i in range(1,k+1):
    print((comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True))%mod)
n = int(input())

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

ans = []
for cx in range(101): #Cx 0~100
    for cy in range(101): #Cy 0~100
        h = []
        for i in range(n):
            #x[i], y[i], h[i]のときの高さHを求める
            #H = |x[i] - Cx| + |y[i] - Cy| + h[i]
            h.append(abs(xyh[i][0] - cx) + abs(xyh[i][1] - cy) + xyh[i][2])

        # Hがすべて一致するときのCx, Cyが答えである
        if len(set(h)) == 1:
            ans.append(cx)
            ans.append(cy)
            ans.append(h[0])

print(ans[0], ans[1], ans[2])


### FIXED CODE ###

from collections import Counter

n = int(input())

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

for i in range(n): # 高さが0でない情報を探す
    if xyh[i][2] != 0:
        xyh_1 = xyh[i]
        break

for cx in range(101): #Cx 0~100
    for cy in range(101): #Cy 0~100
        h = abs(xyh_1[0] - cx) + abs(xyh_1[1] - cy) + xyh_1[2] # 高さHを求める

        flag = 0
        for i in range(n):
             # 高さHが適切であるか確認
            if xyh[i][2] == max(h - abs(xyh[i][0] - cx) - abs(xyh[i][1] - cy), 0):
                flag += 1

        if flag == n:
            print(cx, cy, h)
n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [a[0]]
for i in range(1,n):
    v = 1
    for j in range(len(p)):
        if a[i] % a[j] == 0:
            v = 0
            break
    if v == 1:
        p.append(a[i])
ans = len(p)
for i in range(n-2):
    if a[i] == a[i+1] and a[i+1] != a[i+2]:
        ans -= 1
if a[-1] == a[-2]:
    ans -= 1
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
p = [True for i in range(a[-1])]
ans = n
for k in range(n-1):
    if p[a[k]-1]:
        if a[k] != a[k+1]:
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break
        else:
            ans -= 1
            for i in range(1,a[-1]+1):
                if a[k]*i <= a[-1]:
                    p[a[k]*i-1] = False
                else:
                    break  
    else:
        ans -= 1    
k = n-1
if p[a[k]-1]:
    for i in range(1,a[-1]+1):
        if a[k]*i <= a[-1]:
            p[a[k]*i-1] = False
        else:
            break
else:
        ans -= 1   
print(ans)
import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7

if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()

A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]

ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

while ansA>0:
  ansA-=MOD
B1=A[0:K]
B2=sorted(A[K:N])
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]

B1.remove(Bp[-1])
B1.append(B2[0])

ansB = 1
for a in B1[0:K]:
  ansB *= a
  ansB %= MOD

C1=A[0:K]
C1.remove(Bm[-1])
C1.append(B2[-1])

ansC = 1
for a in C1[0:K]:
  ansC *= a
  ansC %= MOD
  
print(max(ansB,ansC))

### FIXED CODE ###

import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()
 
A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]
 
ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

while ansA>0:
  ansA-=MOD

B1=A[0:K]
C1=A[0:K]
B2=sorted(A[K:N])
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]
 
if B2[0]>0:B2.insert(0,0)
if B2[-1]<0:B2.insert(-1,0)
if not Bp:Bp.insert(0,B1[-1])
if not Bm:Bm.insert(0,B1[0])
  
#print(Bp,Bm,B2)
#print(Bp[-1],B2[0])
B1.remove(Bp[-1])
B1.append(min(B2[0],0))
#print(B1)
ansB = 1
for a in B1[0:K]:
  ansB *= a
  ansB %= MOD
#print(Bm[-1],B2[-1])
C1.remove(Bm[-1])
C1.append(max(B2[-1],0))
 
ansC = 1
for a in C1[0:K]:
  ansC *= a
  ansC %= MOD
#print(B1,C1)
#print(ansB,ansC)
BB1=[np.sign(i) for i in B1]
ansBB1 = BB1[0:K].count(-1)%2
BB2=[np.sign(i) for i in C1]
ansBB2 = BB2[0:K].count(-1)%2
#print(ansBB1,ansBB2)
if ansBB1==1:
  print(ansC)
  exit()
if ansBB2==1:
  print(ansB)
  exit()
#print(B2[0]/Bp[-1],B2[-1]/Bm[-1])
#print(Bp[-1]*B2[-1],Bm[0]*B2[0])

#print(abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0]))
#print(ansB,ansC)
if abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0])>=0:
  print(ansC)
else: print(ansB)
a, b = map(int, input().split())
c = a*b/2
c = math.ceil(c)
print(c)

### FIXED CODE ###

import math
a, b = map(int, input().split())
print(math.ceil((a+b)/2))