Harryxun/stf_run huggingface dataset:
from collections import deque

def isCLKWISE(ph):
    return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            if isCLKWISE(phU) : break
            else :
                del phU[-2]
                if len(phU) == 2 : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            if isCLKWISE(phL) : break
            else :
                del phL[-2]
                if len(phL) == 2 : break
    ph = phU + phL[1:-1]
    return ph
  
n = range(int(input()))
P = []
for i in n : P.append([int(x) for x in input().split()])
Q = deque(ConvexHullScan(P))
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
Q.rotate(idx)
for r in Q : print(q[0],q[1])

### FIXED CODE ###

def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            try :
                if isCLKWISE(phU) : break
                else : del phU[-2]
            except IndexError : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            try :
                if isCLKWISE(phL) : break
                else : del phL[-2]
            except IndexError : break
    ph = phU + phL[1:-1]
    return ph
  
P = [[int(x) for x in input().split()] for _ in range(int(input()))]
P = ConvexHullScan(P)
P.reverse()
print(len(P))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(P)])[2]
for p in P[idx:] + P[:idx] : print(p[0],p[1])
import sys
input=lambda: sys.stdin.readline().rstrip()
mod=10**9+7
n=int(input())
edge=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)
inf=float("inf")
Par=[inf]*n
Par[0]=-1
Chk=[0]
while Chk:
  c=Chk.pop()
  for next in edge[c]:
    if Par[next]==inf:
      Par[next]=c
      Chk.append(next)

C=[-1]*n
def ch(x):
  ret=0
  if x!=0 and len(edge[x])==1:
    C[x]=0
    return C[x]
  else:
    for e in edge[x]:
      if e==Par[x]:
        continue
      else:
        ret+=ch(e)+1
    C[x]=ret
    return C[x]
ch(0)

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

ans=0
for i in range(n):
  if len(edge[i])==1 or C[i]==0:
    continue
  else:
    A=[]
    for e in edge[i]:
      if e==Par[i]:
        A.append(n-1-C[i])
      else:
        A.append(C[e]+1)
    cur=1+(len(edge[i])-1)*H[-1]
    for a in A:
      cur-=H[n-1-a]
    ans=(ans+cur)%mod
print((ans*H[1])%mod)

### FIXED CODE ###

import sys
input=lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(200000)
mod=10**9+7
n=int(input())
edge=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)
inf=10**6
Par=[inf]*n
Par[0]=-1
Chk=[0]
while Chk:
  c=Chk.pop()
  for next in edge[c]:
    if Par[next]==inf:
      Par[next]=c
      Chk.append(next)

C=[-1]*n
def ch(x):
  ret=0
  if x!=0 and len(edge[x])==1:
    C[x]=0
    return C[x]
  else:
    for e in edge[x]:
      if e==Par[x]:
        continue
      else:
        ret+=ch(e)+1
    C[x]=ret
    return C[x]
ch(0)

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

ans=0
for i in range(n):
  if len(edge[i])==1:
    continue
  else:
    A=[]
    for e in edge[i]:
      if e==Par[i]:
        A.append(n-1-C[i])
      else:
        A.append(C[e]+1)
    cur=1+(len(edge[i])-1)*H[-1]
    for a in A:
      cur-=H[n-1-a]
    ans=(ans+cur)%mod
print((ans*H[1])%mod)
N, M = map(int, input().split())
nodes = [[] for _ in range(N)]

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

dp = [-1] * N

def judge(index):
  if dp[index] != -1:
    return dp[index]
  else:
    edges = 0
    for i in nodes[index]:
      edges = max(edges, 1+judge(i))
    dp[index] = edges
    return dp[index]
    
for i in range(N):
  judge(i)
print(max(dp))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5 + 1)

N, M = map(int, input().split())
nodes = [[] for _ in range(N)]

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

dp = [-1] * N

def judge(index):
  if dp[index] != -1:
    return dp[index]
  else:
    edges = 0
    for i in nodes[index]:
      edges = max(edges, 1+judge(i))
    dp[index] = edges
    return edges

answer = 0  
for i in range(N):
  answer = max(answer, judge(i))
print(answer)
from itertools import groupby
from heapq import heapify, heappop

N, K = map(int, input().split())
sushi = [tuple(map(int, input().split())) for _ in range(N)]


def point(sushi):
    t, d = zip(*sushi)
    return sum(d) + len(set(t))**2


srt = sorted(sushi, key=lambda x: x[1], reverse=True)
eat, non_eat = srt[:K], srt[K:]

