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

trees = []
for i in range(N) :
	trees.append(int(input()))

trees.sort()
min_diff = 99999999999
a,b,c = trees[0:K]
for i in range(N-K+1) :
	max_v = c
	min_v = a
	diff = max_v - min_v
	if (min_diff > diff) :
		min_diff = diff
	if (min_diff == 0) :
		break

	a,b,c = b,c,trees[i+K]


print(min_diff)

### FIXED CODE ###

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

trees = []
for i in range(N) :
	trees.append(int(input()))

trees.sort()
min_diff = 99999999999
for i in range(N-K+1) :
	max_v = trees[i+K-1]
	min_v = trees[i]
	diff = max_v - min_v
	if (min_diff > diff) :
		min_diff = diff
	if (min_diff == 0) :
		break



print(min_diff)
N, M = map(int, input().split())
acc = [False] * N
pen = 0
for _ in range(M):
	p, S = input().split()
	p = int(p) - 1
	if S[0] == 'A':
		acc[p] = True
	else:
		if not acc[p]:
            pen += 1
print('{} {}'.format(sum(acc), pen))

### FIXED CODE ###

import numpy as np

def main():
    N, M = map(int, input().split())
    PS = {}
    for i in range(M):
        row = input().split()
        row[0] = int(row[0])
        if row[0] not in PS:
            PS[row[0]] = [row[1]]
        else:
            PS[row[0]].append(row[1])

    n_correct = 0
    n_penalty = 0
    for p in PS:
        if 'AC' in PS[p]:
            n_correct += 1
            for result in PS[p]:
                if result == 'AC':
                    break
                if result == 'WA':
                    n_penalty += 1
    
    print('{} {}'.format(n_correct, n_penalty))
        


if __name__ == '__main__':
    main()
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections


n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(len(a)):
    a[i] -= 1
pre = 0
d = []
for i in range(2*n+10):
    d.append(pre)
    pre = a[pre]
cnt = [0]*(n)
s = ""
for i in range(len(d)):
    cnt[d[i]]+=1
    if cnt[d[i]]>=3 and cnt[d[i]]<4:
        s += str(d[i])
ff = int(s[0])
for i in range(len(d)):
    if ff == d[i]:
        check = i
        break
if check == 0:
    k %= len(s)
    print(a[k]+1)
else:
    k-= check
    k%=len(s)
    print(int(s[k])+1)

### FIXED CODE ###

import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i]-=1

roop = [0]
for i in range(3*n):
    roop.append(a[roop[i]])
cnt =[0]*n
d = []
for i in range(len(roop)):
    cnt[roop[i]]+=1
    if cnt[roop[i]]>=3 and cnt[roop[i]]<4:
        d.append(roop[i])
for i in range(len(roop)):
    if roop[i] == d[0]:
        check = i
        break
if check == 0:
    k%=len(d)
    print(d[k]+1)
else:
    if k<check + len(d):
        print(roop[k]+1)
    else:
        k-=check
        k%=len(d)
        print(d[k]+1)
N,M = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(M)]
num = [0,0,0]
for i in range(M):
    if N == 3 and sc[i][0] == 1 and sc[i][1] == 0 or N == 2 and sc[i][0] == 2 and sc[i][1] == 0: # or sc[i][1] == 0 and sc[i][0] == 2 and  #値が０かつそれが１００の位 or 値が０かつそれが１０の位かつ１００がない
        print("-1")
        exit()
    else:
        for j in range(M-1):
            if sc[i][0] == sc[j+1][0]:
                if sc[i][1] != sc[j+1][1]:
                    print("-1")
                    exit()
                else:
                    #if sc[i][1] not in num:
                    num[sc[i][0]-1] = sc[i][1]
            else:
                num[sc[i][0]-1] = sc[i][1]
NUM = num[0] * 100 + num[1] * 10 + num[2]
print(NUM)


### FIXED CODE ###

s = int(input())
if s%2 == 0:
    print(int(s/2))
else:
    print(int(s/2+1))
