Harryxun/stf_run huggingface dataset:
N = int(input())
 A = [int(i) for i in input().split()]

 colors = [0,0,0,0,0,0,0,0,0]

 for a in A:
   if a < 400:
     colors[0] +=1
   elif 400<=a and a <800:
     colors[1] +=1
   elif 800<=a and a<1200:
     colors[2] +=1
   elif 1200<=a and a<1600:
     colors[3] +=1
   elif 1600<=a and a<2000:
     colors[4] +=1
   elif 2000<=a and a<2400:
     colors[5] +=1
   elif 2400<=a and a<2800:
     colors[6] +=1
   elif 2800<=a and a<3200:
     colors[7] +=1
   else:
     colors[8] +=1

 ans = 0
 for i in range(len(colors)-1):
   if colors[i] !=0:
     ans +=1

 print(str(ans) + " " + str(colors[8] + ans))


### FIXED CODE ###

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

colors = [0,0,0,0,0,0,0,0,0]

for a in A:
  if a < 400:
    colors[0] +=1
  elif 400<=a and a <800:
    colors[1] +=1
  elif 800<=a and a<1200:
    colors[2] +=1
  elif 1200<=a and a<1600:
    colors[3] +=1
  elif 1600<=a and a<2000:
    colors[4] +=1
  elif 2000<=a and a<2400:
    colors[5] +=1
  elif 2400<=a and a<2800:
    colors[6] +=1
  elif 2800<=a and a<3200:
    colors[7] +=1
  else:
    colors[8] +=1

ans = 0
for i in range(len(colors)-1):
  if colors[i] !=0 :
    ans +=1

if ans == 0:
  print(str(1) + " " + str(colors[8] + ans))
else:
  print(str(ans) + " " + str(colors[8] + ans))
x=int(input(""))
y=int(input(""))
z=int(input(""))
answer= (x-z)//(z+y)
print(answer)

### FIXED CODE ###