maxs = []
rems = []
kinds = set()
for k, g in groupby(sorted(eat, key=lambda x: x[0]), key=lambda x: x[0]):
    _, d = zip(*g)
    maxs.append(d.pop(0))
    rems.extend(d)
    kinds.add(k)
heapify(rems)
ans = point(eat)

for k, g in groupby(sorted(non_eat, key=lambda x: x[0]), key=lambda x: x[0]):
    if k in kinds:
        continue
    _, d = zip(*g)
    maxs.append(d.pop(0))
    heappop(rems)
    kinds.add(k)
    ans = max(ans, point(maxs + rems))

print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
sushi = [list(map(int, input().split())) for _ in range(N)]
sushi.sort(key=lambda x: x[1], reverse=True)

score = 0

remains = []
kinds = set()
for t, d in sushi[:K]:
    if t in kinds:
        remains.append(d)
    kinds.add(t)
    score += d
score += len(kinds)**2

test = score
for t, d in sushi[K:]:
    if not remains:
        break
    if t in kinds:
        continue
    kinds.add(t)
    rm = remains.pop()
    test = test + (d - rm) + (len(kinds)*2 - 1)
    score = max(score, test)

print(score)
N = int(input())
A = [int(x) for x in input().split()]

sa = sorted(A)
import math
from bisect import *
hv = sa[-1] / 2
hl, hr = math.floor(hv), math.ceil(hv)
ri = bisect_right(sa, hv)

import operator
import functools
def dist(x):
    if x <= hl:
        return functools.reduce(operator.imul, range(hl, x, -1)) / functools.reduce(operator.imul, range(hr, hr + (hl - x) + 1))
    else:
        return functools.reduce(operator.imul, range(hr, hr + (x - hr) + 1)) / functools.reduce(operator.imul, range(x, hl, -1))

if ri == 0:
    print(sa[-1], sa[ri])
elif len(sa) == 2:
    print(sa[1], sa[0])
else:
    print(sa[-1], sa[ri - 1] if dist(sa[ri - 1]) > dist(sa[ri]) else sa[ri])

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]

sa = sorted(A)
from bisect import *
hv = sa[-1] / 2
ri = bisect_right(sa, hv)

if ri == 0:
    print(sa[-1], sa[ri])
elif len(sa) == 2:
    print(sa[1], sa[0])
else:
    print(sa[-1], sa[ri - 1] if abs(sa[ri - 1] - hv) < abs(sa[ri] - hv) else sa[ri])
a, b = map(int,input(),split())
if (a*b) % 2 == 0:
    print("Odd")
else:
    print("Even")


### FIXED CODE ###

a, b = map(int,input().split())
if (a*b)%2 :
    print("Odd")
else:
    print("Even")
import math
n, k = map(int, input().split())
p = 0.0
for i in range(1,n+1):
    if i < k:
        x = math.ceil(math.log((float(k) / float(i)), 2))
        print "---"
        print x
        print i * (2 ** x)
        p += (float(1) / float(n)) * ((0.5) ** x)
    else:
        p += (float(1) / float(n))

print p

### FIXED CODE ###

import math
n, k = map(int, raw_input().split())
p = 0.0
for i in range(1,n+1):
    if i < k:
        x = math.ceil(math.log((float(k) / float(i)), 2))
        p += (float(1) / float(n)) * ((0.5) ** x)
    else:
        p += (float(1) / float(n))

print p
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from heapq import heappush, heappushpop


def resolve():
    rl = sys.stdin.readline
    T = int(rl())
    if T == 3: raise 1

    ans = []
    for t in range(T):
        N = int(rl())

        val = 0
        a1 = [[] for i in range(N)]
        a2 = [[] for i in range(N)]

        for _ in range(N):
            i, v1, v2 = map(int, rl().split())
            i -= 1
            diff = v1 - v2
            if diff == 0 or i == N-1:
                val += v1
            elif diff > 0:
                a1[i].append(diff)
                val += v2
            else:
                i = N-1-i-1
                a2[i].append(-diff)
                val += v1

        for ax in (a1, a2):
            dq = []
            for i, aa in enumerate(ax):
                if not aa: continue
                for diff in aa:
                    ld = len(dq)
                    if ld <= i:
                        heappush(dq, diff)
                        val += diff
                    else:
                        df = heappushpop(dq, diff)
                        val += diff - df

        ans.append(val)


    print(*ans, sep="\n")



if __name__ == "__main__":
    resolve()


### FIXED CODE ###

#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
sys.setrecursionlimit(1000000000)

