Harryxun/stf_run huggingface dataset:
s=str(input())
t=str(input())
temps=list(set(s))
tempt=list(set(t))
temps=sorted(temps)
tempt=sorted(tempt)
for i in range(0,len(temps)):
  temps1[i]=s.count(temps[i])
for i in range(0,len(tempt)):
  tempt1[i]=t.count(tempt[i])
if temps1==tempt1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s=str(input())
t=str(input())
temp=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s=list(s)
t=list(t)
temps=[0]*len(temp)
tempt=[0]*len(temp)
for i in range(0,len(temp)):
  temps[i]=s.count(temp[i])
  tempt[i]=t.count(temp[i])
temps.sort()
tempt.sort()
if temps==tempt:
  print("Yes")
else:
  print("No")
while True:
    n=input()
    if n==0:break
    m=0
    dic={}
    for i in range(n):
       p,d1,d2=map(int,raw_input().split())
       t=d1+d2
       m=max(m,t)
       dic[t]=p
    print dic[m],m

### FIXED CODE ###

while True:
    try:
        n=input()
        if n==0:break
        m=0
        dic={}
        for i in range(n):
            p,d1,d2=map(int,raw_input().split())
            t=d1+d2
            m=max(m,t)
            dic[t]=p
        print dic[m],m
    except SyntaxError:
        pass
from collections import deque
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]

for i in range(M):
    x, y = map(int, input().split())
    G[x].append(y)
    G[y].append(x)

USED = [-1] * (N+1)
USED[0] = 0
USED[1] = 0

Q = deque()
Q.append(1)

while Q:
    x = Q.pop()
    for t in G[x]:
        if USED[t] == -1:
            Q.appendleft(t)
            USED[t] = x

if -1 in USED:
    print("No")
else:
    print("Yes")
    print(*USE[2:])


### FIXED CODE ###

from collections import deque
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]

for i in range(M):
    x, y = map(int, input().split())
    G[x].append(y)
    G[y].append(x)

USED = [-1] * (N+1)
USED[0] = 0
USED[1] = 0

Q = deque()
Q.append(1)

while Q:
    x = Q.pop()
    for t in G[x]:
        if USED[t] == -1:
            Q.appendleft(t)
            USED[t] = x

if -1 in USED:
    print("No")
else:
    print("Yes")
    for _ in USED[2::]:
        print(_)
n = list(map(int, input().split()))

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

a = {}
for i in list:
    for j in i[1:]:
        if j in a:
            a[j] = a[j] + 1
        else:
            a[j] = 1

cnt = 0
for x in a.values():
    if x == n[0]:
        print(f'ok:{x}')
        cnt += 1

print(cnt)

### FIXED CODE ###

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

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

a = {}
for i in list:
    for j in i[1:]:
        if j in a:
            a[j] = a[j] + 1
        else:
            a[j] = 1

cnt = 0
for x in a.values():
    if x == n[0]:
        cnt += 1

print(cnt)
n=int(input())
A=list(map(int,input().split()))
x=0
lst=[]
for i in range(n):
    x+=A[i]
    lst.append(x)
ans=0

    
def conv(n,m):
    if n==m or m==0:
        return 1
    else:
        return conv(n-1,m-1)+conv(n-1,m)
used=[]
for num in lst:
    if num in used:
        continue
    x=lst.count(num)
    used.append(num)
    if x==1 and num!=0:
        continue
    if num==0:
        if x!=1:
            ans+=x+conv(x,2)
        else: 
            ans+=1
    else:
        ans+=conv(x,2)
    
    

print(ans)

### FIXED CODE ###

import collections
n=int(input())
A=list(map(int,input().split()))
x=0
lst=[]
for i in range(n):
    x+=A[i]
    lst.append(x)
c=collections.Counter(lst)

 
def conv(n,m):
    if n==m or m==0:
        return 1
    else:
        return conv(n-1,m-1)+conv(n-1,m)