X, Y, Z = map(int, input().split())
print((X-Z)//(Y+Z))
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d = c,d,a,b
if b < c:print(0)
elif b >= c and b < d:print(b-c)
else : print(d-c)

### FIXED CODE ###

a = input()
b =a[::-1]
if a!=b:print("No")
else:print("Yes")
def solve(x):
    for b in xrange(-101, 101):
        a5 = (b ** 5) + x
        s = -1 if a5 < 0 else 1
        a = s * int(pow(abs(a5), 0.2) + 0.1)
        if a ** 5 == a5:
            return a, b

def test(x):
    a, b = solve(x)
    assert x == (a ** 5 - b ** 5)

test(33)
test(1)


x = int(raw_input())
a, b = solve(x)
print a, b


### FIXED CODE ###


def solve(x):
    for b in xrange(-200, 200):
        a5 = (b ** 5) + x
        s = -1 if a5 < 0 else 1
        a = s * int(pow(abs(a5), 0.2) + 0.1)
        if a ** 5 == a5:
            return a, b

def test(x):
    a, b = solve(x)
    assert x == (a ** 5 - b ** 5)

test(33)
test(1)

from random import randint
for i in xrange(100):
    a = randint(-10 ** 3, 10 ** 3)
    b = randint(-10 ** 3, 10 ** 3)
    u = a ** 5 - b ** 5
    if abs(u) > 10 ** 9:
        continue
    test(a ** 5 - b ** 5)


x = int(raw_input())
a, b = solve(x)
print a, b
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ab = [0] * (max(a) + 1)
bc = [0] * (max(b) + 1)

def isok(na , index , key):
    if na[index] >= key:
        return True
    else:
        return False
    
def bs(nar,key):
    left = -1
    right = len(nar)
    
    while (right - left) > 1:
        mid = left + (right - left) // 2
        
        if isok(nar , mid , key):
            right = mid
        else:
            left = mid
            
    return right

ans = 0
for i in b:
    q = bs(a,i)
    r = bs(c,i+1)
    
    ans += q*(n-r)
print(ans)

### FIXED CODE ###

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

def isok(na , index , key):
    if na[index] >= key:
        return True
    else:
        return False
    
def bs(nar,key):
    left = -1
    right = len(nar)
    
    while (right - left) > 1:
        mid = left + (right - left) // 2
        
        if isok(nar , mid , key):
            right = mid
        else:
            left = mid
            
    return right

ans = 0
for i in b:
    q = bs(a,i)
    r = bs(c,i+1)
    
    ans += q*(n-r)
print(ans)
def digit():
    N, K = [int(n) for n in input().split()]
    digit = [int(n) for n in input().split()]

    for i in range(N, N*10):
        b = i
        while b != 0:
            if (b % 10) in digit:
                break
            b /= 10
        if b == 0:
            print(i)
            break:

digit()

### FIXED CODE ###

def has_no(s, digits):
    for ch in s:
        if ch in digits:
            return False
    return True

def digit():
    N, K = [int(n) for n in input().split()]
    digits = input().split()

    for i in range(N, N*10):
        s = str(i)
        if has_no(s, digits):
            print(s)
            break

digit()
sp = input()
t = input()

ls = len(sp)
lt = len(t)
ok = 1
s = list(sp)
print(s)
for i in range(ls):
    ok = 1
    for j in range(lt):
        if (sp[i+j] == t[j]) or (sp[i+j] == '?'):
            continue
        ok = 0
        break
    if ok == 1:
        for si in range(i, i+lt):
            s[si] = t[si - i]
            print(s[si], sep="")
        break

if ok == 1:
    for i in range(ls):
        if s[i] == '?':
            s[i] = 'a'
    print(str(s))
else:
    print("UNRESTORABLE")


### FIXED CODE ###

sp = input()
t = input()

ls = len(sp)
lt = len(t)
ok = 1
s = list(sp)
for i in range(ls-1, -1, -1):
    ok = 1
    for j in range(lt):
        if i + j >= ls:
            ok = 0
            break
        if (sp[i+j] == t[j]) or (sp[i+j] == '?'):
            continue
        ok = 0
        break
    if ok == 1:
        for si in range(i, i+lt):
            s[si] = t[si - i]
        break

if ok == 1:
    print(''.join(s).replace("?", "a"))
else:
    print("UNRESTORABLE")
def inpl(): return [int(i) for i in input().split()]
def next(v):
    for i in edge[v]:
        if visited[i]:
            continue
        visited[i] = True
        return i
    return -1

from collections import defaultdict
edge = defaultdict(lambda: [])
N, M = inpl()
visited = [False for _ in range(N+1)]
visited[1] = True
for _ in range(M):
    A,B = inpl()
    edge[A].append(B)
    edge[B].append(A)
v = 1
nv = 1
path = [1]
while nv >= 0:
    nv = next(v)
    path.append(nv)
    v = nv
path.pop()
path = list(reversed(path))
v = 1
nv = 1
while nv >= 0:
    nv = next(v)
    path.append(nv)
    v = nv
path.pop()
print(len(path))
print(*path)

### FIXED CODE ###

def inpl(): return [int(i) for i in input().split()]

N = int(input())
A = inpl()
ans = 1
first = True
for i in range(N-1):
    if first:
        if A[i+1] == A[i]:
            continue
        else:
            c = (A[i+1]-A[i])//abs((A[i+1]-A[i]))
            first = False
            continue
    if c*A[i] > c*A[i+1]:
        ans += 1
        first = True
print(ans)
n,k=map(int,input().split())
kashi = [0] * n
cnt = 0
M = 0
for s in range(n-1):
	i=int(input())
	li=list(map(int,input().split()))
	if i > 0:
		for m in li:
			kashi[m-1] +=1

for i in kashi:
	if i == 0:
		cnt += 1

print(cnt)
    

### FIXED CODE ###

n,k=map(int,input().split())
kashi = [0] * n
cnt = 0
M = 0
for s in range(k):
	i=int(input())
	li=list(map(int,input().split()))
	if i > 0:
		for m in li:
			kashi[m-1] +=1

for i in kashi:
	if i == 0:
		cnt += 1

print(cnt)
a, b, k = map(int, input().split())
ans_list = []
for i in reversed(range(1, min(a, b))):
    if (a % i == 0) and (b % i == 0):
            ans_list.append(i)
print(ans_list[k-1])



### FIXED CODE ###

a, b, k = map(int, input().split())
ans_list = []
for i in reversed(range(1, min(a, b)+1)):
    if (a % i == 0) and (b % i == 0):
            ans_list.append(i)
print(ans_list[k-1])
S = input()
 
if S[3] ==S[4] and S[5] == S[6]:
  Print('Yes')
else:
  Print('No')

### FIXED CODE ###

S = input()

if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')
num = map(int, raw_input().split())

print num[0] * num[1] 2*num[0] + 2*num[1] 

### FIXED CODE ###

num = map(int, raw_input().split())

print num[0] * num[1], 2*num[0] + 2*num[1]
import sys

x = int(sys.argv[1])
print(x ** 3)

### FIXED CODE ###

import sys

x = int(input())
print(x ** 3)
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    candidate = ["3","5","7"]
    for i in range(9):
        for c in candidate.copy():
            candidate.append(c+"3")
            candidate.append(c+"5")
            candidate.append(c+"7")
    
    ans = 0
    for c in candidate:
        if int(c)<=N and 0 not in (c.count("3"),c.count("5"),c.count("7")):
            ans += 1
    print(ans)



if __name__ == '__main__':
    main()

### FIXED CODE ###

N = int(input())
digit = len(str(N))
list753 = ["3", "5", "7"]  # string

for i in range(digit):
    for n in list753:
        if len(n) == i:
            list753.append(n + "7")
            list753.append(n + "5")
            list753.append(n + "3")

# print(list753)
counter = 0
for num in list753:
    if int(num) <= N and 0 not in [num.count("3"), num.count("5"), num.count("7")]:
        counter += 1
print(counter)
#include <stdio.h>

int main()
{

    int s;
    scanf("%d", &s);
    int a = static_cast<int>(s / 60);
    int b = static_cast<int>(a / 60);
    int c = static_cast<int>(b / 60);
    printf("%d:%d:%d\n", a, b, c);
    return 0;
}


### FIXED CODE ###

s = int(input())
a, b = divmod(s, 60)
c, d = divmod(a, 60)
print("{}:{}:{}".format(c, d, b))
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)), ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:            
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m and cover[ny][nx] < 0:
                q.append((ny, nx, step + 1))
    return cover