def resolve():
    it = map(int, sys.stdin.read().split())

    T = next(it)
    ans = []
    for i in range(T):
        N = next(it)

        val = 0; a1 = []; a2 = []
        for i, v1, v2 in ((next(it), next(it), next(it)) for i in range(N)):
            diff = v1 - v2
            a, v, diff = (a1, v2, diff) if diff >= 0 else (a2, v1, -diff)
            a.append((diff, i))
            val += v
        a1.sort(reverse=True); a2.sort(reverse=True)

        ls = len(a1)
        vis = [None]*(N+1)
        def root(x):
            if vis[x] == None: return x

            vis[x] = root(vis[x])
            return vis[x]
        def root(x):
            a = []
            while True:
                y = vis[x]
                if y == None:
                    break
                a.append(x)
                x = y
            for i in a:
                vis[i] = x
            return x

        for diff, i in a1:
            j = min(i, ls) - 1
            k = root(j)
            #print(diff, i, j, k,  vis)
            if k < 0: continue
            val += diff
            vis[k] = k - 1


        for diff, i in a2:
            j, v2 = max(i, ls), [[-1]]
            k = root(j)
            #print(diff, i, j, k,  vis)
            if k >= N: continue
            val += diff
            vis[k] = k + 1

        ans.append(val)

    print(*ans, sep="\n")



if __name__ == "__main__":
    resolve()
# 27
n,x = list(map(int, input().split()))
aa = list(map(int, input().split()))
aa.sort()
ans = 0
for a in aa:
    if x<a:
        break
    ans+=1
    x-=ai
else:    #for else文 - breakすると入らないことを利用=ループ完遂した場合の終端処理
    if x>0:
        ans-=1
print(ans)

### FIXED CODE ###

# 27
n,x = map(int, input().split())
aa = list(map(int, input().split()))
aa.sort()
ans = 0
for a in aa:
    if x<a:
        break
    ans+=1
    x-=a
else:    #for else文 - breakすると入らないことを利用=ループ完遂した場合の終端処理
    if x>0:
        ans-=1
print(ans)
a,b=map(int,input().split());print(sum(a>=b-s-t>=0for t in range(a+1)for s in range(a+1)))

### FIXED CODE ###

print(" ".join(input().split(",")))
a=int(input())
b=list(map(int,input().split()))
ans=1
for i in range(a):
  ans=ans*b[i]
  if ans>10**18:
  	ans=-1
    break
  
print(ans)


### FIXED CODE ###

a=int(input())
b=list(map(int,input().split()))
b.sort()
ans=1
for i in range(a):
  ans=ans*b[i]
  if ans>10**18:
    ans=-1
    break
  
print(ans)
S = input()
S.sort()
if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = list(input())
S.sort()
if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]:
  print("Yes")
else:
  print("No")
from sys import stdin
#f_i = stdin
f_i = open('test_in_3')#

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)

### FIXED CODE ###

from sys import stdin
f_i = stdin

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)
n, m = map(int, input().split())
a = list(map(int, input().split()))
  
