Harryxun/stf_run huggingface dataset:
input()
a = map(int, raw_input().split())

a.reverse()
for i in range(0, a.len()-1):
    print a[i],

### FIXED CODE ###

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

a.reverse()
print(" ".join(map(str, a)))
a,b = int(input())

c = a*b

if a<10 or b<10:
    print(c = -1)
else:
    print(a*b)

### FIXED CODE ###

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

if a<10 and b<10:
    print(a*b)
else:
    print(-1)
s = input()
if s == 'AAA' or s = 'BBB'
  print('No')

else print('Yes')

### FIXED CODE ###

s = input()
if s == 'AAA' or s == 'BBB':
  print('No')

else:
  print('Yes')
a, b = input().split()
b = b*100
a = int(a)
b = int(b)
print(b)
print((a*b)//100)

### FIXED CODE ###

a, b = input().split()
b = int(''.join(b.split('.')))
a = int(a)
print((a*b)//100)
H,N = map(int,input().split())
AB = []
 
for i in range(N):
    a,b = map(int,input().split())
    AB.append([a,b])
    
INF = 10**15
M = 2*10**4

dp = [[INF]*(M+1) for i in range(N+1)]

for i in range(N+1):
    dp[i][0] = 0

for i in range(N):
    A,B = AB[i]
    for j in range(A):
        dp[i+1][j] = min(dp[i+1][j],dp[i][j])
    for j in range(H)
        dp[i+1][j+A] = min(dp[i][j+A], dp[i+1][j]+B, dp[i+1][j+A])
        
ans = INF
for i in range(H,M):
    ans = min(ans,dp[N][i])
print(ans)

### FIXED CODE ###

N,D,A = map(int,input().split())
XH = []
X = []

for i in range(N):
    x,h = map(int,input().split())
    XH.append([x,h,0])
    X.append(x)
    
XH.sort(key = lambda a:a[0])
XH.append([float('inf'),0,0])
X.sort()
X.append(float('inf'))

import bisect
ans = 0

for i in range(N):
    x,h,k = XH[i]
    dk = max(-(-(h-k*A)//A),0)
    #print(x,h,k,dk)
    ans += dk
    
    XH[i][2] += dk
    j = bisect.bisect_right(X,x+2*D)
    XH[j][2] -= dk

    XH[i+1][2] += XH[i][2]
    
print(ans)
n = input().strip()
s = set(input().strip().split(" "))
if len(s) == 3:
    print("Three")
else:
    print("Four"

### FIXED CODE ###

n = input().strip()
s = set(input().strip().split(" "))
if len(s) == 3:
    print("Three")
else:
    print("Four")
x,y = map(int,input().split())
if x > y:
  print('>')
elif x < y:
  print('<')
else:
  print('==')

### FIXED CODE ###

x,y = map(str,input().split())
if x > y:
  print('>')
elif x < y:
  print('<')
else:
  print('=')
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>K:
         counter=i
         break
print(A[counter][0])

### FIXED CODE ###

N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         counter=i
         break   
print(A[counter][0])
class Main:
    s = list(map(int, input().split()))
    n = s[0]
    k = s[1]
    sum = 0
    ksum=0
    list = [int(i) for i in input().split()]
    list = sorted(1, reverse=True)
    list[:k]
    for num in list:
        sum += num
    for knum in list[:k]:
        ksum += knum
    print(sum-ksum)

### FIXED CODE ###

class Main:
    s = list(map(int, input().split()))
    n = s[0]
    k = s[1]
    sum = 0
    kSum = 0
    list = [int(i) for i in input().split()]
    newList = sorted(list, reverse=True)
    list[:k]
    for num in newList:
        sum += num
    for kNum in newList[:k]:
        kSum += kNum
    print(sum-kSum)
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    x = int(n) - 1
    if m == "S":
        s[x] = 1
    elif m == "H":
        h[x] = 1
    elif m == "C":
        c[x] = 1
    elif m == "D":
        d[x] = 1
    else:
        break

for i in range(13):
    if s[i] == 0:
        print("S %d" % i+1)

for i in range(13):
    if h[i] == 0:
        print("H %d" % i+1)

for i in range(13):
    if c[i] == 0:
        print("C %d" % i+1)

for i in range(13):
    if d[i] == 0:
        print("D %d" % i+1)






### FIXED CODE ###

#
# 6b
#

def main():
    n = int(input())
    c = []
    for i in range(n):
        m, r = input().split()
        r = int(r)
        c.append([m, r])
    for M in ["S", "H", "C", "D"]:
        for R in range(1, 14):
            for i in range(n):
                if c[i] == [M, R]:
                    break
            else:
                print(*[M, R])


if __name__ == '__main__':
    main()
a=int(input())
li=[0]*1000001
count=1
i=2 # ??????????????°
while i<a:    
    r=0
    ta=a
    b=i
    if li[i]!=1:
        while True:
                    
            r=ta%b
            if r==0:
                break
            ta=b
            b=r
        if b==1:
            count+=1
        else:
            temp=i
            l=2
            while True:
               li[temp*l]=1
               l+=1
               if temp*l>a:
                   break
    i+=1                
print(count)

### FIXED CODE ###

def soi(n): #?´??????°????§£?????¢?????´?????????
    i=2
    while True:
        if i*i>n:
            return n
        
        if n%i==0:
            return i
        i+=1


a=int(input())
ans=a
count=1
i=2 # ??????????????°
while True:
    temp=soi(a)
    if a==1: #?´??????°??????????????°
        break
    while a%temp==0: #?´??????°??§???????¶???????
        a/=temp
     #   print (a)

    ans*=(1-1/temp)
    #print (ans)

print(int(ans))


                
       

def gcd(a,b): #?????§??¬?´???°???????????°??????
    r=0
    while True:
       r=a%b
       if r==0:
           break
       a=b
       b=r
    return b
n,m = map(int,input().split())
A = [int(i)%m for i in input().split()]  
S = [0]*n
S[0] = A[0]
for i in range(n):
	S[i] = (S[i-1]+A[i])%m
D = dict()
for s in S:
	if s in D:D[s] += 1
	else:D[s] = 1
res = D[0]
for v in D.values():
	res += v*(v-1)//2
print(res)

### FIXED CODE ###

from collections import Counter
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = [0]
for a in A:
    B.append((B[-1]+a)%m)
D = Counter(B)
res = 0
for v in D.values():
    res += v*(v-1)//2
print(res)
N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = -1
flag = True
mid = (left+right)//2
minN = right
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
        if minN>mid:
            minN = mid
            result = mid
    elif count > K:
        left = mid
print(result)


### FIXED CODE ###

N, K = map(int, input().split())
A=list(map(int,input().split()))
A.sort()
right = A[-1]+1
left = 0
flag = True
mid = (left+right)//2
minN = right
result = mid
while right-left>1 and flag:
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count <= K:
        right = mid
        if minN>mid:
            minN = mid
            result = mid
    elif count > K:
        left = mid
print(result)
from math import floor

word = input()
num = int(input())
length=len(word)
charlist_size=num*length

string_generator=(word[i] for i in range(length))

char_before= ''
sum=0
subsum =0
count= 0
stack=[]

for index in range(length):
    char_now=next(string_generator)
    if index == 0 :
        char_before = char_now
        char_first=char_now
        count = 1
        continue
    
    if char_before == char_now :
        count = count + 1
    else:
        char_before = char_now
        stack.append(count)
        count = 1
    
    if index == length-1:
        char_last=char_now
        stack.append(count)
        
for i in stack:
    subsum= subsum + floor(i/2)
    
if (stack[0]%2)==1 and (stack[-1]%2)==1 and char_last==char_first:
    sum =(subsum+1)*num -1
else:
    sum =(subsum)*num

print(sum)

### FIXED CODE ###

from math import floor

word = input()
num = int(input())
length=len(word)

char_before= ''
sum=0
subsum =0
count= 0
stack=[]

for index in range(length):
    char_now=word[index]
    if index == 0 :
        char_before = char_now
        char_first=char_now
        count = 1
        if length==1:
            char_last=char_now
            stack.append(count)
        continue
    
    if char_before == char_now :
        count = count + 1
    else:
        char_before = char_now
        stack.append(count)
        count = 1
    
    if index == length-1:
        char_last=char_now
        stack.append(count)

for i in stack:
    subsum= subsum + floor(i/2)
    
if (stack[0]%2)==1 and (stack[-1]%2)==1 and char_last==char_first and len(stack)>=2:
    sum =(subsum+1)*num -1
elif len(stack)==1:
    sum = floor(length*num/2)
else:
    sum =(subsum)*num

print(sum)
n = input()
a = []
a = [input() for i in range(n)]
i = 0
j = 1
max = a[j] - a[i]

while n > i:
  j = i+1
  while n > j:
    if max < a[j] - a[i]:
      max = a[j] - a[j]
    j += 1
  i += 1

print '{0}',format(max)

### FIXED CODE ###

n = input()
minv = input()
maxv = -1 * 10**9

for j in range(n-1):
  v = input()
  if maxv < v - minv:
    maxv = v - minv
  if minv > v:
    minv = v

print maxv
import heapq

n,m = map(int,input().split())
li = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(li)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))

### FIXED CODE ###

import heapq

n,m = map(int,input().split())
li = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(li)
for _ in range(m):
    tmp_min = heapq.heappop(li)
    heapq.heappush(li, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(li))
N,K=map(int, input().split())
P=list(map(int, input().split()))
C=list(map(int, input().split()))

F=[0]*N
I=[0]*N
CN=[0]*N

for i in range(N):
  around=0
  cnt=0
  A=[]
  if F[i]==0:
    F[i]=1
    around+=1
    cnt+=C[i]
    nex=P[i]-1
    A.append(i)
    while F[nex]==0:
      A.append(nex)
      F[nex]=1
      around+=1
      cnt+=C[nex]
      nex=P[nex]-1
    for j in A:
      I[j]=around
      CN[j]=cnt
#print(F)
#print(I)
#print(CN)
ans=-(10**9)*2
for i in range(N):
  cnt=C[i]
  #動かす回数が一周に満たない時
  if K+1<I[i]:
    d=0
    nex=i
    for j in range(K+1):
      d+=C[nex]
      nex=P[nex]-1
      cnt=max(d,cnt)
  #動かす回数が一周を超えるとき
  elif CN[i]<0:
    d=0
    nex=i
    for j in range(I[i]):
      d+=C[nex]
      nex=P[nex]-1
      cnt=max(d,cnt)
  else:
    d=0
    nex=i
    for j in range(I[i]):
      d+=C[nex]
      nex=P[nex]-1
      cnt=max(d,cnt)
    acnt=cnt
    bcnt=C[i]
    syuukai=(K+1)//I[i]
    nokori=(K+1)%I[i]
    syuukai-=1
    nokori+=I[i]
    b+=syuukai*CN[i]
    d=0
    nex=i
    for j in range(nokori-1):
      d+=C[nex]
      nex=P[nex]-1
      bcnt=max(d,bcnt)
    cnt=max(acnt,bcnt)
  ans=max(ans,cnt)
print(ans)

### FIXED CODE ###

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

F=[0]*N
I=[0]*N
CN=[0]*N

for i in range(N):
  around=0
  cnt=0
  A=[]
  if F[i]==0:
    F[i]=1
    around+=1
    cnt+=C[i]
    nex=P[i]-1
    A.append(i)
    while F[nex]==0:
      A.append(nex)
      F[nex]=1
      around+=1
      cnt+=C[nex]
      nex=P[nex]-1
    for j in A:
      I[j]=around
      CN[j]=cnt
ans=-(10**9)*2
for i in range(N):
  #動かす回数が一周に満たない時
  if K<=I[i]:
    d=C[i]
    cnt=d
    nex=P[i]-1
    for j in range(K-1):
      d+=C[nex]
      nex=P[nex]-1
      cnt=max(d,cnt)
  #動かす回数が一周を超えるとき
  elif CN[i]<=0:
    d=C[i]
    cnt=d
    nex=P[i]-1
    for j in range(I[i]-1):
      d+=C[nex]
      nex=P[nex]-1
      cnt=max(d,cnt)
  else:
    syuukai=K//I[i]
    nokori=K%I[i]
    syuukai-=1
    nokori+=I[i]
    d=C[i]
    cnt=d
    nex=P[i]-1
    for j in range(nokori-1):
      d+=C[nex]
      nex=P[nex]-1
      cnt=max(d,cnt)
    cnt+=syuukai*CN[i]
  ans=max(ans,cnt)
print(ans)
#
# coding: utf-8

def bubbleSort(arr, n):

    flag = True
    swap_num = 0

    while flag:
        flag = False
        for j in xrange(n-1, 0, -1):
            if arr[j] < arr[j-1]:
                arr[j], arr[j-1] = arr[j-1], arr[j]
                swap_num += 1
                flag = True
        pass
    return swap_num


n = int(raw_input())
arr = map(int, raw_input().split())

num = bubbleSort(arr, n)
print " ".join(map(str, test_arr)),"\n",num

### FIXED CODE ###

#
# coding: utf-8
 
def bubbleSort(arr, n):
 
    flag = True
    swap_num = 0
 
    while flag:
        flag = False
        for j in xrange(n-1, 0, -1):
            if arr[j] < arr[j-1]:
                arr[j], arr[j-1] = arr[j-1], arr[j]
                swap_num += 1
                flag = True
        pass
    return swap_num
 
 
n = int(raw_input())
arr = map(int, raw_input().split())
 
num = bubbleSort(arr, n)
print " ".join(map(str, arr))
print num
def check(n):
    num=int(n**0.5)
    l=[]
    for i in range(1,num+1):
        if n%i==0:
            l.append(i)
            l.append(n//i)
    return l

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

box=[0]*n
cnt=0
ans=[0]*n
for i in range(n):
    if a[-(i+1)]==box[i]:continue
    cnt+=1
    ans[-(i+1)]=1
    box[i]=(box[i]+1)%2
    l=check(n-i)
    for j in l:
        box[j]=(box[j]+1)%2

print(cnt)
if cnt==0:exit()
for i in range(n):
    if ans[i]:
        print(i+1,end='')

### FIXED CODE ###

def check(n):
    num=int(n**0.5)
    l=[]
    for i in range(1,num+1):
        if n%i==0:
            l.append(i)
            l.append(n//i)
    return set(l)

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

box=[0]*n
cnt=0
ans=[0]*n
for i in range(n):
    if a[-(i+1)]==box[-(i+1)]:continue
    cnt+=1
    ans[-(i+1)]=1
    l=check(n-i)
    for j in l:
        box[j-1]=(box[j-1]+1)%2

print(cnt)
if cnt==0:exit()
for i in range(n):
    if ans[i]:
        print(i+1,end=' ')
a,b,c=map(int,input().split())
for i in range(0:B):
  if (i*a)%b==c:
    print('YES')
    break
print('NO')

### FIXED CODE ###

a,b,c=map(int,input().split())
ans='NO'
for i in range(1,b+1):
  if (i*a)%b==c:
    ans='YES'
    break
print(ans)
from itertools import permutations
A_list = []
for i in range(5):
    A = int(input())
    A_list.append(A)
nes = [0,1,2,3,4]
iterator = []
print(A_list)
for i in permutations(nes):
    iterator.append(i)
for i in iterator:
    temp = 0
    for j in i:
        if temp%10 != 0:
            temp += (10-temp%10)
        temp += A_list[j]
    if temp < min1:
        min1 = temp
print(temp)

### FIXED CODE ###

from itertools import permutations
A_list = []
for i in range(5):
    A = int(input())
    A_list.append(A)
nes = [0,1,2,3,4]
iterator = []
for i in permutations(nes):
    iterator.append(i)
min1 = 10**9
for i in iterator:
    temp = 0
    for j in i:
        if temp%10 != 0:
            temp += (10-temp%10)
        temp += A_list[j]
    if temp < min1:
        min1 = temp
print(min1)
from collections import deque

H,W=map(int,input().split())
A=[input() for i in range(H)]
ans=0
V=[[float('inf') for i in range(W)] for j in range(H)]

def bfs(sx,sy):
    tmp=deque([[sx,sy]])
    ch=[[False for i in range(W)] for j in range(H)]
    P=[[0 for i in range(W)] for j in range(H)]
    d=[[-1,0],[1,0],[0,-1],[0,1]]
    while tmp:
        x,y=tmp.popleft()
        for a,b in d:
            nx=x+a
            ny=y+b
            if 0<=nx<W and 0<=ny<H:
                if ch[nx][ny]!=True and A[nx][ny]==".":
                    P[nx][ny]=P[x][y]+1
                    ch[nx][ny]=True
                    tmp.append([nx,ny])
    for i in range(W):
        for j in range(H):
            V[i][j]=min(P[i][j],V[i][j])

for i in range(W):
    for j in range(H):
        if A[i][j]=="#":
            bfs(i,j)

for i in range(W):
    for j in range(H):
        if not A[i][j]=="#":
             ans=max(ans,V[i][j])

print(ans)



### FIXED CODE ###

from collections import deque

H,W=map(int,input().split())
A=[input() for i in range(H)]
ans=0
V=[[0 for i in range(W)] for j in range(H)]

def bfs(q):
    tmp=deque(q)
    ch = [[False for i in range(W)] for j in range(H)]
    count = 0
    d=[[-1,0],[1,0],[0,-1],[0,1]]
    while tmp:
        x,y=tmp.popleft()
        for a,b in d:
            nx=x+a
            ny=y+b
            if 0<=nx<H and 0<=ny<W:
                if ch[nx][ny]!=True and A[nx][ny]==".":
                    V[nx][ny]=V[x][y]+1
                    ch[nx][ny]=True
                    tmp.append([nx,ny])
            else:
                continue
ju=[]
for i in range(H):
    for j in range(W):
        if A[i][j]=="#":
            ju.append([i,j])
bfs(ju)
for i in range(H):
    for j in range(W):
        if not A[i][j]=="#":
             ans=max(ans,V[i][j])
print(ans)
def find_par(x,p):
    if x == p[x] :
        return x

    p[x] = find_par(p[x],p)
    return p[x]


def union(x,y,p,size):
    xp = find_par(x,p)
    yp= find_par(y,p)

    if xp != yp:
        p[yp] = xp
        size[xp] += size[yp]
    
    
n,m=[int(c) for c in input().split()]
p=[i for i in range(n+1)]
size =[1 for i in range(n+1)]
for i in range(m):
    a,b =[int(c) for c in input().split()]
    union(a,b,p,size)

roots= set()

for i in range(1,n+1):
    par = find_par(i,p)
    roots.add(par)

ans = float("-inf")
for pp in roots:
    ans = max(ans,size[pp])

print(ans)

### FIXED CODE ###

def find_par(x,p):
    
    try :
        if x == p[x] :
            return x

        p[x] = find_par(p[x],p)
        return p[x]
    except:
        return x


def union(x,y,p,size):
    try:
        xp = find_par(x,p)
        yp= find_par(y,p)

        if xp != yp:
            p[yp] = xp
            size[xp] += size[yp]
    except:
        pass
    
n,m=[int(c) for c in input().split()]
p=[i for i in range(n+1)]
size =[1 for i in range(n+1)]
for i in range(m):
    a,b =[int(c) for c in input().split()]
    union(a,b,p,size)

roots= set()

for i in range(1,n+1):
    par = find_par(i,p)
    roots.add(par)

ans = float("-inf")
for pp in roots:
    try:
        ans = max(ans,size[pp])
    except:
        pass

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

### FIXED CODE ###

a,b,k=map(int,input().split())
count=0
for i in range(a+1,0,-1):
    if a%i==0 and b%i==0:
        count+=1
        if count==k:
            print(i)
n, a, b, c, d = map(int, input().split())
s = list(input())
for i in range(b, d - 1):
    if s[i] == '#' and s[i + 1] == '#':
        print('No')
        exit(0)
for i in range(a, c - 1):
    if s[i] == '#' and s[i + 1] == '#':
        print('No')
        exit(0)
if c < d:
    print('Yes')
else:
    l, r = a - 1, a
    while l >= 0 and (s[l] != '#' or s[l + 1] != '#'):
        l -= 1
    l += 2 - int(l == -1)
    while r < n and (s[r - 1] != '#' or s[r] != '#'):
        r += 1
    r -= 2 - int(r == n)
    for i in range(l, r - 1):
        if s[i] == '.' and s[i + 1] == '.' and s[i + 2] == '.':
            exit(1)
            break
    else:
        print('No')


### FIXED CODE ###

n, a, b, c, d = map(int, input().split())
s = input()
if '##' in s[a-1:c] or '##' in s[b-1:d]:
    print('No')
elif c < d:
    print('Yes')
else:
    if '...' in s[b-2:d+1]:
        print('Yes')
    else:
        print('No')
import math
print(math.floor((math.sqrt(i+8*int(input()))-1)/2))

### FIXED CODE ###

import math
N = int(input())
M = (math.ceil((math.sqrt(1+8*N)-1)/2))
for m in range(0,M):
  if M-m <= N:
    print(M-m)
    N -= M-m
  else:
    if N!=0:
      print(N)
    break
N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if max(arr) == 1:
    print(len(arr))
    exit()
for i in range(N):
    arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
    tmp = tmp - arr2[i-3] + arr2[i]
    if ans < tmp:
        ans = tmp
print(ans)

### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if max(arr) < 4:
    print(len(arr))
    exit()
for i in range(N):
    arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
    tmp = tmp - arr2[i-3] + arr2[i]
    if ans < tmp:
        ans = tmp
print(ans)
n,x,t=map(int,input().split())
y=ceil(n/x)
print(y*t)


### FIXED CODE ###

from math import ceil
n,x,t=map(int,input().split())
y=ceil(n/x)
print(y*t)
n,a,b=(int(i) for i in input().split(' '))
print(nin(a*n,b))

### FIXED CODE ###

n,a,b=(int(i) for i in input().split(' '))
print(min(a*n,b))
n,x=map(int,input().split())
a=list(map(int,input().split()))
sort(a)
for i in range(n):
  x-=a[i]
  if(x<0):
    break
if(x!=0):
  print(i)
else:
  print(n)

### FIXED CODE ###

n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
for i in range(n):
  x-=a[i]
  if(x<0):
    break
if(x!=0):
  print(i)
else:
  print(n)
n , k = map(int, input().split())
a = list(map(int, input().split()))
neg = []
pos = []
mod = 10**9+7
for i in range(n):
    if a[i] >= 0:
        pos.append(a[i])
    else:
        neg.append(a[i])
neg.sort()
pos.sort(reverse = True)
min_num = -1
good_num = -1
if k % 2 == 1 and len(pos) == 0 and n == k:
    ans = 1
    neg.sort(reverse = True)
    for i in range(k):
        ans *= neg[i]
        ans %= mod
    print(ans % mod)
else:
    #最大化するとき
    for i in range(0,k+1,2):
        #i個だけnegから取る。
        if i > len(neg) or k - i > len(pos):
            continue
        m = 0
        if i - 1 >= 0:
            m = abs(neg[i-1])
        if k-i-1 >= 0:
            m = min(m, pos[k-i-1])
        if m > min_num:
            min_num = m
            good_num = i
    ans = 1
    for i in range(good_num):
        ans *= neg[i]
        ans %= mod
    for i in range(k - good_num):
        ans *= pos[i]
        ans %= mod
    print(ans % mod)

### FIXED CODE ###

n , k = map(int, input().split())
a = list(map(int, input().split()))
neg = []
pos = []
mod = 10**9+7
for i in range(n):
    if a[i] >= 0:
        pos.append(a[i])
    else:
        neg.append(a[i])
neg.sort()
pos.sort(reverse = True)
if (len(pos) == 0 and k % 2 == 1) or n == k:
    ans = 1
    a.sort(reverse = True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans % mod)
else:
    #最大化するとき
    from collections import deque
    ans = 1
    neg_new = []
    for i in range(0, len(neg)//2):
        neg_new.append(neg[2*i] * neg[2*i+1])
    neg_new = deque(sorted(neg_new, reverse = True))
    pos = deque(pos)
    if k % 2 == 1:
        k -= 1
        ans = pos.popleft()
    else:
        ans = 1
    while k > 0:
        if len(pos) >= 2 and len(neg_new) >= 1:
            if pos[0] * pos[1] > neg_new[0]:
                ans *= pos.popleft() * pos.popleft()
            else:
                ans *= neg_new.popleft()
        elif len(pos) >= 2:
            ans *= pos.popleft() * pos.popleft()
        else:
            ans *= neg_new.popleft()
        k -= 2
        ans %= mod
    print(ans % mod)
a = int(input())

if a < 1200:
    print("ABC")
elif a < 2800:
    print("ARC")
else
    print("AGC")

### FIXED CODE ###

a = int(input())

if a < 1200:
    print("ABC")
elif a < 2800:
    print("ARC")
else:
    print("AGC")
a = input()
s = input()

if a < 3200:
  print(s)
else:
  print("red")

### FIXED CODE ###

a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print("red")
s

### FIXED CODE ###

s = input()
t = input()
if s==t[:-1]:
    print('Yes')
else:
    print("No")
n = int(input())
ans = [0 for i in range(10)]
for i in range(10):
    if n < 26**(9-i):
        if i == 9:
            ans[i] = n
        continue
    else:
        s = n // 26**(9-i)
        n = n % 26**(9-i)
        ans[i] = s
al = "abcdefghijklmnopqrstuvwxyz"
answer = ""
for i in ans:
    if i == 0:
        continue
    answer += al[i-1]
print(answer)

### FIXED CODE ###

N = int(input())
ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
        break
    else:
        N -= 26 ** i
print(ans[::-1])