def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min(sc[y][x] for sc in scover):
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    if data == "0":
        break
    m, n = map(int, data.split())
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()

### FIXED CODE ###

#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    m, n = map(int, data.split())
    if m == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()
n = int(input())
if n == 14:
    print(re)

### FIXED CODE ###

#import random


n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
INF = 10 ** 13

#n = 15
#info = []
#for i in range(n):
#    info.append([random.randint(-10000, 10000), random.randint(-10000, 10000), random.randint(1, 1000000)])


costs = [INF] * n
for i, (x, y, c) in enumerate(info):
    costs[i] = c * min(abs(x), abs(y))

OFFSET = n
x_dir = [INF] * ((1 << n) * OFFSET)
y_dir = [INF] * ((1 << n) * OFFSET)


for bit_state in range(1 << n):
    for i, (xi, yi, c) in enumerate(info):
        x_dir[bit_state * OFFSET + i] = min(costs[i], x_dir[bit_state * OFFSET + i])
        y_dir[bit_state * OFFSET + i] = min(costs[i], y_dir[bit_state * OFFSET + i])
        if not((bit_state >> i) & 1):
            continue
        for j, (xj, yj, c) in enumerate(info):
            x_dir[bit_state * OFFSET + j] = min(x_dir[bit_state * OFFSET + j], c * abs(yi - yj))
            y_dir[bit_state * OFFSET + j] = min(y_dir[bit_state * OFFSET + j], c * abs(xi - xj))


