Harryxun/stf_run huggingface dataset:
n, k = list(map(int, input().split()))
s = input()

def findmax(s,k):
    if len(s) == 1:
        return 1
    begin = s[0]
    l = [0]
    cur = 0
    for i in range(len(s)):
        if s[i]==begin:
            l[cur]+=1
        else:
            if begin == '0' : begin ='1'
            else: begin = '0'
            cur+=1
            l.append(1)
    r = 0
    if s[0] == '0':
        l = [0] + l
        r = 2*k
    else:
        r = 2*k+1
    sumup = [0]
    for i in range(len(l)):
        sumup.append(sumup[i]+l[i])
    return (max([sumup[i+r]-sumup[i] for i in range(0,len(sumup)-r,2)]))
print (findmax(s,k))

### FIXED CODE ###

from itertools import accumulate

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


def findmax():
    cur=0
    l=[]
    prev = '1'
    for c in s:
        if prev ==c:
            cur+=1
        else:
            l.append(cur)
            cur = 1
        prev=c
    l.append(cur)
    if prev=='0':
        l.append(0)
    w = 2*k+1
    if len(l)<=w:
        return n
    sumup = [0]+list(accumulate(l))
    res = 0
    for i in range(0, len(l)-w+1,2):
        res = max(res,sumup[i+w]-sumup[i])
    return res
print(findmax())
from sys import stdin

x = [int(input()) for i in range(10)]
x.sort().reverse()
for i in range(3):
    print(i)

### FIXED CODE ###

from sys import stdin

x = [int(input()) for i in range(10)]
x.sort(reverse=True)
for i in range(3):
    print(x[i])
N = int(input())
a = list( map( int, input().split()))
a = sorted(a)
a.reverse()
Alice_Bob = o
Bob = 1

for i in a:
	Alice_Bob += a * Bob  
	Bob *= -1
    
print(Alice_Bob)


### FIXED CODE ###

N = int(input())
a = list( map( int, input().split()))
a = sorted(a)
a.reverse()
Alice = 0
Bob = 0
a.append(0)
a.append(0)