ans=0
for k in c.keys():
    if c[k]==1:
        if k==0:
            ans+=1
        else:
            continue
    elif k==0:
        ans+=c[k]+int(c[k]*(c[k]-1)/2)
    else:
        ans+=int(c[k]*(c[k]-1)/2)
print(ans)
N, M = map(int, input().split())
for _ in range(M):
    a, b = map(int, input().split())
for i in range(1,N+1):
    print(a.count("i")+b.count("i"))

### FIXED CODE ###

n, m = map(int, input().split())
a, b = [0]*m, [0]*m
for i in range(m):
    a[i], b[i] = map(int, input().split())
for j in range(1,n+1):
    print(a.count(j)+b.count(j))
date1,date2 = list(map(int, input().split()))
a = min(date1)
b = max(date1)
c = sum(date1)
print(a b c)



### FIXED CODE ###

n = input()
lst = list(map(int, input().split()))
print(min(lst), max(lst), sum(lst))
N = int(input())
R = int(input())
if N >= 10:
    print(R)
else:
    print(100*(10-N) + R)

### FIXED CODE ###

N, R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(100*(10-N) + R)
s = input().split(' ')[1]
print(f'A{s[0].upper()}C')

### FIXED CODE ###

s = input().split(' ')[1]
print('A{}C'.format(s[0].upper()))
aa=int(input())
N=[0 for i in range(aa)]
for i in range(aa):
  bb=input()
  #print(b)
  N[i]=bb.split()


def so(p,q):
  for i in range(min(p,q),0,-1):
    if p%i==0 and q%i==0:
      return i


#print(so(11,5))

def aaa(n):

  a=int(N[n][0])
  b=int(N[n][1])
  c=int(N[n][2])
  d=int(N[n][3])

  e=a-a//b*b
  f=d-d//b*b
  

  s=so(e,f)


  if a<b or d<b :
    return "No"
  
  elif b<=c :
    return "Yes"
  else:
  
    if f!=0 :
      ss=b//s*s

      if ss>c:
        return "No"
          
    

        #print(e)
        #print(f)
  #print("while")
    else:
      if e>c :
        return "No"

  return "Yes"

for i in range(aa):
  print(aaa(i))


### FIXED CODE ###

import sys
input = sys.stdin.readline

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

from fractions import gcd