ans = [INF] * (n + 1)
for bit_state in range((1 << n) - 1):
    x_bit = bit_state
    cnt = bin(bit_state).count("1")
    while x_bit >= 0:
        x_bit &= bit_state
        # bit_stateの下位集合sub_stateの列挙
        # 処理はじめ
        y_bit = bit_state - x_bit
        tmp = 0
        for i in range(n):
            tmp += min(x_dir[x_bit * OFFSET + i], y_dir[y_bit * OFFSET + i])
        ans[cnt] = min(ans[cnt], tmp)
        # 処理おわり
        x_bit -= 1

ans[-1] = 0
for res in ans:
    print(res)
n = int(input())
x = list(map(int, input().split()))
curr = 10 ** 9
ans = 0
for p in ppp:
    if p < curr:
        ans += 1
        curr = p
print(ans)

### FIXED CODE ###

n = int(input())
x = list(map(int, input().split()))
curr = 10 ** 9
ans = 0
for p in x:
    if p < curr:
        ans += 1
        curr = p
print(ans)
# 2入力
K, N = map(int, input().split())
A = input().split()
A = [int(i) for i in A]

lag = []
for i in range(len(A)):
    if i != N-1:
        lag.append(A[(i+1)%N] - A[i%N])
    else:
        lag.append(K-A[i] + A[0])

import numpy as np
max_index = np.argmax(lag)
del lag[max_index]
print(sum(lag))

### FIXED CODE ###

# 2入力
K, N = map(int, input().split())
A = input().split()
A = [int(i) for i in A]

lag = []
for i in range(len(A)):
    if i != N-1:
        lag.append(A[(i+1)%N] - A[i%N])
    else:
        lag.append(K-A[i] + A[0])


max_value = max(lag)
max_index = lag.index(max_value)
lag.pop(max_index)
print(sum(lag))
N = int(input())
A = [int(input()) for i in range(N)]
print(max(A) - min(A))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
print(max(A) - min(A))
n ,m = map(int, input().split())
result = set()
first = True
for i in range(m):
    l, r = map(int, input().split())
    tmp = set()
    for i in range(l, r + 1):
        tmp.add(i)
    if first:
        result = tmp
        # print("tmp {}".format(tmp))
        first = False
    else:
        result = result.intersection(tmp)
        # print("result {} tmp {}".format(result, tmp))

print(len(result))n ,m = map(int, input().split())
result = set()
first = True
for i in range(m):
    l, r = map(int, input().split())
    tmp = set()
    for i in range(l, r + 1):
        tmp.add(i)
    if first:
        result = tmp
        first = False
    else:
        result = result.intersection(tmp)
print(len(result))

### FIXED CODE ###

n ,m = map(int, input().split())
L = []
R = []
for i in range(m):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
if max(L) <= min(R):
    print(min(R) - max(L) + 1)
else:
    print(0)
n,k=map(int,input().split())
s=input()
w=s[k+1]
w=w.lower()
ans=s[:k+1]+w+s[n:]
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
s=list(input())
s[k-1]=str.lower(s[k-1])
print(''.join(s))
n, m = map(int, input().split())
key_price = [0] * m
box_price = [(-1, [-1])] * (n+1)
box_key = [set([]) for _ in range(n+1)]
for key in range(m):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    key_price[key] = a
    for i in c:
        if box_price[i][0] == -1:
            box_price[i] = (a, [key])
        elif box_price[i][0] > a:
            box_price[i] = (a, [key])
        elif box_price[i][0] == a:
            box_price[i] = (a, box_price[i][0] + [key])
        box_key[i].add(key)


def cost(using_keys):
    ret = 0
    for k, v in using_keys.items():
        if v >= 1:
            ret += key_price[k]
    return ret