print(max(-1, n - sum(a))


### FIXED CODE ###

R = int(input())
import math
pi = math.pi
print(2 * pi * R)
n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
i=0
while i<k:
  temp=a[temp-1]
  result.append(temp)
  if i+1!=result.index(temp):
    break
  i=i+1

l=len(result)
temp=result.index(result[l-1])
if k<l:
  print(result[k+1])
else:
  l2=l-1-temp
  print(result[temp+(k-temp)%l2])

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
result=[1]
temp=1
for i in range(n):
  temp=a[temp-1]
  result.append(temp)
temp=result.index(result[len(result)-1])
c=len(result)-temp-1
if k<n:
  print(result[k])
else:
  print(result[temp+(k-temp)%c])
s=input()
t=input()
print(t+s)

### FIXED CODE ###

s,t=input().split()
print(t+s)
def main():
    BK = '#'
    WH = '.'

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

    g = []
    for _ in range(50):
        g.append([BK] * 50)
    for _ in range(50):
        g.append([WH] * 50)

    r, c = 1, 1
    for w_cnt in range(A - 1):
        g[r][c] = WH
        c += 2
        if c > 99:
            c = 1
            r += 2

    r, c = 51, 1
    for b_cnt in range(B - 1):
        g[r][c] = BK
        c += 2
        if c > 99:
            c = 1
            r += 2

    print(100, 100)
    for row in g:
        print(*row, sep='')


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    BK = '#'
    WH = '.'

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

    g = []
    for _ in range(50):
        g.append([BK] * 100)  # 100にし忘れていた
    for _ in range(50):
        g.append([WH] * 100)

    r, c = 1, 1
    for _ in range(A - 1):
        g[r][c] = WH
        c += 2
        if c > 99:
            c = 1
            r += 2

    r, c = 51, 1
    for _ in range(B - 1):
        g[r][c] = BK
        c += 2
        if c > 99:
            c = 1
            r += 2

    print(100, 100)
    for row in g:
        print(*row, sep='')


if __name__ == '__main__':
    main()
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.insert(0, 0)

v = [-1] * (N + 1)
n = 1
f = 0

for i in range(N):
    v[n] = i
    n = A[n]
    if v[n] != -1:
        f = 1
        s = n #ループのスタート
        t = i
        l = t - v[s] + 1
        break

if t >= K:
    print(v.index(K))
else:
    K = (K - s) % l
    print(v.index(K + s))

### FIXED CODE ###

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

v = [-1] * (N + 1)
n = 1
f = 0

for i in range(N):
    v[n] = i
    n = A[n]
    if v[n] != -1:
        f = 1
        s = n #ループのスタート
        t = i
        l = t - v[s] + 1
        break

if t >= K:
    print(v.index(K))
else:
    K = (K - v[s]) % l
    print(v.index(K + v[s]))
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
minute=0
ans=0
for _ in range(100000000):
    if not A and not B:break
    if not A: minute+=B[0]
    if not B: minute+=A[0]
    if A[0]<B[0]: 
        del A[0]
        minute += min(A[0], B[0])
    elif B[0]<A[0]:
        del B[0]
        minute += min(A[0], B[0])
    else: 
        del A[0]
        minute += min(A[0], B[0])
    if minute>K: break
    ans += 1
print(ans)


### FIXED CODE ###

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

a,b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans,j = 0,M
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,M = map(int,input().split())
if N<10:
  print(a+(100*(10-N)))
else:
   print(M)

### FIXED CODE ###

N,M = map(int,input().split(" "))
if N<10:
  print(M+(100*(10-N)))
else:
  print(M)
import sys
from time import time
from random import randint
from numpy import int64

def func(s, x, score, t1, t2, t3):
    if t1 == -1:
        for i in range(26):
            last = 0
            for j, v in enumerate(x, 1):
                if v == i:
                    last = j
                    score[i] += s[j * 26 + v]
                score[i] -= s[i] * (j - last)    
    if t1 > -1:
        last = 0
        for i, v in enumerate(x, 1):
            if v == t1:
                last = i
                score[t1] += s[i * 26 + v]
            score[t1] -= s[t1] * (i - last)
    if t2 > -1:
        last = 0
        for i, v in enumerate(x, 1):
            if v == t2:
                last = i
                score[t2] += s[i * 26 + v]
            score[t2] -= s[t2] * (i - last)
    if t3 > -1:
        last = 0
        for i, v in enumerate(x, 1):
            if v == t3:
                last = i
                score[t3] += s[i * 26 + v]
            score[t3] -= s[t3] * (i - last)
    score[26] = score[:26].sum()
    return score

def main():
    start = time()
    d, *s = map(int, sys.stdin.buffer.read().split())
    s = int64(s)
    x = int64(([*range(26)] * 15)[:d])
    score = func(s, x, int64([0] * 27), -1, -1, -1)
    while time() - start < 1.88:
        y = x.copy()
        if randint(0, 1):
            i = randint(0, d - 1)
            j = k = -1
            y[i] = randint(0, 25)
        elif randint(0, 1):
            i = randint(0, d - 16)
            j = randint(i + 1, i + 15)
            k = -1
            y[i], y[j] = y[j], y[i]
        else:
            i = randint(0, d - 15)
            j = randint(i + 1, i + 7)
            k = randint(j + 1, j + 7)
            if randint(0, 1):
                y[i], y[j], y[k] = y[j], y[k], y[i]
            else:
                y[i], y[j], y[k] = y[k], y[i], y[j]
        t = func(s, y, score, i, j, k)
        if t[26] > score[26]:
            score = t
            x = y
    print(*x + 1, sep='\n')

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('func', 'i8[:](i8[:], i8[:], i8[:], i8, i8, i8)')(func)
    cc.compile()

if __name__ == '__main__':
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import func
    main()

### FIXED CODE ###

from time import time
from random import randint

from numba import njit
from numpy import int64

@njit('i8(i8[:],i8[:])')
def func(s,x):
    last=[0]*26
    score=0
    for i,v in enumerate(x,1):
        last[v]=i
        c=0
        for j in range(26):
            c+=s[j]*(last[j]-i)
        score=score+s[i*26+v]-c
    return score

def main():
    start=time()
    d,*s=map(int,open(0).read().split())
    s=int64(s)
    x=int64(([*range(26)]*15)[:d])
    M=func(s,x)
    while time()-start<1:
        y=x.copy()
        y[randint(0,d-1)]=randint(0,25)
        t=func(s,y)
        if t>M:
            M=t
            x=y
    print(*x+1,sep='\n')

main()
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,n=INTM()
    ct=0
    c=min(a,b)
    for i in range(c,1,-1):
        if a%i==0 and b%i==0:
            ct+=1
            if ct==n:
                ans=i
    print(ans)
if __name__ == '__main__':
    do()

### FIXED CODE ###

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,n=INTM()
    ct=0
    c=min(a,b)
    for i in range(c,0,-1):
        if a%i==0 and b%i==0:
            ct+=1
            if ct==n:
                ans=i
    print(ans)
if __name__ == '__main__':
    do()
n,m = map(int,input().split())
s = []
c = []
if m == 0:
  if n==1:
    print(0)
    exit()
  elif n==2:
    print(10)
    exit()
  else:
    print(100)
    exit()


for i in range(m):
  S,C =  map(int,input().split())
  s.append(S)
  c.append(C)
  
num = [1] + [0]*(n-1)
ans = ''
 
for i in range(m):
  if n != 1 and s[i] == 1 and c[i] == 0:
    print(-1)
    exit()
  elif n == 1 and s[i] == 1 and c[i] == 0:
    print(-1)
    exit()
for i in range(m-1):
  for j in range(i+1,m):
    if s[i] == s[j] and c[i] != c[j]:
      print(-1)
      exit()
      
for i in range(m):
  num[s[i]-1] = c[i]
  
for i in range(n):
  ans += str(num[i])
  
print(ans)

### FIXED CODE ###

n = int(input())
print(n//2 + 1 if n%2 != 0 else n//2)
N , K = map(N , K = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)
res = 0
for i in range (K):
    res += l[i]
print(res)
            

### FIXED CODE ###

N , K = map(int, input().split())
l = list(map(int, input().split()))
ll = sorted(l)
res = 0
if N == K :
    res = sum(ll)
elif K==1 : 
    res = ll[0]
else:
    for i in range (K):
        res += ll[i]
print(res)
import numpy as np
import sys
sys.setrecursionlimit(10**6) 

def main(args):
    a = int(args[0])
    b = int(args[1])
    if 6 <= a and a <= 12:
        v = b//2
    elif a <= 5:
        v = 0
    else:
        v = b
    print(v)

main(sys.argv[1:3])

### FIXED CODE ###

import numpy as np
from sys import stdin
#sys.setrecursionlimit(10**6) 

def main():
    a, b = [int(x) for x in stdin.readline().rstrip().split()]
    if 6 <= a and a <= 12:
        v = b//2
    elif a <= 5:
        v = 0
    else:
        v = b
    print(v)

if __name__ == "__main__":
    main()
a, b = map(int, raw_input().split())
if (a + b) % 2 == 0:
  print((a + b) // 2)
else:
  print("IMPOSSIBLE") 

### FIXED CODE ###

a, b = map(int, input().split())
if (a+b) % 2 == 0:
  print((a+b) // 2)
else:
  print("IMPOSSIBLE")
N = int(input())
C0, C1, C2, C3 = 0, 0, 0, 0

for i in range(N-1):
    S = input()
    if S == AC:
        C0 = C0 + 1
    elif S == WA:
        C1 = C1 + 1
    elif S == TLE:
        C2 = C2 + 1
    else:
        C3 = C3 + 1

print("AC x " + C0)
print("WA x " + C1)
print("TLE x " + C2)
print("RE x " + C3)

### FIXED CODE ###

N = int(input())
C0, C1, C2, C3 = 0, 0, 0, 0

for i in range(N):
    S = str(input())
    if S == "AC":
        C0 = C0 + 1
    elif S == "WA":
        C1 = C1 + 1
    elif S == "TLE":
        C2 = C2 + 1
    else:
        C3 = C3 + 1

print("AC x " + str(C0))
print("WA x " + str(C1))
print("TLE x " + str(C2))
print("RE x " + str(C3))
X,Y = map(int, input().split())
for f4 in range(0,X+1,1):
  if Y==(f4*4)+((X-f4)*2):
    print('Yes')
    exit()
print('No')

### FIXED CODE ###

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

for i in range(5):
  if (x[i]==0):
    print(i+1)