Harryxun/stf_run huggingface dataset:
N, K = list(map(int, input().split()))

price_list = input().split()

price_list.sort()

answer = 0

for i in range(K):
    answer += price_list[i]

print(answer)

### FIXED CODE ###

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

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

price_list.sort()

answer = 0

for i in range(K):
    answer += price_list[i]

print(answer)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import math

def input():
    return sys.stdin.readline()


def calc_coord(theta, length):
    # 第一象限
    if 0 <= theta <= 90:
        min_x = length * math.cos(math.radians(90-theta))
        min_y = length * math.sin(math.radians(90-theta))
    elif 90 < theta <= 180:
        min_x = length * math.cos(math.radians(90-theta))
        min_y = length * math.sin(math.radians(90-theta))
    elif 180 < theta <= 270:
        min_x = length * math.cos(math.radians(270-(theta-180)))
        min_y = length * math.sin(math.radians(270-(theta-180)))
    elif 270 < theta <= 359:
        min_x = length * math.cos(math.radians(360-theta+90))
        min_y = length * math.sin(math.radians(360-theta+90))

    return min_x, min_y


def resolve():
    a, b, h, m = map(int, input().split())

    # 時刻を角度に変換
    min_theta = 6.0 * m
    hour_theta = 30 * h + 0.5 * m




    min_x, min_y = calc_coord(min_theta, b)
    hour_x, hour_y = calc_coord(hour_theta, a)

    ans = math.sqrt((min_x - hour_x) ** 2 + (min_y - hour_y) ** 2)

    print(ans)

if __name__ == "__main__":
    resolve()



### FIXED CODE ###

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

import sys
import math

def input():
    return sys.stdin.readline()


def calc_coord(theta, length):
    # 第一象限
    if 0 <= theta <= 90:
        rad1 = round(math.radians(90-theta), 11)
        min_x = length * round(math.cos(rad1), 11)
        min_y = length * round(math.sin(rad1), 11)
    elif 90 < theta <= 180:
        rad1 = round( math.radians(90 - theta), 11)
        min_x = round(length * math.cos(rad1),11)
        min_y = round(length * math.sin(rad1),11)
    elif 180 < theta <= 270:
        rad2 = round(math.radians(450-theta),11)
        min_x = round(length * math.cos(rad2),11)
        min_y = round(length * math.sin(rad2),11)
    elif 270 < theta <= 360:
        rad2 = round(math.radians(450 - theta),11)
        min_x = round(length * math.cos(rad2),11)
        min_y = round(length * math.sin(rad2),11)

    return min_x, min_y


def resolve():
    a, b, h, m = map(int, input().split())

    # 時刻を角度に変換
    min_theta = 6.0 * m
    hour_theta = 30 * h + 0.5 * m

    min_x, min_y = calc_coord(min_theta, b)
    hour_x, hour_y = calc_coord(hour_theta, a)

    ans = math.sqrt((min_x - hour_x) ** 2 + (min_y - hour_y) ** 2)

    print(ans)

if __name__ == "__main__":
    resolve()
t,n=map(int,input().split())
print(t/x)

### FIXED CODE ###

t,x=map(int,input().split())
print(t/x)
str = input()
if str == "RRR":
    print(3)
elif str == "SSS":
    print(0)
elif str == "RRS":
    print(2)
elif str == "SRS":
    print(1)
elif str == "SRR":
    print(2)
elif str == "RSR":
    print(1)
elif str == "RSS":
    print(1)
elif str == "SSR":
    print(1)
