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

s = 1
place = [s]
first = set(place)

for i in range(n):
    s = a[s-1]
    if s in first:
        loops = place.index(s)
        loope = len(place)
        ans = loops + (k-loope) % (loope-loops)
        print(place(ans))
        break
    else:
        place.append(s)
        first.add(s)
else:
    print(s)

### FIXED CODE ###

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

s = 1
place = [s]
first = set(place)

for i in range(1, k+1):
    s = a[s-1]
    if s in first:
        loops = place.index(s)
        loope = len(place)
        ans = loops + (k-loope) % (loope-loops)
        print(place[ans])
        exit()
    else:
        place.append(s)
        first.add(s)

print(s)
N = int(input())

array = list(map(int, input().split())).sort()

print(array[N//2]-array[N//2-1])

### FIXED CODE ###

N = int(input())

array = sorted(list(map(int, input().split())))

print(array[N//2]-array[N//2-1])
N = int(input())
L = list(map(int, input().split()))
C = sorted(L)
def X(n,j):
    L1 = j+1
    L2 = N-1
    while L1 != L2:
        a = (L1+L2)//2
        if C[a] == n:
            while C[a] == C[a-1]:
                a = a-1
            if j+1 <= a:
                return len(C[j+1:a])
            else:
                return 0
        elif L2 - L1 <= 1:
            while C[L1] == C[L1-1]:
                L1 = L1-1
            if C[L1] > n:
                return len(C[j+1:L1])
            elif C[L1] < n < C[L2]:
                return len(C[j+1:L2])
            else:
                return len(C[j+1:L2+1])
        elif C[a] < n:
            L1 = a
        else:
            L2 = a
    if C[L1] < n:
        return 1
    else:
        return 0
ans = 0
# print(C)
for i in range(N-2):
    for j in range(i+1,N-1):
        # print(X((C[i]+C[j]),j))
        ans += X((C[i]+C[j]),j)
print(ans)

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
C = sorted(L)
def X(n,j):
    L1 = j+1
    L2 = N-1
    while L1 != L2:
        a = (L1+L2)//2
        if C[a] == n:
            while C[a] == C[a-1]:
                a = a-1
            return len(C[j+1:a])
        elif L2 - L1 <= 1:
            if C[L2] < n:
                return len(C[j+1:L2+1])
            elif C[L1] < n <= C[L2]:
                return len(C[j+1:L2])
            while C[L1] == C[L1-1]:
                if j+1 <= L1-1:
                    L1 = L1-1
                else:
                    break
            if C[L1] > n:
                return len(C[j+1:L1])
            elif C[L1] == n:
                return len(C[j+1:L1])
        elif C[a] < n:
            L1 = a
        else:
            L2 = a
    if C[L1] < n:
        return 1
    else:
        return 0
ans = 0
# print(C)
for i in range(N-2):
    for j in range(i+1,N-1):
        # print(X((C[i]+C[j]),j))
        ans += X((C[i]+C[j]),j)
print(ans)
for x in raw_input():
    if x.islower():
        print x.upper()
    elif x.isupper()
        print x.lower()

### FIXED CODE ###

z = ""
for x in raw_input():
    if x.islower():
        z += x.upper()
    else:
        z += x.lower()

print z
n, q = map(int, input().split())
p = [input().split() for _ in range(n)]
t = i = 0
while n:
    i = i % n
    if int(p[i][1]) <= q:
        t += int(p[i][1])
        print(p[i][0], t)
        del p[i]
        n -= 1
    else:
        p[i][1] -= int(p[i][1]) - q
        t += q
        i += 1

### FIXED CODE ###

n, q = map(int, input().split())
p = [input().split() for _ in range(n)]
t = i = 0
while n:
    i = i % n
    if int(p[i][1]) <= q:
        t += int(p[i][1])
        print(p[i][0], t)
        del p[i]
        n -= 1
    else:
        p[i][1] = int(p[i][1]) - q
        t += q
        i += 1
n = input()
[s,t] = [i for i in input().split()]
ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]
print(ans)

### FIXED CODE ###

n = int(input())
[s,t] = [i for i in input().split()]
ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]
print(ans)
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)
ans = 0

if N%2 == 1:
	k = (N+1)/2
	for i in range(k):
		ans += A[i]*2
	ans -= A[0]
	ans -= A[k]
else:
	k = N/2
	for i in range(k):
		ans += A[i]*2
	ans -= A[0]

print(ans)

### FIXED CODE ###

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

A.sort(reverse=True)
ans = 0

for i in range(N-1):
	ans += A[(i+1)//2]

print(ans)
cards = {
				'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
}
n = int(input())
for _ in range(n):
	(s, r) = input.().split()
	cards[s][int(r) - 1] = 1

for s in ('S', 'H', 'C', 'D',):
	for r in range(13):
		if cards [s] [r] == 0:
			print(s, r + 1)

### FIXED CODE ###

cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
}
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    cards[s][int(r) - 1] = 1
    
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print(s, r + 1)
tep = input()
if tep<-40 or tep>40:
  break
elif tep >=30:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

temp = input()
temp = int(temp)
if temp<-40 or temp>40:
    print('Out')    
elif temp >=30: 
    print('Yes')
else:
    print('No')
import math

n=int(input())
t=[]
for i in range(n):
    t.append(int(input()))

if n == 1:
    ans=1
else:
    ans=math.gcd(t[0],t[1])

if n > 2:
    for j in range(2,n):
        ans=gcd(ans,t[j])

seki=1
for i in t:
    seki=seki*i
    
print(int(seki/ans))

### FIXED CODE ###

import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
n=int(input())
t=[int(input()) for i in range(n)] 
 
print(lcm_list(t))
n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(manhattan(xs, ys))
print(euclid(xs, ys))
print(l3(xs, ys))
print(chev(xs, ys))

norm()

### FIXED CODE ###

import math

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

print(sum(map(lambda v: math.fabs(v[0] - v[1]), zip(x, y))))
print(sum(map(lambda v: math.fabs((v[0] - v[1]) ** 2), zip(x, y))) ** (1/2))
print(sum(map(lambda v: math.fabs((v[0] - v[1]) ** 3), zip(x, y))) ** (1/3))
print(max(map(lambda v: math.fabs(v[0] - v[1]), zip(x, y))))
import math
A, B = input().split()

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

ans = lcm(int(A), int(B))
print(ans)

### FIXED CODE ###

import fractions
A, B = map(int, input().split())

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

ans = lcm(A, B)
print(ans)
base = input()

if base == 'A':
  print('T')
elif base == 'T':
  print('A')
elif base =- 'C':
  print('G')
else:
  print('C')

### FIXED CODE ###

base = input()

if base == 'A':
  print('T')
elif base == 'T':
  print('A')
elif base == 'C':
  print('G')
else:
  print('C')
import sys

def debug(*args):
    print(*args, file=sys.stderr)

# https://www.themathpage.com/Alg/difference-two-squares-2.htm#fifth

# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8
def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def get_factors_of(a_number):
    factorized = factorize(a_number)
    return [factor for factor, _ in factorized]


x_diff_of_5th_factor = int(input())

factors_of_x = get_factors_of(x_diff_of_5th_factor)

# debug(factors_of_x)

for a_factor_of_x in factors_of_x:
    for a in range(a_factor_of_x+1):
        b = a - a_factor_of_x

        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)