from collections import defaultdict
keys = defaultdict(int)
kbx = {i: 0 for i in range(1, n+1)}
for i in range(1, n+1):
    keys[box_price[i][1][0]] += 1
    kbx[i] = box_price[i][1][0]

ans = cost(keys)

for key in range(m):
    for i in range(1<<n):
        ks = keys
        kbx1 = kbx
        for b in range(n):
            if i & (1 << b) and key in box_key[b]:
                ks[kbx[b]] -= 1
                ks[key] += 1
                kbx1[b] = key
        tmp = cost(ks)
        if ans > tmp:
            keys = ks
            kbx = kbx1
            ans = tmp

print(ans)



### FIXED CODE ###

n, m = map(int, input().split())
r = [2**i for i in range(n+1)]

price = [0] * m
mask = [0] * m
for i in range(m):
    a, b = map(int, input().split())
    for box in map(int, input().split()):
        mask[i] += r[box-1]
    price[i] = a


inf = 10**9
dp = [[inf] * (1 << n) for _ in range(m+1)]
dp[0][0] = 0
for i in range(m):
    for j in range(1 << n):
        dp[i+1][j | mask[i]] = min(
            dp[i][j] + price[i],
            dp[i+1][j | mask[i]]
        )
        dp[i+1][j] = min(dp[i][j], dp[i+1][j])

ans = dp[m][(1 << n) - 1]
if ans == inf:
    print(-1)
else:
    print(ans)
import numpy as np

N, M = list(map(int, input().split()))
s = [0]*M
c = [0]*M
for i in range(M):
    s[i], c[i] = list(map(int, input().split()))

max = 10 ** N - 1

smax = np.max(s)
if smax != 1:
    min = 10 ** (smax - 1)
else:
    min = 0

answer = -1
for i in range(max, min-1, -1):
    flag = 1
    for j in range(M):
        if int(str(i)[s[j]-1]) != c[j]:
            flag = 0
    if flag == 1:
        answer = i
print(answer)

### FIXED CODE ###

import numpy as np

N, M = list(map(int, input().split()))
s = [0]*M
c = [0]*M
check = 1
for i in range(M):
    s[i], c[i] = list(map(int, input().split()))
    if ((N > 2) & (s[i] == 1) & (c[i] == 0)):
        check = 0

if check == 0:
    print('-1')
else:
    if N > 1:
        max = 10 ** N - 1
        min = 10 ** (N - 1)
    else:
        max = 9
        min = 0

    answer = -1

    for i in range(max, min-1, -1):
        flag = 1
        for j in range(M):
            if s[j] <= N:
                if int(str(i)[s[j]-1]) != c[j]:
                    flag = 0
        if flag == 1:
            answer = i
    print(answer)
# C - Traveling Salesman around Lake
K,N = list(map(int, input().split()))
A = list(map(int, input().split()))

import numpy as np
D = np.zeros((N, N))

for i in range(N):
    j = (i+1)%N
    if j == 0:
        D[i,j]=K-abs(A[j]-A[i])
    else:
        D[i,j] = abs(A[j]-A[i])

idx = np.unravel_index(np.argmax(D), D.shape)
dmax = D[idx]
ans = int(K - dmax)
print(ans)

### FIXED CODE ###

# C - Traveling Salesman around Lake
K,N = list(map(int, input().split()))
A = list(map(int, input().split()))

a = A[1] - A[0]
for i in range(1,N-1):
    j = i + 1
    a = max(a,A[j]-A[i])

b = K-(A[N-1]-A[0])
c = max(a,b)
ans = K -c
print(ans)
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