`

### FIXED CODE ###

S = input()
x = 0
if S == 'RSR':
    print(1)
else:
    for i in S:
        if i == 'R':
            x += 1
    print(x)
n=int(input())
h=list(map(int,input().split()))
ans=0
highest=h[1]
for i in range(n):
  if h[i] >= highest:
    ans += 1
    highest=h[i]
print(ans)

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
ans=0
highest=0
for i in range(n):
  if h[i] >= highest:
    ans += 1
    highest=h[i]
print(ans)
import numpy as np
number=input().rstrip().split(' ')
N=int(number[0])
M=int(number[1])
judge=np.zeros([N-1])

for i in range(M):
    cities=input().rstrip().split(' ')
    A=int(cities[0])
    judge[A-1]=1

print(np.count_nonzero(judge==0))

### FIXED CODE ###

K=int(input())
print("ACL"*K)
a, b = map(int, input().split())
for i in range(1, 1250):
    if a == int(i * 0.08) and b == int(i * 0.1):
        flag = True
        break
if flag:
    print(i)
else:
    print(-1)

### FIXED CODE ###

a, b = map(int, input().split())
flag = False
for i in range(0, 1300):
    if a == int(i * 0.08) and b == int(i * 0.1):
        flag = True
        break
if flag:
    print(i)
else:
    print(-1)
        #print(i)
def resolve():
    import sys
    input=sys.stdin.readline
    N = int(input().rstrip())
    S = input().rstrip()

    def z_algo(s):
        """
        param s:str
        return list of int with length len(s)
        """
        # initialization
        n=len(s)
        z=[0]*n
        z[0]=n
        # construct
        L,R=0,0
        for i in range(1,n):
            if i>R: # 過去の結果が全く使えない
                L=R=i
                while(R<n and s[R-L]==s[R]): R+=1
                z[i]=R-L
                R-=1 # 0-indexedでiと比較するため
            elif z[i-L]<R-i+1:
                z[i]=z[i-L]
            else:
                L=i
                R+=1 # Rまでは確定しているので、R+1から確認
                while(R<n and s[R-L]==s[R]): R+=1
                z[i]=R-L
                R-=1
        return z

    ans = 0
    for i in range(N-1):
        z = z_algo(S[i:])
        for i, _z in enumerate(z):
            ans=max(ans,min(j,z[j]))
    print(ans)

resolve()

### FIXED CODE ###

def resolve():
    import sys
    input=sys.stdin.readline
    N = int(input().rstrip())
    S = input().rstrip()

    def z_algo(s):
        """
        param s:str
        return list of int with length len(s)
        """
        # initialization
        n=len(s)
        z=[0]*n
        z[0]=n
        # construct
        L,R=0,0
        for i in range(1,n):
            if i>R: # 過去の結果が全く使えない
                L=R=i
                while(R<n and s[R-L]==s[R]): R+=1
                z[i]=R-L
                R-=1 # 0-indexedでiと比較するため
            elif z[i-L]<R-i+1:
                z[i]=z[i-L]
            else:
                L=i
                R+=1 # Rまでは確定しているので、R+1から確認
                while(R<n and s[R-L]==s[R]): R+=1
                z[i]=R-L
                R-=1
        return z

    ans = 0
    for i in range(N-1):
        z = z_algo(S[i:])
        for j, _z in enumerate(z):
            ans=max(ans,min(j,z[j]))
    print(ans)

resolve()
print(s[0] + str((len-2)) + s[-1])

### FIXED CODE ###

s = input()
print(s[0]+str(len(s)-2)+s[-1])
a,b,c,d,e,f=map(int,input().split())
q=[[0,0]]
k=0
ans=0
while len(q)>0:
  x,y=q.pop()
  if x/(x+y)>k:
    k=x/(x+y)
    ans=[x,y]
  if x+y+100*a<=f:
    q+=[[x+100*a,y]]
  if x+y+100*b<=f:
    q+=[[x+100*b,y]]
  if y+c<=(x-y)*e/100 and x+y+c<=f:
    q+=[[x+c,y+c]]
  if y+d<=(x-y)*e/100 and x+y+d<=f:
    q+=[[x+d,y+d]]
print(ans[0],ans[1])
    

### FIXED CODE ###

a,b,c,d,e,f=map(int,input().split())
aa=-1
ans=[0,0]
for i in range(0,f+1,a*100):
  for j in range(0,f+1-i,b*100):
    for k in range(0,int(e*(i+j)/100)+1,c):
      for l in range(0,int(e*(i+j)/100)+1-k,d):
        if i+j+k+l>f:
          continue
        if i+j>0 and aa<(k+l)/(i+j+k+l):
          aa=(k+l)/(i+j+k+l)
          ans=[i+j+k+l,k+l]
print(ans[0],ans[1])
num,renzoku=map(int,input().split())
dices=list(map(int,input().split()))
max_renzoku=[]
for i in range(0,num-renzoku):
  max_renzoku.append(sum(dices[i:i+renzoku]))
print((max(max_renzoku)+renzoku)/2)

### FIXED CODE ###

num,renzoku=map(int,input().split())
dices=list(map(int,input().split()))
expects=[0]*num
for i in range(num):
  pi=dices[i]
  expects[i]=(1+pi)/2
Si=[0]*(num+1)
for i in range(1,num+1):
  Si[i]=Si[i-1]+expects[i-1]
max_Si=0
for i in range(0,num-renzoku+1):
  if max_Si<Si[i+renzoku]-Si[i]:
    max_Si=Si[i+renzoku]-Si[i]
print(max_Si)
def search(M, l, walkable):
    i, j = (l.pop(0))
    nexts = []
    if i !=0:
        nexts.append((i-1, j))
    if i != len(M)-1:
        nexts.append((i+1, j))
    if j != 0:
        nexts.append((i, j-1))
    if j != len(M[0])-1:
        nexts.append((i, j+1))

    for nex in nexts:
        x, y = nex
        if M[x][y] == '.' and not nex in walkable:
            l.append(nex)
            walkable.append(nex)

inp = ''
while '0 0' != (inp = input()):
    i, j = [int(x) for x in inp.split()]
    M = []
    l = []
    for n in range(j):
        M.append(input())
        if '@' in M[n]:
            l.append((n, M[n].find('@')))

    walkable = []
    while l:
        search(M, l, walkable)
    print(len(walkable))

### FIXED CODE ###

import queue

def solve(w, h):
    q = queue.Queue()
    m = [['#' for i in range(w+2)] for j in range(h+2)]
    for i in range(h):
        inp = input()
        for j in range(w):
            m[i+1][j+1] = inp[j]
            if m[i+1][j+1] == '@':
                start = [i+1,j+1]
    q.put(start)
    c = 1
    while not q.empty():
        cur = q.get()
        XY = [(1,0), (-1, 0), (0, 1), (0, -1)]
        for x, y in XY:
            cx = cur[0]+x
            cy = cur[1]+y
            if m[cx][cy] == '.':
                m[cx][cy] = '#'
                q.put([cx, cy])
                c+=1
    return c

while True:
    w, h = [int(i) for i in input().split()]
    if w == 0 and h == 0:
        break
    print(solve(w,h))
h,w=map(int,input().split())
l=[[0]*(w+2)]
for i in range(h):
  a=list(input())
  a.insert(0,0)
  a.append(0)
  l.append(a)
l.append([0]*(w+2))
pointx=[-1,0,1]
pointy=[-1,0,1]
for i in range(1,h+1):
  for j in range(1,w+1):
    if l[i][j]=='.':
      count=0
      for k in pointx:
        for m in pointy:
          if l[i+k][i+m]=='#':
            count+=1
      l[i][j]=str(count)

del l[0]
del l[h]
for i in range(h):
  l[i]=l[i][1:w+1]
for i in l:
  print(''.join(i))

### FIXED CODE ###

h,w=map(int,input().split())
l=[[0]*(w+2)]
for i in range(h):
  a=list(input())
  a.insert(0,0)
  a.append(0)
  l.append(a)
l.append([0]*(w+2))
pointx=[-1,0,1]
pointy=[-1,0,1]
for i in range(1,h+1):
  for j in range(1,w+1):
    if l[i][j]=='.':
      count=0
      for k in pointx:
        for m in pointy:
          if l[i+k][j+m]=='#':
            count+=1
      l[i][j]=str(count)

del l[0]
del l[h]
for i in range(h):
  l[i]=l[i][1:w+1]
for i in l:
  print(''.join(i))
n = input()
a = list(map(int,input().split()))

a.sort()

hist = [0 for x in range(-1,max(a)+3)]
As = []
ans = -1
Aspd = As.append

if len(a) ==1:
    ans = a[0]
else:
    for i in a:
        hist[i] += 1
    
    for i in range(len(hist)-1):
        Aspd(hist[i-1]+hist[i]+hist[i+1])
        

print(max(As))

### FIXED CODE ###

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

a.sort()

hist = [0 for x in range(-1,max(a)+3)]
As = []
ans = -1
Aspd = As.append

if len(a) ==1:
    print(1)
else:
    for i in a:
        hist[i] += 1
    
    for i in range(len(hist)-1):
        Aspd(hist[i-1]+hist[i]+hist[i+1])
        

    print(max(As))
H, W, a, b = map(int, input().split())
x = '1' * (W-A)
y = '0' * (W-A)
x.rjust(W, "0")
y.rjust(W, "1")

for i in range(B):
  print(x)
for i in range(H-B):
  print(y)

### FIXED CODE ###

H, W, A, B = map(int, input().split())
x = '1' * (W-A)
y = '0' * (W-A)
x = x.rjust(W, "0")
y = y.rjust(W, "1")

for i in range(B):
  print(x)
for i in range(H-B):
  print(y)
S=input()

cc=0
for i in range(2,len(S)-2):
    if S[i]=='C':
        cc+=1
        nc=i-1

if cc==1:
    p1=True

if S[0]=='A':
    p2=True

bc=0
for i in range(len(S)):
    if i==0 or i==nc:
        pass
    else:
        if S[i].islower()==False:
            bc+=1

if p1==True and p2==True and bc==0:
    print('AC')

else:
    print('WA')


### FIXED CODE ###

S=input()

cc=0
nc=0
for i in range(2,len(S)-1):
    if S[i]=='C' and S[i].islower()==False:
        cc+=1
        nc=i

if cc==1 and not nc==0:
    p1=True
else:
    p1=False

if S[0]=='A' and S[0].islower()==False:
    p2=True
else:
    p2=False

bc=0
for i in range(len(S)):
    if i==0 or i==nc:
        pass
    else:
        if S[i].islower()==False:
            bc+=1

if p1==True and p2==True and bc==0:
    print('AC')

else:
    print('WA')
if a < 2:
        print 0
elif a % 2 == 0:
        print int(a / 2 - 1)
else:
        print int(a/2)

### FIXED CODE ###

a = int(input())
if a < 2:
        print(0)
elif a % 2 == 0:
        print(int(a / 2 - 1) )
else:
        print(int(a/2))
N = int(input())
data = [list(map(int,input().split())) for i in range(N)]
mod = 10**9+7

from math import gcd

A = []
B = []
C = []
D = []

for i in range(N):
    if data[i][0] == 0 and data[i] == 0:
        continue
    else:
        if data[i][0] < 0:
            data[i][0] *= -1
            data[i][1] *= -1
        g = gcd(data[i][0],data[i][1])
        data[i][0] //= g
        data[i][1] //= g
        if data[i][0] == 0:
            C.append(data[i])
        elif data[i][1] > 0:
            A.append(data[i][0]/data[i][1])
        elif data[i][1] == 0:
            B.append(data[i])
        else:
            D.append(-data[i][1]/data[i][0])


from collections import defaultdict

d1 = defaultdict(int)
d2 = defaultdict(int)
for i in range(len(A)):
    d1[A[i]] += 1
for i in range(len(D)):
    d2[D[i]] += 1

l = list(set(d1.keys()))


ans = 0
for i in range(len(l)):
    ans = (ans + (pow(2,d1[A[i]],mod)-1)*pow(2,len(A)-d1[A[i]]+len(D)-d2[A[i]]+len(B)+len(C),mod)) % mod

for i in range(len(B)):
    ans = (ans + pow(2,len(B)-i-1+len(D),mod)) % mod

ans = (ans + pow(2,len(C) + len(D),mod) -1) % mod

print(ans)

### FIXED CODE ###

N = int(input())
data = [list(map(int,input().split())) for i in range(N)]
mod = 10**9+7
ans = 0

from math import gcd

A = []

for i in range(N):
    if data[i][0] == 0 and data[i][1] == 0:  #(0,0)の場合は以降取り除いて考える
        ans += 1
    else:                                 #各々の成分をgcdで割り、第1成分が非負になるように調整
        if data[i][0] < 0:
            data[i][0] *= -1
            data[i][1] *= -1
        g = gcd(data[i][0],data[i][1])
        data[i][0] //= g
        data[i][1] //= g
        if data[i][0] == 0:
            A.append((0,1))
        elif data[i][1] == 0:
            A.append((1,0))
        else:
            A.append((data[i][0],data[i][1]))


from collections import Counter

C = Counter(A)
D = []             #仲が悪いイワシの数の組

for i,j in list(C.keys()):
    if j <= 0:
        continue
    else:
        if j == 0:
            if C[(0,1)] > 0:
                D.append((C[(1,0)],C[(0,1)]))
        else:
            if C[(j,-i)] > 0:
                D.append((C[(i,j)],C[(j,-i)]))

r = 0  #仲が悪くなり得るイワシの数
for i,j in D:
    r += i+j

a = 1  #仲が悪くなり得るイワシたちの選び方
for i,j in D:
    a = (a*(pow(2,i,mod)+pow(2,j,mod)-1)) % mod

a = (a*pow(2,len(A)-r,mod)) % mod  #仲が悪くなり得ないイワシたちの選び方

ans += a-1  #全部選ばないものを除く

print(ans % mod)
import sys

sys.setrecursionlimit(100000)

# 再帰関数で作る木の個数を返す
def dfs(now, end, summary):
    # 終了条件
    if now == end:
        return summary
    # 1つ前の頂点時点で作ることのできる木の個数 *（１つ前の深さの頂点の数 ^ 現在の深さの頂点の数）で再帰関数
    else:
        return dfs(now + 1, end, summary * (deep[now - 1] ** deep[now]))

# 最後に割る数の定数
JOSU = 998244353

# 入力
N = int(input())
D = list(map(int, input().split()))

# 深さをメモするため、Dの最大値 + 1の数の配列を用意
# 例：深さの最大が2なら、0, 1, 2の3つが必要
deep = [0] * (max(D) + 1)

# 各深さの頂点の数を記録
for i in range(N):
    deep[D[i]] += 1

# 深さ0の頂点が1以外なら、木ができないため0を返す
if deep[0] != 1:
    print(0)
# それ以外なら各深さの辺のつけ方を計算して返す
else:
    print(dfs(1, len(deep), 1) % JOSU)



### FIXED CODE ###

# 再帰関数の最大再帰回数を変更
import sys
sys.setrecursionlimit(1000000)

# 再帰関数で作る木の個数を返す
def dfs(now, end, summary):
    # 終了条件
    if now == end:
        return summary
    # 1つ前の頂点時点で作ることのできる木の個数 *（１つ前の深さの頂点の数 ^ 現在の深さの頂点の数）で再帰関数
    else:
        return dfs(now + 1, end, summary * (deep[now - 1] ** deep[now]))

# 最後に割る数の定数
JOSU = 998244353

# 入力
N = int(input())
D = list(map(int, input().split()))

# 深さをメモするため、Dの最大値 + 1の数の配列を用意
# 例：深さの最大が2なら、0, 1, 2の3つが必要
deep = [0] * (max(D) + 1)

# 各深さの頂点の数を記録
for i in range(N):

    # 頂点1が深さ0以外なら制約違反
    if i == 0 and D[i] != 0:
        print(0)
        exit()
    # 頂点1以外が深さ0なら制約違反
    elif i > 0 and D[i] == 0:
        print(0)
        exit()

    deep[D[i]] += 1

# 再帰関数で計算
print(dfs(1, len(deep), 1) % JOSU)
import math

N = int(input())
T = [int(input()) for i in range(N)]

for i in range(1, N):
    T[i] = int(T[i] * T[i-1] / math.gcd(T[i], T[i-1]))
print(T[-1])

### FIXED CODE ###

import fractions as math

N = int(input())
T = [int(input()) for i in range(N)]

for i in range(1, N):
    T[i] = T[i] * T[i-1] // math.gcd(T[i], T[i-1])
print(T[-1])
import math,itertools,fractions,heapq,bisect,sys,copy,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  field=[S() for _ in range(h)]

  ans=0
  visited=[[-1 for __ in range(w)] for _ in range(h)]
  q=collections.deque()
  for i in range(h):
    for j in range(w):
      if field[i][j]=='#':
        continue
      q.append((i,j,0))
      for _i in range(h):
        for _j in range(w):
          visited[_i][_j]=-1
      while len(q)>0:
        y,x,c=q.popleft()
        visited[y][x]=c

        for dy,dx in ((-1,0),(0,1),(1,0),(0,-1)):
          ny=y+dy
          nx=x+dx
          if 0<=ny<h and 0<=nx<w:
            if field[ny][nx]=='#':
              continue
            if visited[ny][nx]!=-1:
              continue
            q.append((ny,nx,c+1))
    ans=max(ans,c)
  return ans

# main()
print(main())


### FIXED CODE ###

import sys,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  field=[S() for _ in range(h)]

  ans=0
  visited=[[-1 for __ in range(w)] for _ in range(h)]
  q=collections.deque()
  for i in range(h):
    for j in range(w):
      if field[i][j]=='#':
        continue
      q.append((i,j))
      for _i in range(h):
        for _j in range(w):
          visited[_i][_j]=-1
      visited[i][j]=0
      _ans=0
      while q:
        y,x=q.popleft()

        for dy,dx in ((-1,0),(0,1),(1,0),(0,-1)):
          ny=y+dy
          nx=x+dx
          if not 0<=ny<h:
            continue
          if not 0<=nx<w:
            continue
          if field[ny][nx]=='#':
            continue
          if visited[ny][nx]!=-1:
            continue
          _ans=visited[y][x]+1
          visited[ny][nx]=_ans
          q.append((ny,nx))
      ans=max(ans,_ans)
  return ans

# main()
print(main())
N, M = map(int, input().split())

A = range(M)
B = range(M)

Ans = reduce(lambda a, b: a*b, B)
# Ans = 10
print(10)
    


### FIXED CODE ###

N, M = map(int, input().split())
A = [True] * (N+1)
for _ in range(M):
  idx = int(input())
  A[idx] = False

step = [0] * (N+1)
step[0] = 1
for i in range(1, N+1):
  if A[i]:
    step[i] = step[i-1] + step[i-2]
  else:
    step[i] = 0
print(step[N]%(10**9+7))
sa = input()
sb = input()
sc = input()

def judges(lis):
    if lis[0] == 'a':
        judge=1
    elif lis[0] == 'b':
        judge=2
    else:
        judge=3
    return judge
  
  import sys

judge = 1
while(1):
    if judge == 1:
        try:
            judge = judges(sa)
            sa = sa[1:]
            print(sa)
        except IndexError:
            print('A')
            break
    
    elif judge == 2:
        try:
            judge = judges(sb)
            sb = sb[1:]
            print(sb)
        except IndexError:
            print('B')
            break
    else:
        try:
            judge = judges(sc)
            sc = sc[1:]
            print(sc)
        except IndexError:
            print('C')
            break

### FIXED CODE ###

sa = input()
sb = input()
sc = input()

def judges(lis):
    if lis[0] == 'a':
        judge=1
    elif lis[0] == 'b':
        judge=2
    else:
        judge=3
    return judge

import sys

judge = 1
while(1):
    if judge == 1:
        try:
            judge = judges(sa)
            sa = sa[1:]
        except IndexError:
            print('A')
            break
    
    elif judge == 2:
        try:
            judge = judges(sb)
            sb = sb[1:]
        except IndexError:
            print('B')
            break
    else:
        try:
            judge = judges(sc)
            sc = sc[1:]
        except IndexError:
            print('C')
            break
n=int(input())
#for i in range(n):
if n>2:
    A=list(set(list(map(int, input().split(" ")))))
else:
    A=list(map(int, input().split(" ")))

A.sort()
t1=A[0]
t2=A[1]

while t1!=t2:
    #print(t1)
    if t1>t2:
        t1=t1-t2
    else:
        t2=t2-t1

print(t1)

### FIXED CODE ###

n=int(input())
tmp=list(map(int, input().split(" ")))
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd (a, b)

a=max(tmp)
for i in tmp:
    a=gcd(a,i)

print(a)
A,B,C = int(input().split())
ans = int(B/A)

if ans > C:
	ans = C

print(ans)

### FIXED CODE ###

A,B,C = map(int,input().split())
#A,B,C = 2,1,3
ans = B//A

if ans > C:
	ans = C

print(ans)
import sys
sys.setrecursionlimit(10**7)

class Event:
    def __repr__(self):
            return str(self.__dict__)

class User:
    def __repr__(self):
            return str(self.__dict__)

def solve():
    n, q = map(int, input().split())
    l_event = []
    for i in range(n):
        s, t, x = map(int, input().split())

        # 追加イベント
        e = Event()
        e.time = s-x
        e.type = 1 # add
        e.pos = x
        l_event.append(e)

        # 削除イベント
        e = Event()
        e.time = t-x
        e.type = -1 # delete
        e.pos = x
        l_event.append(e)

    l_user = []
    for i in range(q):
        d = int(input())

        # ユーザ評価イベント
        u = User()
        u.time = d + 0.5 # ユーザが出発する時刻までのイベントを先に処理したいので、0.5ずらす
        u.idx = i
        l_user.append(u)

    # リストを時刻でソート O(NlogN)
    l_event = sorted(l_event, key=lambda e: e.time)

    # ユーザも時刻でソート O(QlogQ)
    l_user = sorted(l_user, key=lambda e: e.time)

    ans = [-1]*q # 答えの配列
    s_stop = set()

    current_user_idx = 0

    # リストを順に処理する
    for e in l_event: #O(N+Q)

        # 次処理するイベントの時刻より前のユーザをすべて処理する
        while(True):
            u = l_user[current_user_idx]
            if u.time < e.time:
                if len(s_stop) != 0:
                    ans[u.idx] = min(s_stop)
                current_user_idx += 1
            else:
                break

        if e.type == 1: # add
            s_stop.add(e.pos)
        else: # delete
            s_stop.remove(e.pos)

    print("\n".join([str(a) for a in ans]))

solve()

### FIXED CODE ###

import sys;input=sys.stdin.readline

n,q=map(int, input().split())
event=[]
for _ in range(n):
    s,t,x=map(int,input().split())
    event.append((s-x-0.5,1,x))
    event.append((t-x-0.5,-1,x))
for i in range(q):
    event.append((int(input()),0,i))

event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*q
for t,e,x in event:
    if e > 0:
        stop.add(x)
        if x<minstop:
            minstop=x
            is_stop=True
    elif e<0:
        stop.remove(x)
        if minstop==x:
            is_stop=False
    elif len(stop)>0:
        if not is_stop:
             minstop=min(stop)
             is_stop=True
        ans[x]=minstop

print('\n'.join(map(str, ans)))
a,b=map(input().split())
c=a+b
c=int(c)**0.5
if isinstance(c, int)==True:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a,b=map(str,input().split())
c=a+b
c=(int(c)**(1/2))
if (c.is_integer())==True:
    print('Yes')
else:
    print('No')
n = int(input())
a = [int(input()) for _ in range(n)]
m = float('inf')
for i in a:
  count = 0
  while i%2 == 0:
    i = i//2
    count += 1
  m = min(m, count)
  if m==0:
    break
print(m)

### FIXED CODE ###

n = int(input())
a = map(int, input().split())
m = float('inf')
for i in a:
  count = 0
  while i%2 == 0:
    i = i//2
    count += 1
  m = min(m, count)
  if m==0:
    break
print(m)
n = int(input())
a = list(map(int,input().spllit()))
now = 1
brok = 0
for i in range(n):
    if(a[i] == now):
        brok += 1
    else:
        now += 1
if(now == 1):
    print(-1)
else:
    print(brok)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
now = 1
brok = 0
for i in range (n):
    if(A[i] != now):
        brok += 1
    else:
        now += 1
if(now == 1):
    print(-1)
else:
    print(brok)