for i in range(N//2 + 1):
	Alice += int(a[2 * i])  
	Bob += int(a[2 * i + 1])
    
print(Alice -Bob)
k,s=map(int,input().split())
c=0
for i in range(k+1):
  for i2 in range(k+1):
    for i3 in range(k+1):
      if i+i2+i3i==s:
        c+=1
print(c)

### FIXED CODE ###

k,s=map(int,input().split())
c=0
for i in range(k+1):
  for i2 in range(k+1):
      if i+i2>s:
        break
      elif s-(i+i2) <=k: 
        c+=1
print(c)
from numba import jit
s = list(input())
n = len(s)
ans = 0
@jit
def p(ans):
    for i in range(0, n-2):
        b = True
        if s[i:i+3] == ['A', 'B', 'C']:
            s[i] = 'B'
            s[i+1] = 'C'
            s[i+2] = 'A'
            ans += 1
            b = False
        
    return ans, b
while True:
    ans, b = p(ans)
    if not b:
        break
print(ans)


### FIXED CODE ###

s = list(input())
li = []
n = len(s)
ans = 0
b = False
for i in range(n-1):
    if b:
        b = False
        continue
    if s[i] + s[i+1] == 'BC':
        li.append('D')
        b = True
    if s[i] == 'B' and s[i+1] != 'C':
        li.append('E')
    if s[i] == 'C':
        li.append('E')
    if s[i] == 'A':
        li.append('A')
cnt = 0
for i in range(len(li)):
    if li[i] == 'A':
        cnt += 1
    elif li[i] == 'E':
        cnt = 0
    else:
        ans += cnt
print(ans)
# -*- coding: utf-8 -*-
h,w = map(int, raw_input().split())

area = [0,0,0]
ans = 999999999999
if(h%3 == 0 or w%3 == 0):
    print('0')
    exit(1)
for i in range(1,h/2+1):
    area[0] = i*w
    area[1] = (w/2)*(h-i)
    area[2] = (w-w/2)*(h-i)
    S = max(area)-min(area)
    if(S<ans):
        ans = S
    
for i in range(1,w/2+1):
    area[0] = i*h
    area[1] = (h/2)*(w-i)
    area[2] = (h-h/2)*(w-i)
    S = max(area)-min(area)
    if(S<ans):
        ans = S
print(ans)
    

### FIXED CODE ###

# -*- coding: utf-8 -*-
h,w = map(int, raw_input().split())
 
area = [0,0,0]
ans = 10**15
if(h%3 == 0 or w%3 == 0):
    ans = 0
else:
    for i in range(1,h/2+1):
        area[0] = i*w
        tmp = w/2
        area[1] = tmp*(h-i)
        area[2] = (w-tmp)*(h-i)
        S = max(area)-min(area)
        if(S<ans):
            ans = S
        tmp = (h-i)/2
        area[1] = tmp*w
        area[2] = (h-i-tmp)*w
        S = max(area)-min(area)
        if(S<ans):
            ans = S
        
    for i in range(1,w/2+1):
        area[0] = i*h
        tmp = h/2
        area[1] = tmp*(w-i)
        area[2] = (h-tmp)*(w-i)
        S = max(area)-min(area)
        if(S<ans):
            ans = S
        tmp = (w-i)/2
        area[1] = tmp*h
        area[2] = (w-i-tmp)*h
        S = max(area)-min(area)
        if(S<ans):
            ans = S
print(ans)
import math
H, W = map(int, input().split())
s = []
flag = 0
ans = "No"
for i in range(W):
  s.append(list(input()))
for i in range(H):
  for j in range(W):
    if flag == 0:
      if s[i][j] == "#":
        if s[max(0, i - 1)][j] == "#" or s[i][max(0, j - 1)] == "#" or s[min(H - 1, i + 1)][j] == "#" or s[i][min(W - 1, j + 1)] == "#":
          continue
        else:
          flag += 1
if flag == 0:
  ans = "Yes"
print(ans)

### FIXED CODE ###

import math
H, W = map(int, input().split())
s = []
flag = 0
ans = "No"
for i in range(H):
  s.append(list(input()))
for i in range(H):
  for j in range(W):
    if flag == 0:
      if s[i][j] == "#":
        if s[max(0, i - 1)][j] == "#" or s[i][max(0, j - 1)] == "#" or s[min(H - 1, i + 1)][j] == "#" or s[i][min(W - 1, j + 1)] == "#":
          continue
        else:
          flag += 1
if flag == 0:
  ans = "Yes"
print(ans)
for t in range(int(input())):
  a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),0,0,""
	if a*l<=b:y=a+b
	elif b*l<=a:x=a+b
	else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

### FIXED CODE ###

T=int(input())
for TT in range(T):
	a,b,c,d=map(int,input().split(' '))
	l,x,y,out=(a+b)//(min(a,b)+1),0,0,""
	if a*l<=b:y=a+b
	elif b*l<=a:x=a+b
	else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1) 
	for i in range(c,d+1):out+=("AB"[i%(l+1)==0]) if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(out)
import sys
sys.setrecursionlimit(100000)
N, Q = tuple(map(int, input().split(" ")))
ab = []
for _ in range(N-1):
    ab.append(tuple(map(int, input().split(" "))))
px = []
for _ in range(Q):
    px.append(tuple(map(int, input().split(" "))))

count = [0 for _ in range(N)]
for p, x in px:
    count[p-1] += x

ans = [-1 for _ in range(N)]

adj_list = [[] for _ in range(N)]
for a, b in ab:
    adj_list[a-1].append(b-1)
    adj_list[b-1].append(a-1)

def dfs(node, c):
    if ans[node] != -1:
        return
    ans[node] = c + count[node]
    for next_node in adj_list[node]:
        dfs(next_node, c + count[node])

dfs(0, 0)
print(" ".join([str(a) for a in ans]))




### FIXED CODE ###


def solve(N, Q, ABs, PXs):
    values = {i: 0 for i in range(N + 1)}
    ans = [-1 for i in range(N + 1)]
    vertexes = {}
    for a, b in ABs:
        vertexes.setdefault(a, []).append(b)
        vertexes.setdefault(b, []).append(a)

    for p, x in PXs:
        values[p] += x

    queue = []
    queue.append((1, 0))
    while queue:
        index, parent_value = queue.pop()
        value = parent_value + values[index]
        ans[index] = value
        for child in vertexes[index]:
            if ans[child] == -1:
                queue.append((child, value))
    return " ".join([str(a) for a in ans[1:]])


