Harryxun/stf_run huggingface dataset:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n, x = map(int, input().split())
num = list(map(int,input().split()))
d = abs(num[0]-x)
for nn in num:
    d=gcd(t,abs(n-x))
print(d)

### FIXED CODE ###

import fractions

n, x = map(int, input().split())
num = list(map(int,input().split()))
d = abs(num[0]-x)
for nn in num:
	d=fractions.gcd(d, abs(nn-x))
print(d)
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.appned(ai)
        b.appned(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                for v2 in vtx1:
                    if v1!=v2:
                        if b1[i] in v2:
                            break
                if v1!=v2:
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)        
#for i in range(m):
#    for v1 in vtx1:
#        if a[i] in v1:
#            for v2 in vtx1:
#                if v1!=v2:
#                    if b[i] in v2:
#                        break
#            if v1!=v2:
#                vtx1.remove(v1)
#                vtx1.remove(v2)
#                v3=v1+v2
#                vtx1.append(v3)
#    print(a[i],b[i],len(vtx1),vtx1)


### FIXED CODE ###

icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.append(ai)
        b.append(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                if not b1[i] in v1:
                    for v2 in vtx1:
                        if v1!=v2:
                            if b1[i] in v2:
                                break
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)
N=int(int(input))
A=list(map(int,input().split()))
sum=sum[A]
b=0
c=0
for i in range(N-1):
    b+=A[i]
    c=(c+(A[i]*(sum-b))) %(10**9+7)
print(c)

### FIXED CODE ###

N=int(input())
a=list(map(int, input().split()))
sum=sum(a)
b=0
c=0
for i in range(N-1):
    b+=a[i]
    c=(c+(a[i]*(sum-b))) %(10**9+7)
print(c)
n = int(input())

if n == 1:
  print('Hello World')
else:
  a, b = list(map(int, input().split()))
  print(a + b)

### FIXED CODE ###

n = int(input())

if n == 1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a + b)
O=input()
E=inpu()
ans=""
for i in range(len(E)):
  ans+=O[i]
  ans+=E[i]

if len(O)!=len(E):
  ans+=O[-1]
print(ans)

### FIXED CODE ###

O=input()
E=input()
ans=""
for i in range(len(E)):
  ans+=O[i]
  ans+=E[i]

if len(O)!=len(E):
  ans+=O[-1]
print(ans)
from math import factorial as fact
def comb(n, r): return fact(n)//(fact(r)*fact(n-r))

def main():
    n, k = map(int, input().split())
    for i in range(k): print((comb(n-k+1, i+1) * comb(k-1, i)) % 1000000007)

if __name__=="__main__": main()

### FIXED CODE ###

from math import factorial as fact
def comb(n, r):
  if n<=r: return fact(n)//fact(r)
  else: return fact(n)//(fact(r)*fact(n-r))

def main():
    n, k = map(int, input().split())
    for i in range(k): print((comb(n-k+1, i+1) * comb(k-1, i)) % 1000000007)

if __name__=="__main__": main()
S = input()
N = len(S)
c = [1 for _ in range(N)]

dic = {}
freq = 0
start = 0
for i in range(int(N ** 0.5)):
  tmp = [0 for _ in range(N)]
  for j in range(N):
    if j > 0 and S[j - 1] == "R":
      tmp[j] += c[j - 1]
    if j < N - 1 and S[j + 1] == "L":
      tmp[j] += c[j + 1]
  c = tmp
  if str(c) in dic.keys():
    freq = i - dic[str(c)]
    start = dic[str(c)]
    break
  else:
    dic[str(c)] = i