sys.exit(1)


### FIXED CODE ###

import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-118, 119):
    for b in range(-119, 118):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)
x, y =  map(int, input().split())
i = 1
if x % y == 0;
    print(-1)
else:
    for i in range(10 ** 18 + 1):
        if (i * x) % y != 0:
            print(i * x)
            break
        else:
            continue


### FIXED CODE ###

x, y =  map(int, input().split())
i = 1
if x % y == 0:
    print(-1)
else:
    for i in range(10 ** 18 + 1):
        if (i * x) % y != 0:
            print(i * x)
            break
        else:
            continue
list = input().split()
x,y,z = list[0],list[1],list[2]
num = x%(y+z)
if num >= y:
    print((x/(y+z))+1)
else:
    print(x/(y+z))

### FIXED CODE ###

list = input().split()
x,y,z = int(list[0]),int(list[1]),int(list[2])
x -= z * 2
num = x % (y+z)
if num >= y:
    print((x//(y+z))+1)
else:
    print(x//(y+z))
N = input().split()

N[0] = int(N[0])
N[1] = int(N[1])
N[2] = int(N[2])

if(N[0] == 1):
    print("0")
    exit(1)

if(N[1] > N[2]):
    print("0")
    exit(1)

print((N[2] * (N[0] -1) + N[1]) - (N[1] * (N[0] - 1) + N[2]) + 1)


### FIXED CODE ###

N = input().split()

N[0] = int(N[0])
N[1] = int(N[1])
N[2] = int(N[2])

if(N[0] == 1):
    if(N[1] == N[2]):
        print("1")
        exit()
    print("0")
    exit()

if(N[1] > N[2]):
    print("0")
    exit()

print((N[2] * (N[0] -1) + N[1]) - (N[1] * (N[0] - 1) + N[2]) + 1)
#coding utf-8
A,B,K= map(int,input().split())
y = list(range(A,B + 1))
#for i in y[0:K]:
  #  print(i)

print(y[-1:-K-1:-1])

### FIXED CODE ###

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

if (b-a+1) > 2*k:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)
N, M = map(int, input().split())

G = {i:[] for i in range(1, N + 1)}

for i in range(M):
    x, y = map(int, input().split())
    G[x].append(y)

def dfs(num):
    if dp[num] != -1:
        return dp[num]

    res = 0
    for obj in G[num]:
        res = max(res, dfs(obj) + 1)

    dp[num] = res
    return res

dp = [-1] * (N + 1)

res = 0
for i in range(1, N + 1):
    res = max(res, dfs(i))

print(res)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

#import math
#import numpy as np
#= int(input())
#= input()
#= map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]
def dfs(num):
    if dp[num] != -1:
        return dp[num]

    res = 0
    for obj in G[num]:
        res = max(res, dfs(obj) + 1)

    dp[num] = res
    return res


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

dp = [-1] * N
G = {i:[] for i in range(N)}

for _ in range(M):
    x, y = map(int, input().split())
    G[x - 1].append(y - 1)

res = 0
for i in range(N):
    res = max(res, dfs(i))

print(res)
n,m=map(int,input().split())
if n==1 and m==1:
    print(1)
elif n==1 or M==1:
    print(n*m-2)
else:
    print((m-2)*(n-2))


### FIXED CODE ###

n,m=map(int,input().split())
if n==1 and m==1:
    print(1)
elif n==1 or m==1:
    print(n*m-2)
else:
    print((m-2)*(n-2))
A = int(input())
print(int(input())*A)

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
from collections import deque
    H,W=map(int,input().split())
    white=0
    s=[]
    for y in range(H):
        line=input()
        white+=line.count('.')
        s.append(list(line))
     
    q = deque([(0,0,1)])
    q_append=q.append
    q_popleft=q.popleft
    while q:
        x,y,l=q_popleft()
        if s[y][x]!='.':
            continue
        if x==W-1 and y==H-1:
            print(white-l)
            break
        for d in [(1,0),(0,1),(-1,0),(0,-1)]:
            nx, ny=(x+d[0],y+d[1])
            if 0<=nx<W and 0<=ny<H:
                q_append((nx,ny,l+1))
    else:
        print(-1)
        

### FIXED CODE ###

n=int(input())
a=int(input())
m=n%500-a
if m<=0:
    print("Yes")
else:
    print("No")
if a * b % 2 == 0:
  print(Even)
else:
  print(Odd)

### FIXED CODE ###

li = input().split()
a = int(li[0])
b = int(li[1])
if (a * b) % 2 == 0:
    print("Even")
else:
    print("Odd")
import math
def calc(x, y, z):
    return x * x + y * y + z * z + x * y + y * z + z * x

def calc_combination_num(x, y, z):
    if x == y and y == z:
        # 全部同じ数字なら組み合わせの個数は1個
        return 1
    if x == y or y == z:
        # どれか2つが同じ数字なら組み合わせの個数は3C2 = 3個
        return 3
    # 全部違う数字なら組み合わせの個数は3P2 = 6個
    return 6

N = int(input())

result_map = {}
for i in range(1, N):
    result_map[i] = 0

# x <= y <= zとしてループを回し
for x in range(1, N):
    tempFn1 = calc(x, 0, 0)
    if tempFn1 > N:
        # もう数値は増える一方なのでやる必要なし
        break
    for y in range(x, N):
        tempFn2 = calc(x, y, 0)
        if tempFn2 > N:
            # もう数値は増える一方なのでやる必要なし
            break
        for z in range (y, N):
            fn = calc(x, y, z)
            if fn > N:
                # もう数値は増える一方なのでやる必要なし
                break
            # 組み合わせの個数の算出
            combination_num = calc_combination_num(x, y, z)
            result_map[fn] = result_map[fn] + combination_num

for result in result_map.values():
    print(result)


### FIXED CODE ###

import math
def calc(x, y, z):
    return x * x + y * y + z * z + x * y + y * z + z * x

def calc_combination_num(x, y, z):
    if x == y and y == z:
        # 全部同じ数字なら組み合わせの個数は1個
        return 1
    if x == y or y == z:
        # どれか2つが同じ数字なら組み合わせの個数は3C2 = 3個
        return 3
    # 全部違う数字なら組み合わせの個数は3P2 = 6個
    return 6

N = int(input())

result_map = {}
for i in range(1, N + 1):
    result_map[i] = 0

# x <= y <= zとしてループを回し
for x in range(1, N):
    tempFn1 = calc(x, 0, 0)
    if tempFn1 > N:
        # もう数値は増える一方なのでやる必要なし
        break
    for y in range(x, N):
        tempFn2 = calc(x, y, 0)
        if tempFn2 > N:
            # もう数値は増える一方なのでやる必要なし
            break
        for z in range (y, N):
            fn = calc(x, y, z)
            if fn > N:
                # もう数値は増える一方なのでやる必要なし
                break
            # 組み合わせの個数の算出
            combination_num = calc_combination_num(x, y, z)
            result_map[fn] = result_map[fn] + combination_num

for result in result_map.values():
    print(result)
#coding utf=8
a,b = map(int,input().split())
if a > b:
	print(“a > b”)
elif a < b:
	print(“a < b”)
else:
	print(“a == b”)


### FIXED CODE ###

a,b = map(int, input().split())
if a > b:
 print("a > b")
elif a < b:
 print("a < b")
else:
 print("a == b")
A, B, K = map(int, input().split())

list2 = [ A + K , B - K]
list3 = list(range(min(list2),max(list2)+1))
i = A
while i <= B:
    if i not in list3:
        print(i)
    elif A > B - K:
        print(i)
    i += 1


### FIXED CODE ###

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

list2 = [ A + K - 1 , B - K + 1]
if A + K - 1 >= B - K +1 or A > B - K:
    i = A
    while i <= B:
        print(i)
        i += 1
else:
    i = A
    while i <= A + K - 1:
        print(i)
        i += 1
    i = B - K + 1
    while i <= B:
        print(i)
        i += 1
print(chr(ord(S[i]) + N - 90 + 65), end="")

N = int(input())
S = input()

for i in range(len(S)):
    if (ord(S[i]) + N) > 90:
        print(chr(ord(S[i]) + N - 90 + 64), end="")
    else:
        print(chr(ord(S[i]) + N ), end="")
    

### FIXED CODE ###

N = int(input())
S = input()

alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

ans =[]

for i in range(len(S)):
    for j in range(26):
        if S[i] == alpha[j]:
            ans.append(alpha[j+N])

for i in range(len(ans)):
    print(ans[i], end ="")
N = int(input())
B = list(map(int,input().split()))
cnt = B[0]+B[N-2]
for i in range(1,N-1):
    cnt += min(B[i-1],B[i])
print(cnt)

### FIXED CODE ###

N,K = map(int,input().split())
S = list(input())
a = S[0]
cur = 0
cnt = 0
for i in range(N):
    if S[i] != a:
        cnt += i-cur-1
        a = S[i]
        cur = i
if S[N-1]==a:
    cnt += N-cur-1
print(min(cnt+2*K,N-1))
import math
from collections import Counter

n, m = map(int, input().split())
mod = 10**9 + 7

K = 20
fact = [0] * (n+1+K)
ifact = [0] * (n+1+K)
fact[0] = 1
for i in range(1,n+1+K):
    fact[i] = fact[i-1] * i % mod
ifact[n+K] = pow(fact[n+K], mod-2, mod)
for i in reversed(range(1,n+1+K)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n > i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
for k in counter.values():
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)

### FIXED CODE ###

import math
from collections import Counter

n, m = map(int, input().split())
mod = 10**9 + 7

K = 50
fact = [0] * (n+1+K)
ifact = [0] * (n+1+K)
fact[0] = 1
for i in range(1,n+1+K):
    fact[i] = fact[i-1] * i % mod
ifact[n+K] = pow(fact[n+K], mod-2, mod)
for i in reversed(range(1,n+1+K)):
    ifact[i-1] = ifact[i] * i % mod

def comb(n, k):
    return fact[n] * ifact[n-k] % mod * ifact[k] % mod

def getprime(n):
    primes = []
    i = 2
    while n >= i * i:
        while n % i == 0:
            n //= i
            primes.append(i)
        i += 1
    if n != 1:
        primes.append(n)
    return primes

ans = 1
counter = Counter(getprime(m))
for k in counter.values():
    ans *= comb(n+k-1, k)
    ans %= mod
print(ans)
n,h = map(int ,raw_input().split())
ais = [map(int, raw_input().split()) for _ in range(n)]
mem = {}
def dfs(i, ais, h):
	if i == len(ais) or h <= 0:
		return 0 if h <= 0 else +float('inf')
	if (i,h) not in mem:
		mem[(i,h)] = min(dfs(i+1, ais, h - ais[i][1]) + 1,
		dfs(i, ais, h - ais[i][0]) + 1,
		dfs(i+1, ais, h),)
	return mem[(i,h)]
print dfs(0 , ais, h)

### FIXED CODE ###

import math
n,h = map(int ,raw_input().split())
ais = [map(int, raw_input().split()) for _ in range(n)]
ais.sort(key = lambda x: (-x[1],x[0]))
cumul = 0
r = +float('inf')
m = max(ais)[0]
for i in range(-1,len(ais)):
	if i >= 0:
		cumul += ais[i][1]

	if cumul >= h:
		r = min(r, (i+1))
		break
	else:
		r = min(r, i+1 + math.ceil(abs(h - cumul) /  float(m)))
print int(r)
h.append(xyh[2])

for i in range(101):
	for j in range(101):
		for k in range(n):
			if h[k] != 0:
				height = abs(i-x[k]) + abs(j-y[k]) + h[k]
				break
			
		flag = 0
		for k in range(n):
			if h[k] != max(height- abs(i-x[k]) - abs(j-y[k]) , 0):
				flag = 1
				break
			
		if flag == 0:
			ans = [i,j,height]
			break
		
	
print('{0} {1} {2}'.format(ans[0], ans[1], ans[2]))

### FIXED CODE ###

n = int(input())
x = []
y = []
h = []
ans = [0,0,0]
for i in range(n):
	xyh = list(map(int, input().split()))
	x.append(xyh[0])
	y.append(xyh[1])
	h.append(xyh[2])

for i in range(101):
	for j in range(101):
		for k in range(n):
			if h[k] != 0:
				height = abs(i-x[k]) + abs(j-y[k]) + h[k]
				break
			
		flag = 0
		for k in range(n):
			if h[k] != max(height- abs(i-x[k]) - abs(j-y[k]) , 0):
				flag = 1
				break
			
		if flag == 0:
			ans = [i,j,height]
			break
		
	
print('{0} {1} {2}'.format(ans[0], ans[1], ans[2]))
X = int(input())
'''
numの順番によっては買うことが出来ない金額が発生するためNG
num = [105, 104, 103, 102, 101, 100]

f = 0
for i in range(2**6):
    XX = X
    for j in range(6):
        if (i>>j)&1:
            XX %= num[j]
            if XX == 0:
                f = 1
print(f)
'''

num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X)]
dp[0] = 1
f = 1