for i in range(n):
    a = C[i][0]
    b = C[i][1]
    c = C[i][2]
    d = C[i][3]
    ng = 0

    e = 0  # 最初に補充が発生する直前の本数
    e0 = a - b
    e1 = ((c - a%b) // b) * b + a%b
    e = min(e0, e1)

    if e < 0 or b > d:
        ng = 1
    else:
        g = gcd(b, d)
        # print(c+1, b-1, g)
        if c+1 <= b-1 and (c - e) // g < (b-1 - e) // g:
            ng = 1

    if ng == 1:
        print("No")
    else:
        print("Yes")
K,X=map(int,input().split)

if 500*K >= X:
  print('yes')
else:
  print('no')

### FIXED CODE ###

K,X=map(int,input().split())

if 500*K >= X:
  print('Yes')
else:
  print('No')
N = int(input())
print('Yes' if N%1000%111 == 0 or N%1110 < 10)


### FIXED CODE ###

N = int(input())
print('Yes' if N%1000%111 == 0 or N%1110 < 10 else 'No')
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect
import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8


def run():
    n, *A = map(int, read().split())
    v = 0
    acum = []
    for a in A:
        v += a
        acum.append(v)
    # greedy
    cums = 0
    count = 0
    V = A[0] // abs(A[0])

    for a in acum[1:]:
        #print(a, '---------')
        V *= -1
        if (a + cums) * V > 0:
            continue
        else:
            update = abs(a + cums) + 1
            cums += (update) * V
            count += update
            #print(V, cums, count)
    print(count)



if __name__ == "__main__":
    run()


### FIXED CODE ###

# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect
import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8


def run():
    n, *A = map(int, read().split())
    v = 0
    acum = []
    for a in A:
        v += a
        acum.append(v)

    # greedy
    ans = INF
    for V in (-1, 1):
        cums = 0
        count = 0
        for a in acum:
            #print(a, '---------')
            V *= -1
            if (a + cums) * V > 0:
                continue
            else:
                update = abs(a + cums) + 1
                cums += (update) * V
                count += update
                #print(V, cums, count)
        ans = min(ans, count)
    print(ans)



if __name__ == "__main__":
    run()
import sys
input = sys.stdin.readline
s = input().rstrip("\n")
t = input().rstrip("\n")
flg = False
#cnt = 0

if len(s)-len(t)+1<0:
	print("UNRESTOABLE")
    sys.exit(0)
 
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        #print(s[i+j],t[j])
        if s[i+j] == t[j] or s[i+j] == '?':
            cnt+=1
        #print(cnt,len(t))
    if cnt == len(t):
        cnt=i
        flg = True
        #print(cnt)
        break
 
if not flg:
    print("UNRESTORABLE")
else:
    li = list(s.replace("?","a"))
    #print(li)
    for j in range(len(t)):
        #print(li[cnt+j], t[j])
        li[cnt+j] = t[j]
    print("".join(li))


### FIXED CODE ###

import sys
input = sys.stdin.readline
s = input().rstrip("\n")
t = input().rstrip("\n")
flg = False

for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        #print(s[i+j],t[j])
        if s[i+j] == t[j] or s[i+j] == '?':
            cnt+=1
        #print(cnt,len(t))
    if cnt == len(t):
        temp=i
        flg = True
        #print(cnt)
 
if not flg:
    print("UNRESTORABLE")
else:
    li = list(s.replace("?","a"))
    #print(li)
    for j in range(len(t)):
        #print(li[cnt+j], t[j])
        li[temp+j] = t[j]
    print("".join(li))
n = input()

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

q = input()

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

cnt = 0
for i in range(n):
    for j in range(q):
        if S[i] == T[j]:
            cnt = cnt + 1
            break

print cnt

### FIXED CODE ###

n = input()

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

q = input()

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

S.append(0)
cnt = 0
for i in range(q):
    j = 0
    S[n] = T[i]
    while S[j] != S[n]:
        j = j + 1
    if j != n:
        cnt = cnt + 1


print cnt
R = int(input())

if R<1200:
    print("ABC")
if R<2800 and R>1200:
    print("ARC")
if R>2800:
    print("AGC"

### FIXED CODE ###

R = int(input())

if R<1200:
    print("ABC")
elif R<2800:
    print("ARC")
else :
    print("AGC")
from itertools import zip_longest
def get_X(ls):
    X = list()
    for xs in zip_longest(*ls):
        xs = [i for i in xs if i is not None]
        _sum = sum(xs)
        _len = len(xs)
        if _len - _sum > _sum:
            X.append(1)
        else:
            X.append(0)
    return X

def get_2_order(d, max_len=None):
    ls = str(bin(d))[2:]
    if max_len is not None and max_len > len(ls):
        ls = (max_len - len(ls)) * "0" + ls
    return ls

def get_max(X,ls):
    _sum = 0
    for i, xs in enumerate(zip_longest(*ls)):
        xs = [i for i in xs if i is not None]
        _sum += 2**i*sum([1 if x != X[i] else 0 for j,x in enumerate(xs)])
    return _sum


N, K = map(int, input().split())
A_ls = [int(i) for i in input().split()]
if len(A_ls) == 1:
    print(A_ls[0])
else:
    _max = 0
    len_K = len(bin(K))-2
    A_ls = [get_2_order(d, len_K)[::-1] for d in A_ls]
    for i in range(K):
        X = get_2_order(i, len_K)[::-1]
        result = get_max(X, A_ls)
        if _max < result:
            _max = result
    print(_max)

### FIXED CODE ###

import sys
from collections import Counter
INF = 10**18
N, K = [int(i) for i in sys.stdin.readline().split()]
len_k = len(bin(K)[2:])
A_ls = [bin(int(i))[2:] for i in sys.stdin.readline().split()]
max_len = max([len(i) for i in A_ls] + [len_k])
K = bin(K)[2:].zfill(max_len)
A_ls = [A.zfill(max_len) for A in A_ls]
# i番目の解
memo_ls = [0 for i in range(max_len)]
# i番目のみの最適解を考えた時の和
memo_ls2 = [0 for i in range(max_len)]
for i in range(max_len):
    ct = Counter([A[-1-i] for A in A_ls])
    # i番目のけたとして0を選んだ時の和
    ans_0 = 2**i*ct["1"]
    ans_1 = 2**i*ct["0"]
    ct.clear()
    memo_ls[-1-i] = (ans_0, ans_1)
    memo_ls2[-1-i] = max(ans_0, ans_1)
# i-1番目までの解の最大
# memo_ls3[i][j] j : 答えが決まっている時1, いない時0
memo_ls3 = [[0 for i in range(2)] for i in range(max_len + 1)]
memo_ls3[0][1] = -INF
for i, j in enumerate(K, 1):
    if j == "0":
        memo_ls3[i][0] = memo_ls3[i-1][0] + memo_ls[i-1][0]
        memo_ls3[i][1] = memo_ls3[i-1][1] + memo_ls2[i-1]
    else:
        memo_ls3[i][0] = memo_ls3[i-1][0] + memo_ls[i-1][1]
        memo_ls3[i][1] = max(memo_ls3[i-1][1] + memo_ls2[i-1], memo_ls3[i-1][0] + memo_ls[i-1][0])
res = max(memo_ls3[-1])
print(int(res))
def input_n(infile,outfile):
	while True:
		n = int(infile.readline())
		if n == 0:
			break
		dice(infile,outfile,n)

def dice(infile,outfile,n):
	point = 1
	spot = 1
	east = 3
	south = 2
	for i in range(n):
		buff = spot
		command = infile.readline()
		if command == "North":
			point += south
			spot = south
			south = (7 - buff)
		elif command == "South":
			point += (7 - south)
			spot = (7 - south)
			south = buff
		elif command == "East":
			point += (7 - east)
			spot = (7 - east)
			east = buff
		elif command == "West":
			point += east
			spot = east
			east = (7 - buff)
		elif command == "Right":
			remember = south
			south = east
			east = (7 - remember)
		elif command == "Left":
			remember = east
			east = south
			south = (7 - remember)
		else:
			break
	print >> outfile,point

if __name__ == "__main__"
import sys
input_n(sys.stdin, sys.stdout)

### FIXED CODE ###

def input_n(infile,outfile):
	while True:
		n = int(infile.readline())
		if n == 0:
			break
		dice(infile,outfile,n)

def dice(infile,outfile,n):
	point = 1
	top = 1
	east = 3
	south = 2
	for i in range(n):
		buff = top
		command = infile.readline().split()[0]
		if command == "North":
			point += south
			top = south
			south = (7 - buff)
		elif command == "South":
			point += (7 - south)
			top = (7 - south)
			south = buff
		elif command == "East":
			point += (7 - east)
			top = (7 - east)
			east = buff
		elif command == "West":
			point += east
			top = east
			east = (7 - buff)
		elif command == "Right":
			point += top
			remember = south
			south = east
			east = (7 - remember)
		elif command == "Left":
			point += top
			remember = east
			east = south
			south = (7 - remember)
		else:
			break
	print >> outfile,point

if __name__ == "__main__":
	import sys
	input_n(sys.stdin, sys.stdout)
a=list(input())
b=list(input())
c=list(input())
read=a[0]
a.pop(0)

while(1):
    if read=='a':
        if len(a)==0:
            break
        read=a[0]
        f='A'
        a.pop(0)
        
    elif read=='b':
        if len(b)==0:
            break
        read=b[0]
        f='B'
        b.pop(0)
        
    elif read=='c':
        if len(c)==0:
            break
        read=c[0]
        f='C'
        c.pop(0)
        
print(f)

### FIXED CODE ###

a=list(input())
b=list(input())
c=list(input())
read=a[0]

while(1):
    if read=='a':
        try:
            read=a.pop(0)
        except:
            f='A'
            break
    if read=='b':
        try:
            read=b.pop(0)
        except:
            f='B'
            break
    if read=='c':
        try:
            read=c.pop(0)
        except:
            f='C'
            break
print(f)
import math


def inp():
    return(int(input()))


def invr():
    return(map(int, input().split()))


n = inp()
arr = invr()
arr = sorted(arr)
max = arr[n-1]
min = arr[0]

cost = math.inf
for p in range(min, max+1):
    temp_cost = 0
    for xi in arr:
        temp_cost += (xi-p)**2
    if temp_cost < cost:
        cost = temp_cost
print(cost)


### FIXED CODE ###

import math


def inp():
    return(int(input()))


def invr():
    return(map(int, input().split()))


n = inp()
arr = invr()
arr = sorted(arr)
max = arr[n-1]
min = arr[0]

cost = 100000000000
for p in range(min, max+1):
    temp_cost = 0
    for xi in arr:
        temp_cost += (xi-p)**2
    if temp_cost < cost:
        cost = temp_cost
print(cost)
# -*- coding: utf-8 -*-
N,K=map(int,input().split())
import math
for i in range(1,K+1):
    ans1=(math.factorial(K-1)//math.factorial(i-1)//math.factorial(K-i))%1000000007
    ans2=(math.factorial(N-K-i+1+i)//math.factorial(N-K-i+1)//math.factorial(i))%1000000007
    ans=(ans1*ans2)%1000000007
    print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N,K=map(int,input().split())
import math
for i in range(1,K+1):
    ans1=(math.factorial(K-1)//math.factorial(i-1)//math.factorial(K-i))%1000000007
    if N-K-i+1<0:
        print(0)
        continue
    ans2=(math.factorial(N-K+1)//math.factorial(N-K-i+1)//math.factorial(i))%1000000007
    ans=(ans1*ans2)%1000000007
    print(ans)
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,p=map(int,input().split())

print((a*3+b)//2)

### FIXED CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b=map(int,input().split())

print((a*3+b)//2)
import collections

N = int(input())
A = list(map(int,input().split())), reverse = True
B = collections.Couter(A)
C = []
for a,c in B.items():
    C += [a] * c//2
C.sort()

if len(C) >= 2:
    print(C[-1]*C[-2])
else:
    print(0)


### FIXED CODE ###

import collections

N = int(input())
A = list(map(int,input().split()))
B = collections.Counter(A)
C = []
for a,c in B.items():
    C += [a] * (c//2)
C.sort()

if len(C) >= 2:
    print(C[-1]*C[-2])
else:
    print(0)
a = list(map(int, input()))
a.sort()
maped_list = map(str, a)
mojiretsu = ','.join( a )    
print(mojiretsu)



### FIXED CODE ###

a, b, c = map(int, input().split())
if a < b < c:
    print("Yes")
else:
    print("No")
N,K=map(int,input().split())
a=list(map(int,input().split()))
cum=[0]*(N+1)
for i in range(N):
    cum[i+1]=cum[i]+a[i]
beau=[]
for i in range(N+1):
    for j in range(i):
        beau.append(cum[i]-cum[j])
beau.sort()
bit=[0]*30
for x in beau:
    j=0
    while((x>>j)>0):
        bit[j]+=x>>j&1
        j+=1
ans=0
for i in range(len(beau)-K+1):
    res=1023
    for j in range(i,i+K):
        res&=beau[j]
    ans=max(ans,res)
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
a=list(map(int,input().split()))
cum=[0]*(N+1)
for i in range(N):
    cum[i+1]=cum[i]+a[i]
A=[]
for i in range(N+1):
    for j in range(i):
        A.append(cum[i]-cum[j])
L=len(A)
ans=0
for j in reversed(range(46)):
    li=[]
    for i in range(L):
        if A[i]>>j&1:
            li.append(A[i])
    if len(li)<K:
        continue
    ans+=1<<j
    A=li
    L=len(A)
print(ans)
# coding: utf-8
# Your code here!

H, W = map(int, input().rstrip().split(' '))

field = []
for _ in range(H):
    temp_field = []
    for s in input():
        temp_field.append(0 if s == '.' else 1)
    field.append(temp_field)
    
dp = [[0] * (W + 1) for _ in range(H+1)]
dp[0][1] = 1

for h in range(1, H+1):
    for w in range(1, W+1):
        if field[h-1][w-1] == 0:
            dp[h][w] = dp[h-1][w] + dp[h][w-1]
            
print(int(dp[-1][-1] % (1e9 + 7)))

### FIXED CODE ###

# coding: utf-8
# Your code here!

H, W = map(int, input().rstrip().split(' '))

field = []
for _ in range(H):
    temp_field = []
    for s in input():
        temp_field.append(0 if s == '.' else 1)
    field.append(temp_field)
    
dp = [[0] * (W + 1) for _ in range(H+1)]
dp[0][1] = 1

for h in range(1, H+1):
    for w in range(1, W+1):
        if field[h-1][w-1] == 0:
            dp[h][w] = dp[h-1][w] + dp[h][w-1]
            
print(dp[-1][-1] % (1000000007))
a, b, c, d = map(int(), input().split())
if a+b > c+d:
    print("left")
elif a+b < c+d:
    print("right")
else:
   print("balanced")

### FIXED CODE ###

a, b, c, d = map(int, input().split())
if a+b > c+d:
    print("Left")
elif a+b < c+d:
    print("Right")
else:
   print("Balanced")
N = int(input())
W = list(map(int,input().split()))
weight= sum(W)
cnt = 0
for i in range(N):
    weight -= W[i]
  cnt += W[i]
  if weight <= cnt:
    print(cnt-weight)
    exit()


### FIXED CODE ###

N = int(input())
W = list(map(int,input().split()))
weight= sum(W)
cnt = 0
for i in range(N):
  if weight <= cnt:
    print(min(cnt-weight,abs((cnt-W[i-1])-(weight+W[i-1]))))
    exit()
  weight -= W[i]
  cnt += W[i]
n,m = map(int, input().split())
s = input()
num = '0123456789'
flg = 0
for i in range(len(s)):
  if i < n-1:
    if s[i] not in num:
      flg = 1
  elif i == a:
    if s[i] != '-':
      flg = 1
  else:
    if s[i] not in num:
      flg = 1
if flg == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n,m = map(int, input().split())
s = input()
num = '0123456789'
flg = 0
for i in range(len(s)):
  if i < n-1:
    if s[i] not in num:
      flg = 1
  elif i == n:
    if s[i] != '-':
      flg = 1
  else:
    if s[i] not in num:
      flg = 1
if flg == 0:
  print('Yes')
else:
  print('No')
import sys
input = sys.stdin.readline
mod = int(1e9+7)
n,k = map(int,input().split())
L=list(map(int,input().split()))

ans = 1
"""
if k==n:
    for i in L
        ans*=i
        ans%=mod
    print(ans%mod)
    sys.exit()
"""
pos = []
neg = []
for i in L:
    if i>=0:
        pos.append(i)
    else:
        neg.append(i)
pos.sort(reverse=True)
neg.sort()
if len(pos) == 0 and k%2:
    for i in range(1,k+1):
        ans*=neg[-i]
        ans%=mod
    print(ans%mod)
    sys.exit()
if k%2:
    ans*=pos.pop(0)
    k-=1
l=[]
for i in range(1,len(pos),2):
    l.append(pos[i]*pos[i-1])

for i in range(1,len(neg),2):
    l.append(neg[i]*neg[i-1])
l.sort(reverse = True)

for i in range(k//2):
    ans*=l[i]
    ans%=mod

print(ans%mod)


### FIXED CODE ###

import sys
input = sys.stdin.readline
mod  = int(1e9+7)

n,k = map(int,input().split())
L = list(map(int,input().split()))
ans = 1 
if k==n:
    for i in L:
        ans*=i
        ans%=mod
    print(ans%mod)
    sys.exit()

pos = []
neg = []
for i in L:
    if i>=0:
        pos.append(i)
    else:
        neg.append(i)

pos.sort(reverse=True)
neg.sort()

if len(pos) == 0 and k%2!=0:
    for i in range(1,k+1):
        ans *= neg[-i]
        ans %= mod
    print(ans%mod)
    sys.exit()

if k%2!=0:
    ans*=pos.pop(0)
    k-=1

l=[]
for i in range(1,len(pos),2):
    l.append(pos[i]*pos[i-1])
    
for i in range(1,len(neg),2):
    l.append(neg[i]*neg[i-1])

l.sort(reverse = True)
for i in range(k//2):
    ans *= l[i]
    ans %= mod
print(ans%mod)
finished = [False] * 10**5
isPN = [False] * 10**5
def isPrimeNumber(num):
  if finished[num]:
    return isPN[num]
  
  if num == 1:
    return False
  pn = 2
  while pn * pn <= num:
    if num % pn == 0:
      finished[num] = True
      isPN[num] = False
      return isPN[num]
    pn += 1
  
  
  finished[num] = True
  isPN[num] = True
  return isPN[num]

n = int(input())

l = [0] * n
r = [0] * n
for i in range(n):
  l[i], r[i] = map(int, input().split())
  
  
for i in range(n):
  ans = 0
  for j in range(l[i], r[i]+1, 2):
    if isPrimeNumber(j) and isPrimeNumber((j+1)/2):
      ans += 1
      
  print(ans)

### FIXED CODE ###

max_num = 10**5+5
eratos_thenes_sieve = [0,0] + [1]*max_num
n = 2 #素数
while n*n <= max_num:
  if eratos_thenes_sieve[n]:#
    for i in range(2*n, max_num, n):
      eratos_thenes_sieve[i] = 0
  n += 1
  
isLike2017 = [0] * max_num
cumulativeSums = [0]
for i in range(max_num):
  if eratos_thenes_sieve[i] and eratos_thenes_sieve[(i+1)//2]:
    isLike2017[i] = 1
  cumulativeSums.append(cumulativeSums[-1] + isLike2017[i])
  
  
q = int(input())

for i in range(q):
  l, r = map(int, input().split())
  print(cumulativeSums[r+1] - cumulativeSums[l])
# coding: utf-8
# Your code here!
import statistics
from scipy.stats.mstats import gmean

N=int(input())
X=list(map(int,input().split()))
X.sort()
import sympy as sym
sym.init_printing()
(x, y) = sym.symbols("x, y")

sig=0
for i in range(N):
    sig+=X[i]

sig_2=0
for i in range(N):
    sig_2+=X[i]**2

min=10**10
med=X[0]
while True:
    sum=N*med**2-2*med*sig+sig_2

    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)


### FIXED CODE ###

# coding: utf-8
# Your code here!

N=int(input())
X=list(map(int,input().split()))
X.sort()

sig=0
for i in range(N):
    sig+=X[i]

sig_2=0
for i in range(N):
    sig_2+=X[i]**2

min=10**10
med=X[0]
while True:
    sum=N*med**2-2*med*sig+sig_2

    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)