h, w = map(int, input().split())
s = [input() for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
count = 0
if s[0][0] == "#":
    count = 1

dp = [[100000 for _ in range(w)] for _ in range(h)]
dp[0][0] = count
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for j in range(h):
    for i in range(w):
        if i+1 < w:
            if s[i][j] == "." and s[i+1][j] == "#":
                dp[i+1][j] = min(dp[i+1][j], dp[i][j] + 1)
            else:
                dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if j+1 < h:
            if s[i][j] == "." and s[i][j+1] == "#":
                dp[i][j+1] = min(dp[i][j+1], dp[i][j] + 1)
            else:
                dp[i][j+1] = min(dp[i][j+1], dp[i][j])
print(dp[w-1][h-1])


### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
dp = [[float("inf")]*w for _ in range(h)]
if s[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for i in range(h):
    for j in range(w):
        if i+1 < h:
            count1 = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                count1 += 1
            dp[i+1][j] = min(dp[i+1][j], count1)
        if j+1 < w:
            count2 = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                count2 += 1
            dp[i][j+1] = min(dp[i][j+1], count2)
print(dp[h-1][w-1])
A, B = map(int, input().split())

print(A, B)
#print(int(A * B / math.gcd(A, B)))


### FIXED CODE ###

A = int(input())
B = int(input())

r = list(filter(lambda x: x != A and x != B, [1, 2, 3]))
print(r[0])
while True:
    s=0
    s=input().split()
    a=s[0]
    b=s[1]
    if a=="A":
        a=10
    if a=="B":
        a=11
    if a=="C":
        a=12
    if a=="D":
        a=13

    if a=="E":
        a=14
    if a=="F":
        a=15

    if b=="A":
        b=10
    if b=="B":
        b=11
    if b=="C":
        b=12
    if b=="D":
        b=13

    if b=="E":
        b=14
    if b=="F":
        b=15

    if a>b:
        print(">")
    if b>a:
        print("<")
    if a==b:
        print("=")
    


### FIXED CODE ###


s=0
s=input().split()
a=s[0]
b=s[1]
if a=="A":
    a=10
if a=="B":
    a=11
if a=="C":
    a=12
if a=="D":
    a=13

if a=="E":
    a=14
if a=="F":
    a=15

if b=="A":
    b=10
if b=="B":
    b=11
if b=="C":
     b=12
if b=="D":
    b=13

if b=="E":
     b=14
if b=="F":
     b=15

if a>b:
    print(">")
if b>a:
    print("<")
if a==b:
    print("=")
from math import log
from math import floor
x = int(input())

y = []
for i in range(2,x):
    j = floor(log(x,i))
    if j>1 and i**j <= x:
        y.append(i**j)
print(max(y))


### FIXED CODE ###

import bisect
a = []
for pw in range(2,1001):
    for x in range(1,1001):
        nw = x**pw
        if nw > 1000:
            break
        a.append(nw)
a = sorted(a)
x = int(input())
y = bisect.bisect_right(a,x)
print(a[y-1])
from scipy.special import comb

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

s=(2**n-1)%(10**9+7)
x=comb(n,a,exact=True)%(10**9+7)
y=comb(n,b,exact=True)%(10**9+7)

print(s-x-y)

### FIXED CODE ###

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

s=pow(2,n,10**9+7)-1
x=1
for i in range(a):
    x*=(n-i)
    x%=(10**9+7)
    x*=pow(i+1,10**9+5,10**9+7)
y=1
for i in range(b):
    y*=(n-i)
    y%=(10**9+7)
    y*=pow(i+1,10**9+5,10**9+7)

print((s-x-y)%(10**9+7))
n=int(input())
s = list(input())
c=0
for i in range(len(s)):
    if s[i] == "A":
        if s[i+1]=="B":
               if s[i+2]=="C":
                    c+=1
               
            
print(c)
        

### FIXED CODE ###

n=int(input())
s=list(input())
c=0
for i in range(len(s)):
    if s[i] == "A":
        try:
            if s[i+1]=="B":    
                if s[i+2]=="C":
                    c+=1
        except:
            pass
            
print(c)
from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
import copy
from bisect import *
input=lambda :sys.stdin.readline().rstrip()


X,Y,A,B,C=map(int,input().split())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
R=list(map(int,input().split()))
lst=[]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort()

while len(P)>X:
    P.pop()
while len(Q)>Y:
    Q.pop()

flag=1
while flag:
    if not R:
        break
    flag=0
    if P[-1]<Q[-1]:
        if P[-1]<R[-1]:
            P.pop()
            lst.append(R.pop())
            flag=1
    else:
        if Q[-1]<R[-1]:
            Q.pop()
            lst.append(R.pop())
            flag=1
print(sum(P)+sum(Q)+sum(lst))


### FIXED CODE ###

from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
import copy
from bisect import *
input=lambda :sys.stdin.readline().rstrip()


X,Y,A,B,C=map(int,input().split())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
R=list(map(int,input().split()))
lst=[]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort()

while len(P)>X:
    P.pop()
while len(Q)>Y:
    Q.pop()

flag=1
while flag:
    if not R:
        break

    flag=0
    if P and Q:
        if P[-1]<Q[-1]:
            if P[-1]<R[-1]:
                P.pop()
                lst.append(R.pop())
                flag=1
        else:
            if Q[-1]<R[-1]:
                Q.pop()
                lst.append(R.pop())
                flag=1
    else:
        if P:
            if P[-1]<R[-1]:
                P.pop()
                lst.append(R.pop())
                flag=1
        elif Q:
            if Q[-1]<R[-1]:
                Q.pop()
                lst.append(R.pop())
                flag=1

for i in range( X+Y-(len(P)+len(Q)+len(lst))):
    if R:
        lst.append(R.pop())
    else:
        break
print(sum(P)+sum(Q)+sum(lst))
S=input()
sum,ans=0,[]

for s in S:
  if s in "ACGT":
    sum += 1
  else:
    ans.append(sum)
    sum = 0
print(max(max(ans),sum))

### FIXED CODE ###

S=input()
sum,ans=0,[0]

for s in S:
  if s in "ACGT":
    sum += 1
  else:
    ans.append(sum)
    sum = 0
print(max(max(ans),sum))
import math
r=int(input())
m=float('%03.6f'%math.pi)
s=m*r**2
l=2*r*m
print(s,l)

### FIXED CODE ###

import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)
import fractions
a,b = map(lambda x: int(x), input().split())

print(int(a * b / fractions.gcd(a, b)))

### FIXED CODE ###

a = input()
b = input()

list = ['1','2','3']
list.remove(a)
list.remove(b)

print(list[0])
def setLine(tempH, line):
    for i in range(0, len(line)):
        geo[tempH][i] = line[i:i+1]

def solve():
    person = 0
    for i in range(0,H):
        for j in range(0,W):
            if geo[i][j] is not "_":
                search(i,j)
                person += 1
    print(person)

def search(i,j):
    temp = geo[i][j]
    geo[i][j] = "_"
    dx = [-1,0,1,0]
    dy = [0,-1,0,1]
    for a in range(0,4):
        idx = i + dx[a]
        jdy = j + dy[a]
        if(isOnMap(idx, jdy)):
            if(isNeededToSolve(temp, idx, jdy)):
                search(idx,jdy)

def isOnMap(i,j):
    return (0<=i and 0<=j and i<H and j<W)

def isNeededToSolve(temp,i,j):
    target = geo[i][j]
    return (target is not "_" and temp is target)

H = -1
W = -1
tempH = 0
geo = [[0 for i in range(1)]for j in range(1)]
repeat = True
while repeat:
    line = input()
    if H is -1 and W is -1:
        H = int(line.split(" ")[0])
        W = int(line.split(" ")[1])
        geo = [[0 for i in range(W)] for j in range(H)]
    else:
        setLine(tempH, line)
        tempH+=1

    #break
    if H is 0 and W is 0:
        break

    #solve
    if tempH is H:
        solve()
        H = -1
        W = -1
        tempH = 0

### FIXED CODE ###

import sys
def solve():
    person = 0
    for i in range(0,H):
        for j in range(0,W):
            if geo[i][j] is not "_":
                temp = geo[i][j]
                search(i,j,temp)
                person += 1
    print(person)

def search(i,j,temp):
    geo[i][j] = "_"
    for a in range(0,4):
        idx, jdy = i + dx[a], j + dy[a]
        if(isOnMap(idx, jdy)):
            if(isNeededToSolve(temp, idx, jdy)):
                search(idx,jdy, temp)

def isOnMap(i,j): return (0<=i and 0<=j and i<H and j<W)

def isNeededToSolve(temp,i,j):
    target = geo[i][j]
    return (target is not "_" and temp is target)

limit = 10**7
sys.setrecursionlimit(limit)

H, W, tempH = -1, -1, 0
dx = [-1,0,1,0]
dy = [0,-1,0,1]
geo = [[0 for i in range(1)]for j in range(1)]
while True:
    line = input()
    if H is -1 and W is -1:
        p = line.split(" ")
        H, W = int(p[0]), int(p[1])
        geo = [[0 for i in range(W)] for j in range(H)]
    else:
        geo[tempH] = list(line)
        tempH+=1
    if H is 0 and W is 0:break
    if tempH is H:
        solve()
        H, W, tempH = -1, -1, 0
a, b = map(int, input().split())

L = []

for i in range(a):
    L.append([j for j in input()])

K = []

for i in range(b):
    K.append([j for j in input()])

for i in range(a-b+1):
    for j in range(a-b+1):
        if L[i][j] == K[0][0]:
            for k in range(b):
                if L[i+k][j:j+b] == K[i+k]:
                    continue
                else:
                    break
            if k == b - 1:
                print("Yes")
                quit()
print("No")

### FIXED CODE ###

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

A = []
for i in range(a):
    A.append(list(input()))
B = []
for i in range(b):
    B.append(list(input()))
f = 0
for i in range(a - b + 1):
    for j in range(a - b + 1):
        if A[i][j] == B[0][0]:
            ans = 0
            for k in range(b):
                for l in range(b):
                    if A[i+k][j+l] == B[k][l]:
                        continue
                    else:
                        ans = 1
            if ans == 0 and f == 0:
                print("Yes")
                f = 1
                break
if f == 0:
    print("No")
N = input()
S = input()
# N = 10
# S = 'ZABCDBABCQ'

ans = 0

for i in range(N - 2):
    if S[i:i+3] == 'ABC':
       ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
S = input()
# N = 10
# S = 'ZABCDBABCQ'

ans = 0

for i in range(N - 2):
    if S[i:i+3] == 'ABC':
       ans += 1

print(ans)
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    k,t = LI()
    a = LI()
    q = []
    for i in a:
        heappush(q,-i)
    while len(q) > 1:
        x = heappop(q)
        y = heappop(q)
        x += 1
        y += 1
        if x:
            heappush(q,x)
        if y:
            heappush(q,y)
    print(-q[0]-1)
    return

#Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    k,t = LI()
    a = LI()
    q = []
    for i in a:
        heappush(q,-i)
    while len(q) > 1:
        x = heappop(q)
        y = heappop(q)
        x += 1
        y += 1
        if x:
            heappush(q,x)
        if y:
            heappush(q,y)
    if not q:
        print(0)
    else:
        print(-q[0]-1)
    return

#Solve
if __name__ == "__main__":
    solve()
n, m = map(int, input().split())
s = list(input())
out = [set() for _ in range(n)]
count = [[0, 0] for _ in range(n)]
def f(c):
    if c == 'A': return 0
    else: return 1
for _ in range(m):
    a, b = map(int, input().split())
    out[a-1].add(b-1)
    out[b-1].add(a-1)
    count[a-1][f(s[b-1])] += 1
    count[b-1][f(s[a-1])] += 1
elim = set()
def eliminate(x, c):
    count[x][c] -= 1
    if count[x][0] & count[x][1] == 0:
        elim.add(x)
        for node in out[x]:
            if node not in elim:
                eliminate(node, f(s[x]))
for i in range(n):
    if count[i][0] & count[i][1] == 0:
        elim.add(i)
        for node in out[i]:
            if node not in elim:
                eliminate(node, f(s[i]))
if len(elim) < n: print('Yes')
else: print('No')

### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
n, m = map(int, input().split())
s = input()
out = [set() for _ in range(n)]
count = [[0, 0] for _ in range(n)]
def f(c):
    if c == 'A': return 0
    else: return 1
for _ in range(m):
    a, b = map(int, input().split())
    if a == b:
        count[a-1][f(s[a-1])] += 1
    elif b-1 not in out[a-1]:
        count[a-1][f(s[b-1])] += 1
        count[b-1][f(s[a-1])] += 1
    out[a-1].add(b-1)
    out[b-1].add(a-1)
elim = set()
def eliminate(x):
    elim.add(x)
    c = f(s[x])
    for node in out[x]:
        if node not in elim:
            count[node][c] -= 1
            if count[node][0] * count[node][1] == 0:
                eliminate(node)
for i in range(n):
    if i not in elim and count[i][0] * count[i][1] == 0:
        eliminate(i)
if len(elim) < n: print('Yes')
else: print('No')
W,H,x,y=map(int,input())
print(W*H/2)

### FIXED CODE ###

W,H,x,y=map(int,input().split())
a = 0
if x==W/2 and y == H/2:
  a=1
print(W*H/2,a)
h,w,n = map(int,input().split())
coord = [list(map(int,input().split())) for i in range(n)]

num = {}

for i in range(n):
  for j,k in [[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]:
    if not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1):
      continue
    if not coord[i][0]+j in num:
      num[coord[i][0]+j] = {}
    if not coord[i][1]+k in num[coord[i][0]+j]:
      num[coord[i][0]+j][coord[i][1]+k] = 1
    else:
      num[coord[i][0]+j][coord[i][1]+k] += 1

ans = [0]*9
for i in num:
  for value in num[i].values():
    ans[value] +=1

print((h-2)*(w-2)-sum(ans))
for i in range(1,9):
  print(ans[i])

### FIXED CODE ###

h,w,n = map(int,input().split())
coord = [list(map(int,input().split())) for i in range(n)]

num = {}

for i in range(n):
  for j,k in [[0,0],[0,1],[0,-1],[1,0],[1,1],[1,-1],[-1,0],[-1,1],[-1,-1]]:
    if not(2<=coord[i][0]+j<=h-1) or not(2<=coord[i][1]+k<=w-1):
      continue
    if not coord[i][0]+j in num:
      num[coord[i][0]+j] = {}
    if not coord[i][1]+k in num[coord[i][0]+j]:
      num[coord[i][0]+j][coord[i][1]+k] = 1
    else:
      num[coord[i][0]+j][coord[i][1]+k] += 1

ans = [0]*10
for i in num:
  for value in num[i].values():
    ans[value] +=1

print((h-2)*(w-2)-sum(ans))
for i in range(1,10):
  print(ans[i])
N = 1
N = input()
if N % 2 == 0:
    print(N/2-1)
else:
    print((N-1)/2)
   

### FIXED CODE ###

N = int(input())
if N%2 == 0:
    print(int(N/2-1))
else:
    print(int((N-1)/2))
cri = {"25":"Christmas",
	"24":"Christmas Eve",
	"23":"Christmas Eve Eve",
	"22":"Christmas Eve Eve Eve"}
print(cri[nput()])

### FIXED CODE ###

cri = {"25":"Christmas",
	"24":"Christmas Eve",
	"23":"Christmas Eve Eve",
	"22":"Christmas Eve Eve Eve"}
print(cri[input()])
A = list(map(int, input().split()))
A.sort()
if A[2] = A[1] + A[0]:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

A = list(map(int, input().split()))
A.sort()
if A[2] == A[1] + A[0]:
  print('Yes')
else:
  print('No')
import sys
N,X=[int(x) for x in input().split(' ')]
arr=[int(x) for x in input().split(' ')]
temp=0
for x in range(N):
  if arr[x]+temp>X:
    print(x+1)
    sys.exit(1)
  else:
    temp+=arr[x]
print(N+1)

### FIXED CODE ###

x,a=[int(x) for x in input().split(' ')]
if x<a:
  print(0)
else:
  print(10)
N = int(input())
K = int(input())

now = 1
for i in range(N):
	if now >= K:
        now *= 2
    else:
		now+=K
print(now)


### FIXED CODE ###

N = int(input())
K = int(input())

now = 1
for i in range(N):
    if now <= K:
        now *= 2
    else:
        now+=K
print(now)
X,A,B=map(int,input().split())
if A-B>=0:
  print("delicious")
eilf B-A<=X:
  print("safe")
else:
  print(dangerous)

### FIXED CODE ###

X,A,B=map(int,input().split())
if A-B>=0:
  print("delicious")
elif B-A<=X:
  print("safe")
else:
  print("dangerous")
grrhuagl

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=sys.stdin.readline
def resolve():
    s=input()
    flag=True
    for i in range(len(s)):
        if i%2==0 and s[i]=='L':
            flag=False
        elif i%2==1 and s[i]=='R':
            flag=False
    print("Yes" if flag else "No")

resolve()
nm=[int(x) for x in input().split()]
temp=[]
for x in range(1,int(nm[1]/nm[0])):
    if(nm[1]%x==0):
        temp.append(x)
print(int(max(temp)))

### FIXED CODE ###

n,m = map(int,input().split())
def getDivisor(inte):
    Ans1 = [1]
    Ans2 = [inte]
    for i in range(2,int(inte**(0.5))):
        if inte % i == 0:
            Ans1.append(i)
            Ans2.append(int(inte/i))
    if inte % inte**(0.5) == 0:
        Ans1.append(int(int(inte**(0.5))))
    Ans = Ans1 + Ans2[::-1]
    return Ans

limit = int(m/n)
for i in reversed(getDivisor(m)):
    if i <= limit:
        print(i)
        break
A = input()
a,b = int(A.split' ')
if  0 < a < 11:
   print(b)
else:
   print(b - 100a + 1000)


### FIXED CODE ###

A = input()
b,c = (A.split(' '))
d = int(b)
e = int(c)
f = e - d * 100 + 1000

if 0 < d < 11:
    print(f)
else:
    print(e)
import sys

np = input().split()
n = int(np[0])
p = int(np[1])
bound_p = int(p ** (1 / min(n, 10)))


ilist = list(range(1, bound_p + 1))
ilist.reverse()


for i in ilist:
    pp = p
    for j in range(n):
        if pp % i != 0:
            break
        pp = pp // i
    else:
        print(i)
        sys.exit(0)


print(1)


### FIXED CODE ###

import sys

np = input().split()
n = int(np[0])
p = int(np[1])
bound_p = int(p ** (1 / min(n, 4)))


if n == 1:
    print(p)
    sys.exit(0)


ilist = list(range(2, bound_p + 1))
ilist.reverse()


for i in ilist:
    pp = p
    for j in range(n):
        if pp % i != 0:
            break
        pp = pp // i
    else:
        print(i)
        sys.exit(0)


print(1)
N=int(input())
H=list(map(int,input().split()))
c=0
C=[]

for i in range(len(H)-1) :

    if N == 1 :

        break



    if H[i] >= H[i+1] :

        c+=1

    if i==len(H)-2 or H[i] < H[i+1]:

        C.append(c)

        c = 0

        
print(max(C))
    


### FIXED CODE ###

N=int(input())
H=list(map(int,input().split()))
c=0
C=[0]

for i in range(N-1) :

    if H[i] >= H[i+1] :

        c+=1

    if i==N-2 or H[i] < H[i+1]:

        C.append(c)

        c = 0

print(max(C))
n = int(input())
a = list(map(int, input().split()))
q = int(input())
sums = sum(a)
d = {}

for i in a:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1

for i in range(q):
    b,c = map(int, input().split())
    if b in d:
        sums += d[b]*(c-b)
        if c in d:
          d[c] += d[b]
        else:
          d[c] = d[b]
  		d[b] = 0
    print(sums)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
sums = sum(a)
d = {}

for i in a:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1

for i in range(q):
    b,c = map(int, input().split())
    if b in d:
        sums += d[b]*(c-b)
        if c in d:
          d[c] += d[b]
        else:
          d[c] = d[b]
        d[b] = 0
    print(sums)