for i in range(X):
    for j in num:
        if i-j >= 0
            if dp[i-j]:
                dp[i] = 1

for i in num:
    if not dp[X-i]:
        f = 0

print(f)

### FIXED CODE ###

X = int(input())
num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X+1)]
dp[0] = 1
f = 1

for i in range(X+1):
    for j in num:
        if i-j >= 0:
            if dp[i-j]:
                dp[i] = 1

print(dp[X])
n = int(input())
a = list(map(int, input().split()))
if 0 in numlist:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)
a,b,x=map(int,input().split())
print((b-a)//x) if (b%x != 0 and %x != 0) else print((b-a)//x+1)

### FIXED CODE ###

a,b,x=map(int,input().split())
print((b//x)-((a-1)//x))
import bisect, collections

def solution():
    n = input().strip()
    print(n//2)
    

    

def main():    
    # T = int(input().strip())
    for _ in range(1):
        solution()
    

main()

### FIXED CODE ###

import bisect, collections

def solution():
    n = input().strip()
    print((int(n)+1)//2)
    

    

def main():    
    # T = int(input().strip())
    for _ in range(1):
        solution()
    

main()
v=int(input())
#文字列
s=[0]*v
x=0
for i in range(v):
    x=int(input())
    s[x-1]=i+1
for i in range(v-1):
    print(s[i]," ",sep="",end="")
print(s[v-1])

### FIXED CODE ###

def o(a):
    for i in range(len(a)):
        a[i]=[a[i],i+1]
    return a             

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

a=o(a)

q=[0]*n

for i in range(len(a)):
    q[a[i][0]-1]=a[i][1]

for i in q:
    print(i," ",end='')
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len[1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i+100*m<=s])

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len([1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i-100*m<=s]))
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
r = 0
a = 0
for i in range(N):
    r += B[A[i]-1]
    if  i-1 > len(C)-1:
        continue
    elif A[i] == a+1 :
        r += C[A[i-1]-1]
    a = A[i]
print(r)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
r = 0
a = 0
for i in range(N):
    r += B[A[i]-1]
    if  A[i]-1 > len(C):
        continue
    elif A[i] == a+1 and A[i] != 1:
        r += C[a-1]
    a = A[i]
print(r)
n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[n+1])

### FIXED CODE ###

n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[n-1])
n = int(input())
lst = []

for i in range(n):
  item = int(input())
  goods.append(item)

goods = sorted(lst, reverse=True)
goods[0] = goods[0] // 2

print(sum(goods))


### FIXED CODE ###

n = int(input())
lst = []

for i in range(n):
  item = int(input())
  lst.append(item)

goods = sorted(lst, reverse=True)
goods[0] = goods[0] // 2

print(sum(goods))
R = int(input())
G = int(intpu())
print(2*G-R)

### FIXED CODE ###

R = int(input())
G = int(input())
print(2*G-R)