def main():
    N,K = map(int, readline().split())
    A = [int(i) for i in readline().split()]

    acc_A = [1]
    for a in A:
        acc_A.append(acc_A[-1] * a)
    
    ans = -10**15
    for r in range(K, N+1):
        ans = max(ans, acc_A[r] // acc_A[r-K])
    
    print(ans % MOD)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from heapq import heapify, heappush, heappop
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

def main():
    N,K = map(int, readline().split())
    A = [int(i) for i in readline().split()]

    ans = 1
    if K == N:
        for a in A:
            ans *= a
            ans %= MOD
        print(ans)
        exit()

    plus = []
    minus = []

    for a in A:
        if a < 0:
            heappush(minus, a)
        else:
            heappush(plus, -a)

    if not plus:
        if K % 2 == 1:
            for _ in range(N-K):
                heappop(minus)
            for _ in range(K):
                ans *= heappop(minus)
                ans %= MOD
        else:
            for _ in range(K):
                ans *= heappop(minus)
                ans %= MOD
        print(ans)
        exit()

    p = []
    m = []
    for _ in range(K):
        if plus and minus:
            if plus[0] <= minus[0]:
                p.append(-heappop(plus))
            else:
                m.append(heappop(minus))
        elif plus:
            p.append(-heappop(plus))
        else:
            m.append(heappop(minus))

    for i in p:
        ans *= i
        ans %= MOD
    for j in m:
        ans *= j
        ans %= MOD

    if len(m) % 2 == 0:
        print(ans)

    else:
        if plus and minus and p and m:
            if p[-1] * (-plus[0]) >= m[-1] * minus[0]:
                ans *= pow(m[-1], MOD-2, MOD)
                ans *= -plus[0]
                ans %= MOD
            else:
                ans *= pow(p[-1], MOD-2, MOD)
                ans *= minus[0]
                ans %= MOD
        elif plus:
            ans *= pow(m[-1], MOD-2, MOD)
            ans *= -plus[0]
            ans %= MOD
        else:
            ans *= pow(p[-1], MOD-2, MOD)
            ans *= minus[0]
            ans %= MOD
        
        print(ans)


if __name__ == "__main__":
    main()
from goto import goto, label

S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

for i in range(L, R, 1):
    for j in range(i+1, R+1, 1):
        mod = (i*j) % 2019
        if mod < min:
            min = mod
            if min == 0:
                goto .END
label .END
print(min)


### FIXED CODE ###


S = input()

S = S.split()

L = int(S[0])
R = int(S[1])
min = 2 * (10**10)

flg = 0

for i in range(L, R, 1):
    if flg ==0:
        for j in range(i+1, R+1, 1):
            mod = (i*j) % 2019
            if mod < min:
                min = mod
                if min == 0:
                    flg = 1
                    break
    else:
        break

print(min)
a, b, x = list(map(int, input().split()))
import math
if x/a <= s:
    h = 2 * x / a / b
    ans = math.degrees(math.atan2(b, h))
else:
    h = 2 * (b - x / a / a)
    ans = math.degrees(math.atan2(h, a))

print(ans)

### FIXED CODE ###

import math
a, b, x = list(map(int, input().split()))
s = 0.5 * a * b
if x/a <= s:
    h = 2 * x / a / b
    ans = math.degrees(math.atan2(b, h))
else:
    h = 2 * (b - x / a / a)
    ans = math.degrees(math.atan2(h, a))

print(ans)
a,b = map(int, input().split())
if a+b <= 9:
  print(a+b)
else;
print("error")

### FIXED CODE ###

a,b = map(int, input().split())
if a+b >= 10:
  print("error")
else:
  print(a+b)
n=int(input())

def euc(a,b):
  if a==b:
    return a
  else:
    return euc(max(a,b)%min(a,b),min(a,b))
ans=0
mons=list(map(int,input().split()))
for i in range(n-1):
  p=euc(mons[i],mons[i+1])
  if p==1:
    ans=1
    break
    
  else:
    mons[i+1]=p

if ans==1:
  print(1)
else:
  print(mons[n-1])


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
def euc(x,y):
  x,y=max(x,y),min(x,y)
  if x%y==0:
    return y
  else:
    return euc(y,x%y)
k=a[0]
for i in range(1,n):
  k=euc(a[i],k)
print(k)