n = start + ((10 ** 100 - start - 1) % freq)
key = [k for k, v in dic.items() if v == n][0]
key = key.replace("[", "").replace("]", "")
k = list(key.split(", "))
for i in range(N):
  print(k[i], end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")

### FIXED CODE ###

S = input()
N = len(S)

ans = []
RL = []
s = "R"
flag = False
for i in range(1, N):
  if S[i] == "L" or S[i] == "R" and S[i - 1] == "R":
    s += S[i]
  else:
    RL.append(s)
    s = "R"
RL.append(s)

for rl in RL:
  for i in range(len(rl)):
    if rl[i] == "R" and rl[i + 1] == "L" or rl[i] == "L" and rl[i - 1] == "R":
      if i % 2 == 1:
        ans.append(len(rl) // 2)
      else:
        ans.append((len(rl) + 1) // 2)
    else:
      ans.append(0)

for i in range(N):
  print(ans[i], end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")
a,b,c=map(int,input().split())

if a=b+c or b=c+a or c= a+b:
  print('Yes')
else:
  prine('No')

### FIXED CODE ###

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

if a==b+c or b==c+a or c==a+b:
  print('Yes')
else:
  print('No')
n,q=map(int,input().split())
s=input()
a=[0]
for l in range(n):
    if s[l]=='A' and s[l+1]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y-1]-a[x-1])

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
a=[0,0]
for l in range(1,n):
    if s[l-1]=='A' and s[l]=='C':
        a.append(a[l]+1)
    else :
        a.append(a[l])
for k in range(q):
    x,y=map(int,input().split())
    print(a[y]-a[x])
N, K = map(int, input().split())
l = list(map(int, input().split()))
x = 

### FIXED CODE ###

N, K = map(int, input().split())
l = list(map(int, input().split()))
x = sorted(l)[::-1]
print(sum(x[:K]))
A,B,C = map(int,input())
K = int(input())
if A > (B + C):
    print("No")
else:
    print("Yes")

### FIXED CODE ###

A,B,C = map(int,input().split())
K = int(input())
i = 0
while True:
    if B > A:
        break
    else:
        B = B * 2
    i += 1
q = 0
while True:
    if C > B:
        break
    else:
        C = C * 2
    q += 1
if (i + q) > K:
    print("No")
else:
    print("Yes")
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()

limit = sum(range(1, N-1))
if K > limit:  # むり
	print(-1)
else:  # いける
	edge = list(combinations([1,2,3,4,5],2))
	for i in range(K):
		if edge[i][1] == N:
			continue
		else:
			edge.pop(0)

	print(N*(N-1)//2 - K)
	for i in edge:
		print(i)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()

limit = sum(range(1, N-1))

if K > limit:  # むり
	print(-1)
else:  # いける
	edge = list(combinations(range(1, N+1),2))
	if K == 0:
		print(N*(N-1)//2)
		for u, v in edge:
			print(u, v)
	else:	
		rem = []
		count = 0
		for i in edge:
			if i[1] != N:
				rem.append(i)
				count += 1
				if count == K:
					break
		for i in rem:
			edge.remove(i)

		print(N*(N-1)//2 - K)
		for u, v in edge:
			print(u, v)
N, K = map(int, input().split())
LARGE = 10 ** 9 + 7

# SQRT
R = 1
while (R + 1) ** 2 < N:
    R += 1

square = False
if (R + 1) ** 2 == N:
    square = True


DP_S = [1] * R
DP_L = [1] * R
N_L = [1] * R
DP_M = 0
L = R
if square:
    DP_M = 1
    L += 1


for i in range(R, -1, 0):
    Q = N // i
    DP_L[i - 1] = Q - L
    N_L[i - 1] = Q - L
    L = Q

for _ in range(K - 1):
    S = 0
    L = sum(DP_L) + DP_M
    SS = sum(DP_S)
    for i in range(R):
        DP_L[i] = S * N_L[i] % LARGE
        DP_S[i] = L + SS % LARGE
        S = (S + DP_S[i]) % LARGE
        L = (L - DP_L[i]) % LARGE

        if square:
            DP_M = (DP_M + SS) % LARGE

print((sum(DP_L) + sum(DP_S) + DP_M) % LARGE)


### FIXED CODE ###

N, K = map(int, input().split())
LARGE = 10 ** 9 + 7

# SQRT
R = 1
while (R + 1) ** 2 < N:
    R += 1

square = False
if (R + 1) ** 2 == N:
    square = True


DP_S = [1] * R
DP_L = [1] * R
N_L = [1] * R
DP_M = 0
L = R
if square:
    DP_M = 1
    L += 1


for i in range(R, 0, -1):
    Q = N // i
    DP_L[i - 1] = Q - L
    N_L[i - 1] = Q - L
    L = Q

for _ in range(K - 1):
    S = 0
    L = sum(DP_L) + DP_M
    SS = sum(DP_S)
    for i in range(R):
        S = (S + DP_S[i]) % LARGE
        DP_S[i] = (L + SS) % LARGE
        L = (L - DP_L[i]) % LARGE
        DP_L[i] = (S * N_L[i]) % LARGE

    if square:
        DP_M = (DP_M + SS) % LARGE

print((sum(DP_L) + sum(DP_S) + DP_M) % LARGE)
N = int(input())
A = list(map(int,input().split()))

import math

gcd_a = A[0]

for i in A:
    gcd_a = math.gcd(gcd_a,i)

print(gcd_a)

### FIXED CODE ###

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

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

gcd_a = A[0]

for i in A:
    gcd_a = gcd(gcd_a,i)

print(gcd_a)
# Input part 
N = int(input())
rateBtcYen =  380000.0 
totalYen = 0
for i in range(0, N):
    amountString, currency = input().split()
    amount = int(amountString)
    if currency == "BTC":
        totalYen += amount*rateBtcYen
    else:
        totalYen += amount
print(totalYen)

### FIXED CODE ###

N = int(input())
rateBtcYen =  380000.0 
totalYen = 0
for i in range(0, N):
    amountString, currency = input().split()
    amount = float(amountString)
    if currency == "BTC":
        totalYen += amount*rateBtcYen
    else:
        totalYen += amount
print(totalYen)
n, a, b = map(int, input().split())
print(n//(a+b))*a+min((n%(a+b), a)

### FIXED CODE ###

n, a, b = map(int, input().split())
print((n//(a+b))*a+min(n%(a+b), a))
from fractions import gcd

A, B = map(int, input().split())
lcm = A//fractions.gcd(A, B)*B

print(lcm)

### FIXED CODE ###

import fractions
A,B=map(int,input().split())
print(A*B//fractions.gcd(A,B))
sequence = ((1, 3, 5, 7, 8, 10, 12), (4, 6, 9, 11), (2))

x , y = map(int, input().split())
for s in sequence:
    if x in s and y in s:
        print('Yes')
        exit()
print('No')



### FIXED CODE ###

sequence = ((1, 3, 5, 7, 8, 10, 12), (4, 6, 9, 11), (2, ))

x , y = map(int, input().split())
for s in sequence:
    if x in s and y in s:
        print('Yes')
        exit()
print('No')
N=input()
cnt=0
last=-1
while N>0:
  N,n=divmod(N,10)
  if last == n:
    cnt+=1
    if cnt>=3:
      break
  else:
    cnt=1
  last=n
if cnt>=3:
  print('yes')
else:
  print('no')

### FIXED CODE ###

N=int(input())
cnt=0
last=-1
while N>0:
  N,n=divmod(N,10)
  if last == n:
    cnt+=1
    if cnt>=3:
      break
  else:
    cnt=1
  last=n
if cnt>=3:
  print('Yes')
else:
  print('No')
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(N - 1 + M)]

G = [set() for _ in range(N + 1)]
P_cand = [set() for _ in range(N + 1)]
for a, b in AB:
    G[a].add(b)
    P_cand[b].add(a)
for p in range(1, N):
    if len(P_cand[p]) == 0:
        break
D = [-1] * (N + 1)
P = [0] * (N + 1)


def dfs(p, d):
    for c in G[p]:
        if D[c] < d + 1:
            D[c] = d + 1
            P[c] = p
            dfs(c, d + 1)


dfs(p, 0)
[print(_) for _ in P[1:]]


### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(N - 1 + M)]

G = [set() for _ in range(N + 1)]
count = [0] * (N + 1)
ans = [0] * (N + 1)
for a, b in AB:
    G[a].add(b)
    count[b] += 1
for i in range(1, N):
    if count[i] == 0:
        root = collections.deque([i])
        break
while root:
    p = root.popleft()
    for c in G[p]:
        count[c] -= 1
        if count[c] == 0:
            ans[c] = p
            root.append(c)
print(*ans[1:], sep='\n')
N = int(input())
ans = 1
d = []
for i in range(N):
  d.append(int(input()))
sorted(d,reverse=True)
for i in range(len(d)-1):
  if d[i] == d[i+1]:
    d.remove(d[i+1])
print(len(d))

### FIXED CODE ###

N = int(input())
ans = 1
d = []
for i in range(N):
  d.append(int(input()))
sorted(d,reverse=True)
k = set(d)
K = list(k)
print(len(K))
denominator = 0
for a in range(map(int, input().split())):
  denominator += 1 / a

print(1 / denominator)

### FIXED CODE ###

n = int(input())

denominator = 0
for a in map(int, input().split()):
  denominator += 1 / a

print(1 / denominator)
s = input.readline()
i=1
while True:
    print("case {0}: {1}".format(i,s))
    i += 1
    s = input()
    if s=="0":
        break

### FIXED CODE ###

a = []
i = 0
while True:
    n = input()
    if n == "0":
        break
    a.append(n)
    i += 1
    print("Case {0}: {1}".format(i,n))
import math
A, B = list(map(int, input().split()))

A_min = math.ceil(A * 25 / 2)
A_max = ((A + 1) * 25 / 2)
if A_max > math.floor(A_max):
    A_max = math.floor(A_max) + 1
else:
    A_max = A_max
A_max = int(A_max)
B_min = B * 10
B_max = (B + 1) * 10
# print(B_min, B_max)
# A_list = list(range(A_min, A_max))
# B_list = list(range(B_min, B_max))
print(A_list)
print(B_list)

min_ans = -1
for num in A_list:
    if num in B_list:
        min_ans = num
        break
    else:
        continue

print(min_ans)


### FIXED CODE ###

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

A_min = math.ceil(A * 25 / 2)
A_max = ((A + 1) * 25 / 2)
if A_max > math.floor(A_max):
    A_max = math.floor(A_max) + 1
else:
    A_max = A_max
A_max = int(A_max)
B_min = B * 10
B_max = (B + 1) * 10
# print(B_min, B_max)
A_list = list(range(A_min, A_max))
B_list = list(range(B_min, B_max))
# print(A_list)
# print(B_list)

min_ans = -1
for num in A_list:
    if num in B_list:
        min_ans = num
        break
    else:
        continue

print(min_ans)
import numpy as np

[H, W, M] = map(int, input().split())
mp = np.zeros((H+1, W+1), dtype=np.int64)
for i in range(M):
    [h, w] = map(int, input().split())
    mp[h][w] = 1

colsum = np.sum(mp, axis=0)
rowsum = np.sum(mp, axis=1)

maxcol = max(colsum)
maxrow = max(rowsum)

colchk = np.where(colsum==maxcol)
rowchk = np.where(rowsum==maxrow)

#for i in range(len(rowchk[0])):
#    for j in range(len(colchk[0])):
#        if mp[rowchk[0][i]][colchk[0][j]] == 0:
#            print(int(max(colsum)+max(rowsum)))
#            quit()

print(int(max(colsum)+max(rowsum))-1)


### FIXED CODE ###

import numpy as np

[H, W, M] = map(int, input().split())
colsum = np.zeros(W+1)
rowsum = np.zeros(H+1)
bombs = []
rowbombs = [set() for i in range(H+1)]
for i in range(M):
    [h, w] = map(int, input().split())
    rowsum[h] += 1
    colsum[w] += 1
    bombs.append([h, w])
    rowbombs[h].add(w)

maxcol = max(colsum)
maxrow = max(rowsum)

colchk = np.where(colsum==maxcol)
rowchk = np.where(rowsum==maxrow)

for i in range(len(rowchk[0])):
    for j in range(len(colchk[0])):
        if colchk[0][j] not in rowbombs[rowchk[0][i]]:
            print(int(max(colsum)+max(rowsum)))
            quit()

print(int(max(colsum)+max(rowsum))-1)
N = int(input())
lst = list(map(int, input().split()))
lst = sorted(A,reverse=True)
output = 1
if 0 in lst:
    print(0)
    quit()
else:
    for i in range(N):
        output = output*A[i]
        if output>= 10**18:
            print(-1)
            quit()
print(output)

### FIXED CODE ###

n = int(input())
ls = list(map(int, input().split()))
res = 1
if 0 in ls:
    print(0)
    quit()
for x in ls:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)
a,b,k = list(map(int, input().split()))
x=[]

for i in range(1, min(a, b)):
    if a%i == 0 and b%i==0:
      x.append(i)

x.sort(reverse=True)
print(x[k-1])

### FIXED CODE ###

a,b,k = list(map(int, input().split()))
x=[]

for i in range(1, min(a, b)+1):
    if a%i == 0 and b%i==0:
      x.append(i)

x.sort(reverse=True)
print(x[k-1])
import math

print(int(input()) * 2 * math.pi())


### FIXED CODE ###

import math

print(int(input()) * 2 * math.pi)
A,B=map(int,input().split())

if A%3==0 or B%3== or (A+B)%3==0:
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

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

if A%3==0 or B%3==0 or (A+B)%3==0:
  print("Possible")
else:
  print("Impossible")
a, b, c = map(int. input().split())
if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)

### FIXED CODE ###

a, b, c = map(int, input().split())
if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)
#!/usr/bin/env python3

n = int(input())
t = list(map(int,input().split()))
m = int(input())
px = [list(map(int,input().split())) for _ in range(m)]

for p,x in px:
    T = t.copy()
    T[p-1] = x
    print(sum(T))


### FIXED CODE ###

#!/usr/bin/env python3

N = int(input())
T = list(map(int,input().split()))
t = sum(T)
M = int(input())
P = []
X = []
for i in range(M):
    p,x = map(int,input().split())
    P.append(p)
    X.append(x)

for i in range(M):
    s = t - T[P[i]-1] + X[i]
    print(s)
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

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

for i in range(N-1):
    u,v,w = map(int,input().split())
    u -= 1
    v -= 1
    graph[u].add((v,w))
    graph[v].add((u,w))


res = [None for i in range(N+1)]

# v は今見ている頂点，p はｖの親
def dfs(node,p,color): # Depth First Serch
    res[node] = color
    for new_node,w in graph[node]:
        if new_node == p:
            continue
        if w % 2 == 1:dfs(new_node,node,1-color)
        else:dfs(new_node,node,color)
#tree 探索　
# vは頂点，ｐは親
dfs(0,-1,0)

for i in range(N):
    print(res[i])


### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys



mod = 10**9+7
sys.setrecursionlimit(mod)

N = int(input())
graph = [set() for i in range(N+1)]

for i in range(N-1):
    u,v,w = map(int,input().split())
    u -= 1
    v -= 1
    w = w % 2
    graph[u].add((v,w))
    graph[v].add((u,w))


res = [None for i in range(N+1)]

# v は今見ている頂点，p はｖの親
def dfs(node,p,color): # Depth First Serch
    res[node] = color
    for new_node,w in graph[node]:
        if new_node == p:
            pass
        else:
            if w == 1:dfs(new_node,node,1-color)
            else:dfs(new_node,node,color)
#tree 探索　
# vは頂点，ｐは親
dfs(0,-1,0)

for i in range(N):
    print(res[i])
a,b,c,d,e,f=map(int,input().split())
water=[]
suguar=[]
for i in range((f+1)//100):
    for j in range((f+1)//100):
        x=100*i*a+100*j*b
        if 1<=x<=f:
            water.append(x)
for i in range(f+1):
    for j in range(f+1):
        y=c*i+d*j
        if y<=f:
            suguar.append(y)
ans=0
for i in water:
    for j in suguar:
        total=i+j
        if total<=f:
            if j<=i//100*e:
                con=100*j/(i+j)
                if ans<con:
                    ans=con
                    ans_2=total
                    ans_3=j
print(ans_2,ans_3)


### FIXED CODE ###

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

sugar = []
for i in range(f):
    for j in range(f):
        y = i*c + j*d
        if y <= f:
            sugar.append(y)

water = []
for i in range(0, f//100+1):
    for j in range(0, f//100+1):
        x = i*a*100 + j*b*100
        if x <= f:
            water.append(x)
max_concentration = 0
ans1, ans2 = 0, 0
for x in water:
    for y in sugar:
        if x == 0 and y == 0:
            continue
        elif e * (x // 100) < y:
            continue
        elif x + y > f:
            continue
        else:
            concentration = (100 * y) / (x+y)
            if max_concentration <= concentration:
                max_concentration = concentration
                ans1 = x+y
                ans2 = y
print("{} {}".format(ans1, ans2))
n = int(input())
t = list(map(int, input().split()))
m = int(input())
pl = []
for i in range(m):
    pl.append(list(map(int, input().split())))


for i in pl:
    tt = t.copy()
    tt[i[0]-1] = i[1]
    print(sum(tt))


### FIXED CODE ###

n = int(input())
t = list(map(int, input().split()))
m = int(input())
pl = []
for i in range(m):
    pl.append(list(map(int, input().split())))


for i in pl:
    tt = t.copy()
    tt[i[0]-1] = i[1]
    print(sum(tt))
k = int(input())
[start end] = input().split(' ')
start = int(start)
end = int(end)

for i in range(start, end):
  if i % k == 0:
    return True
return False

### FIXED CODE ###

k = int(input())
(start, end) = map(int, input().split())


for i in range(start, end+1):
  if i % k == 0:
    print('OK')
    exit(0)
print('NG')
from math import factorial

n, k = map(int, input().split())
def fac(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))
for i in range(1, k + 1):
    print( (fac(n - k + 1, i) * fac(k - 1, i - 1)) % (10 ** 9 + 7))


### FIXED CODE ###

from math import factorial

n, k = map(int, input().split())
def fac(n, r):
    return factorial(n) // (factorial(max(0, n - r)) * factorial(r))
for i in range(1, k + 1):
    print( (fac(n - k + 1, i) * fac(k - 1, i - 1)) % (10 ** 9 + 7))
N = input()
ABCDE = []
for i in range(4):
    A = input()
    ABCDE.append(A)
m = min(ABCDE)
if N % n == 0:
    print(N // m)
else:
    print(N // m + 1)

### FIXED CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
m = min(A, B, C, D, E)
if N % m == 0:
    print(N // m + 4)
else:
    print(N // m + 5)
n=int(input(""))
ain=input("").split(" ")
a={1:0,}
c=[]
for i in range(n):
    c+=[int(ain[i])]
s=sum(c)
for i in range(n):
    if (c[i] in a):
        a[c[i]]+=1
    else:
        a[c[i]]=1
q=int(input(""))
c=[]
listb=[]
listc=[]
for i in range(q):
    c=+[input("").split(" ")]
    listb+=[int(c[i][0])]
    listc+=[int(c[i][1])]
    if (listb[i] in a and a[listb[i]]!=0):
        s+=(listc[i]-listb[i])*a[listb[i]]
        if (listc[i] in a):
            a[listc[i]]+=a[listb[i]]
        else:
            a[listc[i]]=a[listb[i]]
    
    print(s)
    
    
    


### FIXED CODE ###

n=int(input(""))
ain=input("").split(" ")
a={1:0,}
c=[]
for i in range(n):
    c+=[int(ain[i])]
s=sum(c)
for i in range(n):
    if (c[i] in a):
        a[c[i]]+=1
    else:
        a[c[i]]=1
q=int(input(""))
c=[]

for i in range(q):
    c=input("").split(" ")
    bb=int(c[0])
    cc=int(c[1])
    if (bb in a and a[bb]!=0):
        s+=(cc-bb)*a[bb]
        if (cc in a):
            a[cc]+=a[bb]
        else:
            a[cc]=a[bb]
        a[bb]=0
                              
    print(s)
a=int(input())
  max=h[0]
  min=h[0]
for i in a:
  h[i]=int(input())
  
  if max<h[i] :
    max=h[i]
  if min>h[i] :
    min=h[i]
answer=max-min
print(answer)



### FIXED CODE ###

a=int(input())
i =  input().split()
max=int(max(i))
min=int(min(i))
answer=int(max)-int(min)
print(answer)