if __name__ == "__main__":
    N, Q = tuple(map(int, input().split(" ")))
    ABs = [tuple(map(int, input().split(" "))) for _ in range(N - 1)]
    PXs = [tuple(map(int, input().split(" "))) for _ in range(Q)]
    print(solve(N, Q, ABs, PXs))
N = int(input())
job = [list(map(int, input().split())) for i in range(N)]

job.sort(key = lambda x: x[1]

time = 0
flag = 0
for i in range(N):
    time += job[i][0]
    if time > job[i][1]:
        flag = 1 
    
if flag == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

from operator import itemgetter

N = int(input())
job = [list(map(int, input().split())) for i in range(N)]

job.sort(key = itemgetter(1))

time = 0
flag = 0
for i in range(N):
    time += job[i][0]
    if time > job[i][1]:
        flag = 1    
    
if flag == 0:
    print('Yes')
else:
    print('No')
a, b, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = [map(int, input().split()) for i in range(m)]
ans = min(a) + min(b)
for i in range(m):
    ai = a[l[i][0] - 1]
    bi = b[l[i][0] - 1]
    ci = c[l[i][0] - 1]
    nc = ai + bi - c
    ans = min(ans, nc)
print(nc)
    

### FIXED CODE ###

A, B, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = [input().split() for i in range(m)]
ans = min(a) + min(b)

for i in range(m):
    ai = a[int(l[i][0]) - 1]
    bi = b[int(l[i][1]) - 1]
    ci = int(l[i][2])
    nc = ai + bi - ci
    ans = min(ans, nc)
print(ans)
X=input()
if X>=400 and X<=599:
  print(8)
if X>=600 and X<=799:
  print(7)
if X>=800 and X<=999:
  print(6)
if X>=1000 and X<=1199:
  print(5)
if X>=1200 and X<=1399:
  print(4)
if X>=1400 and X<=1599:
  print(3)
if X>=1600 and X<=1799:
  print(2)
if X>=1800 and X<=1999:
  print(1)


### FIXED CODE ###

X=int(input())
if X>=400 and X<=599:
  print('8')
if X>=600 and X<=799:
  print('7')
if X>=800 and X<=999:
  print('6')
if X>=1000 and X<=1199:
  print('5')
if X>=1200 and X<=1399:
  print('4')
if X>=1400 and X<=1599:
  print('3')
if X>=1600 and X<=1799:
  print('2')
if X>=1800 and X<=1999:
  print('1')
N = int(input())
X = list(map(int, input().split()))
for i in range(N):
  Y = X[:]
  Y.remove(X[i])
  Y.sort()
  print(Y[N // 2])

### FIXED CODE ###

N = int(input())
X = list(map(int, input().split()))
L = []
for i in range(N):
  L.append([X[i], i])
L.sort()
for i in range(N):
  if i < N // 2:
    L[i].append(L[N // 2][0])
  else:
    L[i].append(L[N // 2 - 1][0])
for i in range(N):
  L[i][0], L[i][1] = L[i][1], L[i][0]
L.sort()
for i in range(N):
  print(L[i][2])
from bisect import bisect_left
n=int(input())
l=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
    for j in range(i+1,n):
        r =bisect_left(L,L[i]+L[j])
        ans+=max(r-j-1),0
print(ans)

### FIXED CODE ###

from bisect import bisect_left
n=int(input())
l=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
    for j in range(i+1,n):
        r =bisect_left(l,l[i]+l[j])
        ans+=max((r-j-1),0)
print(ans)
import sys

N = int(input())
 
A =[ [0 for i in range(2)]for i in range(20)]
 
if N < 20:
    for i in range(N):
 
        print(i)
        print("", flush=True)
    
    S = input()
    if S == 'Vacant':
        sys.exit()
 
else:
    nS = 0
    nE = N - 1
    nT = (N + 1) / 2
    nT2 = nT % 2
    if nT2 == 1:
        nT = nT + 1
    
    nQ = 0
    iTmp = 0
    nCnt = 0
 
    print(nQ)
    print("", flush=True)

    S = input()
    if S == 'Vacant':
        sys.exit()


    nQ = N - 1
    print(nQ)
    print("", flush=True)
    E = input()
    if E == 'Vacant':
        sys.exit()
 
    for i in range(19):
        nQ = ( nS + nE ) / 2
        print(nQ)
        print("", flush=True)
    
        S1 = input()
        if S1 == 'Vacant':
            sys.exit()
 
        nT2 = (nQ - nS) % 2

        if ( nT2 != 0 ) and ( S ==S1 ):
            E = S1
            nE = nQ
        elif ( nT2 == 0 ) and ( S !=S1 ):
            E = S1
            nE = nQ
        elif ( nT2 != 0 ) and ( S !=S1 ):
            S = S1
            nS = nQ
        elif ( nT2 == 0 ) and ( S ==S1 ):
            S = S1
            nS = nQ
        


### FIXED CODE ###

nData = []
nData  = input().rstrip().split(' ')

X = int(nData[0])
Y = int(nData[1])


nFlag = 0

Check = X%Y

if Check != 0:
    N = 10**18//X
    for i in range(N):
        if i<2:
            continue
        Ans = X * i
        Check = Ans%Y
        if Check !=0:
            nFlag = 1
            break
        
    
if nFlag == 0:
    print('-1')
else:
    print(Ans)
Not found

### FIXED CODE ###

a,b,c=sorted(map(int,input().split()))
print(10*c+b+a)
N = input()
print sum([int(raw_input()) for i in range(N)]) / N

### FIXED CODE ###

for i in range(input()):
    h, m = map(int, raw_input().split(':'))
    s_h = h*30 + m*0.5
    l_h = m*6
    angle = abs(l_h-s_h)
    if 360-angle < angle:
        angle = 360 - angle
    if 0 <= angle < 30:
        print 'alert'
    elif 30 <= angle < 90:
        print 'warning'
    elif 90 <= angle <= 180:
        print 'safe'
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k,a,b = readInts()

if a+1<=k and a+2<b:
	k-=a+1
	ans+=k//2*(b-a)+k%2+b
else:
	ans = k+1

print(ans)

### FIXED CODE ###

from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k,a,b = readInts()

if a+1<=k and a+2<b:
	k-=a+1
	ans=k//2*(b-a)+k%2+b
else:
	ans = k+1

print(ans)
HP, k = map(int, input().split())
enamy = list(map(int, input().split()))

enamy1 = sorted(enamy, reverse=True)
if n =< k:
  print(0)
else:
  del enamy1[0:k]
  print(sum(enamy1))


### FIXED CODE ###

HP, k = map(int, input().split())
enamy = list(map(int, input().split()))

enamy1 = sorted(enamy, reverse=True)
if len(enamy) <= k:
  print(0)
else:
  del enamy1[0:k]
  print(sum(enamy1))
n = int(input())
x = input().split()
a = 0
b = 1
while 2 * a <= n - 1 :
  b = b * int(x[a]) * int(x[n-1-a])
  a += 1
if b <= 1000000000000000000:
  print(b)
else:
  print(-1)


### FIXED CODE ###

a,b = map(int, input().split())
print(a*b)
def round_up_division(num1, num2):
# 切り上げ除算
  div = -(-num1 // num2)
  return div

def binary_search(search_range, max_num):
  search_min = 1
  search_max = search_range
  # 二分探索
  while True:
    # max_numを超えない最大回数にする
    count_a = 0
    # count_aより1短い長さ
    count_b = 0
    # 最小値と最大値の中間の値を出す
    half_num = (search_min + search_max - 1) // 2 + 1
    for i in range(len(A)):
      # 木を切る回数は(⌈(木の長さ)//(切りたい長さ)⌉-1)回
      count_a += round_up_division(A[i], half_num) - 1
      count_b += round_up_division(A[i], half_num - 1) - 1
    if count_a <= K and count_b > K:
      # count_aが最大になれば終了
      return half_num
      break
    elif count_b <= K:
      # 少なければ短い半分で探索
      search_max = half_num - 1
    else:
      # 多ければ長い半分で探索
      search_min = round_up_division(search_min + search_max, 2) + 1



N, K = map(int, input().split())
A = list(map(int, input().split()))
length_max = binary_search(max(A), K)
print(length_max)

### FIXED CODE ###

def round_up_division(num1, num2):
# 切り上げ除算
  div = -(-num1 // num2)
  return div

def binary_search(search_range, max_num, logs):
  search_min = 1
  search_max = search_range
  # 二分探索
  while True:
    # max_numを超えない最大回数にする
    count_a = 0
    # count_aより1短い長さ
    count_b = 0
    # 最小値と最大値の中間の値を出す
    half_num = (search_min + search_max - 1) // 2 + 1
    for i in range(logs):
      # 木を切る回数は(⌈(木の長さ)//(切りたい長さ)⌉-1)回
      count_a += round_up_division(A[i], half_num) - 1
      if half_num != 1:
        count_b += round_up_division(A[i], half_num - 1) - 1
    if count_a > K:
      # 多ければ長い半分で探索
      search_min = round_up_division(search_min + search_max, 2)
    elif half_num != 1 and count_b <= K:
      # 少なければ短い半分で探索
      search_max = half_num - 1
    else:
      # count_aが最大になれば終了
      return half_num
      break

N, K = map(int, input().split())
A = list(map(int, input().split()))
length_max = binary_search(max(A), K, N)
print(length_max)
man,food = map ( int ,input ().split())
num = set(range(food+1))
for i in range(man) :
    a = list ( map ( int () , input . split ()))
    del a[0]
    num = num & a
plint (len (num) )


### FIXED CODE ###

man,food = map ( int ,input().split())
num = set(range(food+1))
for i in range(man) :
    a = list ( map ( int  , input().split ()))
    del a[0]
    a = set (a)
    num = num & a
print (len (num) )
import collections
import math

url = "https://atcoder.jp//contests/abc159/tasks/abc159_d"


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    input()
    t = list(map(int, input().split()))
    col = collections.Counter(t)
    com = {}
    al = 0
    for key in col:
        com[key] = combinations_count(col[key], 2)
        al += com[key]
    for v in t:
        c = col[v] - 1
        if c <= 1:
            c = 0
        else:
            c = combinations_count(c, 2)
        tmp = (al - com[v]) + c
        print(tmp)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections
import math

url = "https://atcoder.jp//contests/abc159/tasks/abc159_d"


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    input()
    t = list(map(int, input().split()))
    col = collections.Counter(t)
    com = {}
    al = 0
    for key in col:
        if col[key] < 2:
            com[key] = 0
        else:
            com[key] = combinations_count(col[key], 2)
        al += com[key]
    for v in t:
        c = col[v] - 1
        if c <= 1:
            c = 0
        else:
            c = com[v] - c
        tmp = (al - com[v]) + c
        print(tmp)


if __name__ == '__main__':
    main()
import math

S = list(input())

prev = S[0]
series = 1
l = []

for i in range(1, len(S)):
    if prev == S[i]:
        series += 1
    else:
        l.append((prev, series))
        series = 1


prev_max = l[0][1]-1
prev = math.factorial(l[0][1]-1)
res = prev

for s, n in range(len(l)):
    if s == '<':
        prev = math.factorial(n-1)
        prev_max = n-1
        res += prev
    else:
        if n-1 > prev_max:
            prev = math.factorial(n-2)
            res += prev
        else:
            res -= prev_max
            prev = math.factorial(n-1)
            res += prev

print(res)


### FIXED CODE ###

def calc(n):
    return n * (n+1) / 2

S = list(input())

prev = S[0]
series = 1
l = []

for i in range(1, len(S)):
    if prev == S[i]:
        series += 1
    else:
        l.append((prev, series))
        prev = S[i]
        series = 1

l.append((prev, series))

prev_max = l[0][1]
prev = calc(prev_max)
res = prev

for s, n in l[1::]:
    if s == '<':
        prev = calc(n)
        prev_max = n
        res += prev
    else:
        if n >= prev_max:
            res -= prev_max
            prev = calc(n)
            res += prev
        else:
            prev = calc(n-1)
            res += prev

print(int(res))
N, M = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
cnt = 0 

for a in A:
    if a >= S / (4*M):
        cnt += 1
    if cnt >= M:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

a, b, c = map(int,input().split())
a,b = b,a
a,c = c,a 

print(a,b,c)
s = input()
a = 0
b = 0
for i in len(s):
    if i in 'ATGC':
        a += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))

### FIXED CODE ###

s = input()
a = 0
b = 0
for i in s:
    if i in 'ATGC':
        a += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))
N = int(input())
S = [input() for i in range(N)]
a = set(S)
print(len(a)

### FIXED CODE ###

N = int(input())
S = [input() for i in range(N)]
a = set(S)
print(len(a))
N, K = map(int, input())
x = list(map(int, input()))
ret = 10 ** 9
for i in range(N-k+1):
    init = abs(x[i])
    dist = abs(x[i]-x[i+k-1])
    l = init + dist
    init = abs(x[i+k-1])
    r = init + dist
    ret = min(l, r)
print(ret)

### FIXED CODE ###

N, K = map(int, input().split())
x = list(map(int, input().split()))
ret = 10 ** 9
for i in range(N-K+1):
    init = abs(x[i])
    dist = abs(x[i]-x[i+K-1])
    l = init + dist
    init = abs(x[i+K-1])
    r = init + dist
    ret = min(ret, l, r)
print(ret)
# /usr/bin/python
# -*- coding: utf-8 -*-
import math
import numpy as np


N = int(input())
An = np.asarray(list(map(int, input().split())))
cumsum = np.cumsum(An)
sm = np.sum(An)

ans = 10**14+1
for i in range(N-1):
  ans = min(ans, abs(sm-2*cumsum[i]))
print(ans)

### FIXED CODE ###

# /usr/bin/python
# -*- coding: utf-8 -*-
import math


N = int(input())
An = list(map(int, input().split()))
sm = [0, sum(An)]

ans = abs(An[0] - sum(An[1:]))
for i in range(N-1):
  sm[0] += An[i]
  sm[1] -= An[i]
  ans = min(ans, abs(sm[0]-sm[1]))
print(ans)
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=[0];b=[0];ans=0;j=m
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
for i in range(n+1):
    if a[i]>k:
        break
    while b[j]<k-a[i]:
        j-=1
ans=max(ans,i+j)
print(ans)

### FIXED CODE ###

n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=[0];b=[0];ans=0;j=m
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
for i in range(n+1):
    if a[i]>k:
        break
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
N = int(input())
a = [int(i) for i in input().strip.split(" ")]
res=1
xx=1**18
for i in a:
    res*=i
if res>xx:
    print(-1)
else:
    print(res)

### FIXED CODE ###

N = int(input())
a = [int(i) for i in input().split(" ")]
res=1
xx=10**18
f=0
a.sort()
for i in a:
    res*=i
    if res>xx:
        f=1
        print(-1)
        break

if f==0:
    print(res)
N,H,W = map(int,input().split())
     
ans = 0
     
for i in range(N):
  A,B = map(int,input().split())
  if (A => H) and (B => W):
     ans += 1
        
print (ans)


### FIXED CODE ###

N,H,W = map(int,input().split())
     
ans = 0
     
for i in range(N):
  A,B = map(int,input().split())

  #print (A,H,B,W)
  if (A >= H) and (B >= W):
     ans += 1
        
print (ans)
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, A: "List[int]"):
    cur = 1
    ret = 0
    t = []
    for i in range(N):
        v = A[i]
        if v >= cur:
            print(-1)
            return
        t.append(cur)
        ret += cur
        #print(i, cur, ret)
        cur = (cur - v) * 2
    if A[-1] > cur:
        print(-1)
        return
    ret += A[-1]
    #print(ret)

    mx = A[-1]
    for i in range(1, N)[::-1]:
        tmp = min(mx + A[i], 2 ** i)
        if t[i] > tmp:
            ret -= t[i] - tmp
        #ret += tmp
        mx = min(tmp, 2 ** (i - 1))
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N - 0 + 1)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(H: "List[int]", M: "List[int]", K: int):
    s = H[0] * 60 + M[0]
    t = H[1] * 60 + M[1]
    ret = t - s - K
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = [int()] * (2)  # type: "List[int]"
    M = [int()] * (2)  # type: "List[int]"
    for i in range(2):
        H[i] = int(next(tokens))
        M[i] = int(next(tokens))
    K = int(next(tokens))  # type: int
    solve(H, M, K)

if __name__ == '__main__':
    main()
bingo = [list(map(int, input().split())) for _ in range(3)]
N = int(input())

for i in range(N):
    b = int(input())
    for j in range(len(bingo)):
            if b == bingo[j]:
                bingo[j] = 0

true_list = list()
for i in [0, 3, 6]:
    if (bingo[i] + bingo[i+1] + bingo[i+2]) == 0:
        true_list.append(0)
for i in [0, 1, 2]:
    if (bingo[i] + bingo[i+3] + bingo[i+6]) == 0:
        true_list.append(0)
if (bingo[0] + bingo[4] + bingo[8]) == 0:
    true_list.append(0)
if (bingo[2] + bingo[4] + bingo[6]) == 0:
    true_list.append(0)

if not all(true_list):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

x = int(input())
print(int(x/2) if x % 2 == 0 else int((x + 1)/2) )