Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
x = map(int, input().split())
x = list(x)
for c in x:
    x_remove = x.copy()
    x_remove.remove(c)
    x_remove.insert(0,0)
    x_remove.append(0)
    i = 0
    ans = 0
    for i, b in enumerate(x_remove[1:]):
        ans += abs(x_remove[i] - b)        
    print(ans)

### FIXED CODE ###

n = int(input())
X = map(int, input().split())
X = list(X)
# n = 3
# X = [3, 5, -1]

X.insert(0,0)
X.append(0)
Y = []
for i, x in enumerate(X[1:]):
    Y.append(abs(x-X[i]))
sumY = sum(Y)

for i, x in enumerate(X):
    if i not in [0,len(X)-1]:
        ans = sumY - (Y[i-1] + Y[i]) + abs(X[i+1]-X[i-1])
        print(ans)
### BUGGY CODE ###

n = int(input())
p = list(map(int,input().split()))
l = [2*10**5]
cnt=0
if n == 1:
  print(1)
else:
  for i in range(n-1):
    l.append(p[i])
    m = min(l)
    if m > p[i+1]:
      #print(p[i+1])
      cnt+=1
  print(cnt+1)

### FIXED CODE ###

n = int(input())
p = list(map(int,input().split()))
m = 2*10**5
cnt=0
if n == 1:
  print(1)
else:
  for i in range(n-1):
    if m > p[i]:
      m = p[i]
    if m > p[i+1]:
      #print(p[i+1])
      cnt+=1
  print(cnt+1)
### BUGGY CODE ###

from collections import deque
import copy
 
def main():
  H, W = map(int, input().split())
  M = [['#' == x for x in input()] for _ in range(H)]
  que = deque([(i, j) for i in range(H) for j in range(W) if M[i][j]])
  ans = 0
  while True:
    ans += 1
    qq = deque()
    while que:
      nh, nw = que.popleft()
      if nw < W-1 and not M[nh][nw+1]:
        qq.append((nh,nw+1))
        M[nh][nw+1] = True
      if nw > 0 and not M[nh][nw-1]:
        qq.append((nh,nw-1))
        M[nh][nw-1] = True
      if nh < H-1 and not M[nh+1][nw]:
        qq.append((nh+1,nw))
        M[nh+1][nw] = True
      if nh > 0 and not M[nh-1][nw]:
        qq.append((nh-1,nw))
        M[nh-1][nw] = True
    if qq:
      que = copy.copy(qq)
    else:
      break
  print(ans-1)
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

import copy
from collections import deque
def main():
  H, W = map(int, input().split())
  G = [['#' == x for x in input()] for _ in range(H)]
 
  black = deque([(i, j) for i in range(H) for j in range(W) if G[i][j]])
 
  ans = 0
  while True:
    ans += 1
    next_black = deque()
    while black:
      bi, bj = black.popleft()
      if bi > 0 and not G[bi - 1][bj]:
        G[bi - 1][bj] = True
        next_black.append((bi - 1, bj))
      if bj > 0 and not G[bi][bj - 1]:
        G[bi][bj - 1] = True
        next_black.append((bi, bj - 1))
      if bi < H - 1 and not G[bi + 1][bj]:
        G[bi + 1][bj] = True
        next_black.append((bi + 1, bj))
      if bj < W - 1 and not G[bi][bj + 1]:
        G[bi][bj + 1] = True
        next_black.append((bi, bj + 1))
    if next_black:
       black = copy.copy(next_black)
    else:
       break
  print(ans - 1)
  
if __name__ == "__main__":
  main()
### BUGGY CODE ###

N,K=map(int,input().split())
L=list(map(int,input().split()))
M=0
M_IND=0

for i in range(len(L)-(K-1)):
  tmp = sum(L[i:i+K])
  #print(tmp)
  if M < tmp:
    M = tmp
    M_IND=i
#print(M_IND)
#for k in range(L[M_IND,M_IND+K])
ANS=0
MEMO=[0]*(max(L[M_IND:M_IND+K])+1)
MEMO_MIN=0
for i in L[M_IND:M_IND+K]:
  #print(i)
  ex = 0
  p = 1/i
  if MEMO[i] == 0:
    for x in range(i+1):
        px = p*x
        ex += px
    MEMO[i] = ex
  else:
    ex = MEMO[i]
  ANS += ex
print(ANS)

### FIXED CODE ###

def kitai(n):
  return (int(n)+1)/2

import numpy as np
n,k=map(int,input().split())

L=np.array([list(map(kitai, input().split()))]).reshape(-1)

from itertools import accumulate

acc = [0]+ list(accumulate(L)) # 0を忘れずに
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n, m = map(int, input().split())
list = [int(i) for i in input().split()]
while(m):
  list[list.index(max(list))] = max(list)//2
  m -= 1
print(sum(list))

### FIXED CODE ###

import heapq
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
for i in range(n):
  a[i] *= -1

heapq.heapify(a)
for i in range(m):
    heapq.heapreplace(a, int(a[0] / 2))

print(sum(a)*-1)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

n = int(input())

a = []

for i in range(n):
    a.append(int(input()))

for i in range(0,n):
    a1 = a[:i]
    a2 = a[i+1:]
    
    if len(a1) == 0:
        print(max(a2))
    elif len(a2) == 0:
        print(max(a1))
    else:
        print(max(max(a1), max(a2)))


### FIXED CODE ###

# -*- coding: utf-8 -*-

n = int(input())

a = []

for i in range(n):
    a.append((i, int(input())))

a_sorted = sorted(a, key = lambda k:k[1])
max_index = a_sorted[-1][0]

#print(a_sorted)

a_max = a_sorted[-1][1]
a_sec_max = a_sorted[-2][1]

for i in range(0,n):
    if i != max_index:
        print(a_max)
    else:
        print(a_sec_max)
### BUGGY CODE ###

def main():
    from fractions import gcd
    from functools import reduce


    MOD = 10 ** 9 + 7

    def lcm_base(x, y):
        return (x * y) // gcd(x, y)

    def lcm(*numbers):
        return reduce(lcm_base, numbers, 1)

    def lcm_list(numbers):
        return reduce(lcm_base, numbers, 1)

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

    tmp = lcm(*A)

    # print (tmp)
    ans = 0
    for a in A:
        ans += tmp // a
        ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    from fractions import gcd

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

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###


def main():
    N, K  = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [float("inf")] * max(N,K)
    dp[0] = 0

    for i in range(N):
        j = 0
        L = min(K, i)
        while j <= L:
            if dp[i] > dp[i-j] + abs(h[i]-h[i-j]):
                dp[i] = dp[i-j] + abs(h[i]-h[i-j])
            j += 1
    print(dp[N-1])

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N, K  = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [10**9] * N
    dp[0] = 0

    for i in range(N):
        dp[i] = min([dp[i-j] + abs(h[i]-h[i-j]) for j in range(min(K,i)+1)])
    print(dp[N-1])

if __name__ == "__main__":
    main()
### BUGGY CODE ###

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

ans = 0
for i in range(n):
    a = A[i]
    ato = i+a
    if i+a > n:
        ato = n
    for j in range(ato,n):
        if j-i == A[i]+A[j]:
            ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
X = dict()
ans = 0
for i in range(N):
    L = i + A[i]
    if L not in X:
        X[L] = 1
    else:
        X[L] += 1

for j in range(N):
    R = j - A[j]
    if R in X:
        ans += X[R]

print(ans)
### BUGGY CODE ###

import sys
 
def main():
  N, W = map(int, input().split())
  w = [0]*N
  v = [0]*N
  for i in range(N):
          w[i], v[i] = map(int, sys.stdin.readline().split())
 
  #WV = [list(map(int, sys.stdin.readline().split())) for i in range(N)]
 
 
  dp = [[0]*(N+1) for j in range(W+1)]
 
  for i in range(1, W+1):
          for j in range(1, N+1):
                  if i - w[j-1]>=0:
                  #if i - WV[j-1][0]>=0:
                          dp[i][j] = max(dp[i-w[j-1]][j-1]+v[j-1], dp[i][j-1])
                          #dp[i][j] = max(dp[i-WV[j-1][0]][j-1]+WV[j-1][1], dp[i][j-1])
                  else:
                          dp[i][j] = dp[i][j-1]
 
  print(dp[W][N])
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
 
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
        w[i], v[i] = map(int, sys.stdin.readline().split())
 
#WV = [list(map(int, sys.stdin.readline().split())) for i in range(N)]
 
 
dp = [[0]*(N+1) for j in range(W+1)]
 
for i in range(1, W+1):
        for j in range(1, N+1):
                if i - w[j-1]>=0:
                #if i - WV[j-1][0]>=0:
                        dp[i][j] = max(dp[i-w[j-1]][j-1]+v[j-1], dp[i][j-1])
                        #dp[i][j] = max(dp[i-WV[j-1][0]][j-1]+WV[j-1][1], dp[i][j-1])
                else:
                        dp[i][j] = dp[i][j-1]
 
print(dp[W][N])
### BUGGY CODE ###

import itertools

n = int(input())
num_list = list(map(int, input().split()))
sum = 0

for i in itertools.combinations(num_list, 2):
    sum += (i[0] * i[1]) % (10**9 + 7)

print(sum % (10**9 + 7))

### FIXED CODE ###

from itertools import accumulate

n = int(input())
a = list(map(int, input().split()))
b = list(accumulate(a))
sum = 0

for i in range(len(a)):
    sum += a[i]*(b[-1] - b[i])
    sum %= 10**9 + 7

print(sum)
### BUGGY CODE ###

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

l = []
count = 0
for i in A:
    if i not in l:
        l.append(i)
    else:
        count += 1

if count == 0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

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

if len(a) == len(b):
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

import numpy as np
goukei = 0

N = int(input()) * (-1)
Ai = list(map(int, input().split()))
array_Ai = np.array(Ai)
number = np.array([j for j in range(0, N, -1)])
number_1 = np.array([1 for k in range(-N)])
new_ai = number + array_Ai
new_ai = new_ai - number_1
for i in range(len(Ai)):
    new_ai = new_ai + number_1
    goukei += np.count_nonzero(new_ai == -Ai[i])
print(goukei)

### FIXED CODE ###

import collections
goukei = 0

N = int(input())
Ai = list(map(int, input().split()))
number = [j for j in range(1, N+1, 1)]
plus_Ai = [x + y for (x, y) in zip(Ai, number)]
minus_Ai = [x - y for (y, x) in zip(Ai, number)]
c = collections.Counter(plus_Ai)

for i in minus_Ai:
    goukei += c[i]
print(goukei)
### BUGGY CODE ###

a,b,c,k = list(map(int,input().split()))
A = 1
B = 0
C = -1

total = 0
for i in range(k):
    if a > 0:
        total += A
        a -= 1
    elif b > 0:
        total += B
        b -= 1
    else:
        total += C
        b -= 1
print(total)


### FIXED CODE ###

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

if a >= k:
    print(k)
elif a+b >= k:
    print(a)
else:
    print(2*a+b-k)
### BUGGY CODE ###

def abc155_d():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()

    from bisect import bisect_left, bisect_right
    lower = -10**18
    upper = 10**18
    while upper - lower > 1:
        x = (upper + lower) // 2
        cnt = 0
        for i in range(n-1):
            a = A[i]
            if a < 0:
                idx = bisect_left(A, (x+a+1)//a)
                cnt += n - max(idx, i+1)
            elif a > 0:
                idx = bisect_right(A, x//a)
                cnt += max(0, idx - i - 1)
            else:  # a == 0
                if x >= 0:
                    cnt += n - i - 1
            if cnt >= k: break
        if cnt >= k: upper = x
        else: lower = x
    print(upper)

if __name__ == '__main__':
    abc155_d()

### FIXED CODE ###

def abc155_d():
    n, k = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()

    from bisect import bisect_left, bisect_right
    lower = -10**18
    upper = 10**18
    while upper - lower > 1:
        x = (upper + lower) // 2
        cnt = 0
        for i in range(n-1):
            a = A[i]
            if a < 0:
                idx = bisect_left(A, (x+a+1)//a)
                cnt += n - max(idx, i+1)
            elif a > 0:
                idx = bisect_right(A, x//a)
                cnt += max(0, idx - i - 1)
            else:  # a == 0
                if x >= 0:
                    cnt += n - i - 1
            if cnt >= k: break
        if cnt >= k: upper = x
        else: lower = x
    print(upper)

if __name__ == '__main__':
    abc155_d()
### BUGGY CODE ###


# -*- coding: utf-8 -*-

n = int(input())
s = list(input())

# 0 0 1 1 全部黒
# 0 1 2 2
# 0 1 1 1
# 0 1 1 2 全部白
#  # . #

sum = [0]*(n+1)
ans = n

for i in range(n+1):
    for j in range(0,i):
        # print('i = {}, j = {}'.format(i,j))
        if s[j] == '#':
            sum[j+1] = sum[j] + 1
        else:
            sum[j+1] = sum[j]

    for k in range(i, n):
        # print('i = {}, k = {}'.format(i,k))
        if s[k] == '.':
            sum[k+1] = sum[k] + 1
        else:
            sum[k+1] = sum[k]
    ans = min(ans, sum[n])
print(ans)

### FIXED CODE ###


# -*- coding: utf-8 -*-

n = int(input())
s = list(input())

sum_w = [0]*(n+1)
sum_b = [0]*(n+1)
ans = n

for i in range(n):
    if s[i] == '#':
        sum_b[i+1] = sum_b[i] + 1
    else:
        sum_b[i+1] = sum_b[i]

    if s[i] == '.':
        sum_w[i+1] = sum_w[i] + 1
    else:
        sum_w[i+1] = sum_w[i]

ans = n
for i in range(n+1):
    ans = min(ans, sum_b[i]+sum_w[n]-sum_w[i])
print(ans)
### BUGGY CODE ###

def solve():
    mod=998244353
    N=int(input())
    A=[]
    for i in range(N):
        A.append(int(input()))
    sumA=sum(A)
    sumA2=(sumA+1)//2

    # dp[N][sum] : N個目までの合計がsumの数
    dp = [[0]*(sumA2+2) for i in range(N+1)]
    dp[0][0]=1
    for i in range(N):
        for j in range(sumA2+1):
            if dp[i][j]==0:
                continue
            dp[i+1][j]+=dp[i][j]*2
            j2=min(sumA2,j+A[i])
            dp[i+1][j2]+=dp[i][j]
    ans=1
    for i in range(N):
        ans=(ans*3)%mod
    ans=(ans+mod-3*dp[N][sumA2])%mod

    if sumA%2==0:
        # dp[N][sum] : N個目までの合計がsumの数
        dp = [[0]*(sumA2+2) for i in range(N+1)]
        dp[0][0]=1
        for i in range(N):
            for j in range(sumA2+2):
                if dp[i][j]==0:
                    continue
                dp[i+1][j]+=dp[i][j]
                j2=min(sumA2+1,j+A[i])
                dp[i+1][j2]+=dp[i][j]
        ans=(ans+3*dp[N][sumA2])%mod

    return ans

print(solve())


### FIXED CODE ###

def solve():
    mod=998244353
    N=int(input())
    A=[]
    for i in range(N):
        A.append(int(input()))
    sumA=sum(A)
    sumA2=(sumA+1)//2

    dp = [[0]*(sumA2+2) for i in range(N+1)]
    dp[0][0]=1
    for i in range(N):
        for j in range(sumA2+1):
            if dp[i][j]!=0:
                dp[i+1][j]=(dp[i+1][j]+dp[i][j]*2)%mod
                j2=min(sumA2,j+A[i])
                dp[i+1][j2]=(dp[i+1][j2]+dp[i][j])%mod
    ans=1
    for i in range(N):
        ans=(ans*3)%mod
    ans=(ans+mod-3*dp[N][sumA2])%mod

    if sumA%2==0:
        dp = [[0]*(sumA2+2) for i in range(N+1)]
        dp[0][0]=1
        for i in range(N):
            for j in range(sumA2+2):
                if dp[i][j]!=0:
                    dp[i+1][j]+=dp[i][j]
                    j2=min(sumA2+1,j+A[i])
                    dp[i+1][j2]+=dp[i][j]
        ans=(ans+3*dp[N][sumA2])%mod

    return ans

print(solve())
### BUGGY CODE ###

s = str(input())
q = int(input())

for _ in range(q):
    i = list(map(str, input().split()))
    if i[0] == '1':
        s = s[::-1]
    else:
        if i[1] == '1':
            s = i[2] + s
        else:
            s = s + i[2]

print(s)

### FIXED CODE ###

s = str(input())
q = int(input())

head = ''
back = ''
flg = 1
for _ in range(q):
    i = list(map(str, input().split()))
    if i[0] == '1':
        #head, back = back, head
        flg *= -1
    else:
        if i[1] == '1':
            if flg == 1:
                head = head + i[2]
            else:
                back = back + i[2]
        else:
            if flg == 1:
                back = back + i[2]
            else:
                head = head+ i[2]

if flg == 1:
    print(head[::-1]+s+back)
else:
    print(back[::-1]+s[::-1]+head)
### BUGGY CODE ###

n = input()
a = list(map(int, input().split()))
number_dict = {}
for i in a:
    if i not in number_dict:
        number_dict[i] = int(a.count(i) * (a.count(i)-1) / 2)
total_comb = sum(number_dict.values())
for i in a:
    diff = number_dict[i] - int((a.count(i)-1) * (a.count(i)-2)/2)
    print(total_comb - diff)

### FIXED CODE ###

import collections
n = int(input())
a = list(map(int, input().split()))
cnt = collections.Counter(a)
total = 0
for key in cnt.keys():
    total += cnt[key]*(cnt[key]-1) // 2
for i in a:
    ans = total
    ans -= cnt[i] * (cnt[i]-1) / 2
    ans += (cnt[i]-1) * (cnt[i]-2) / 2
    print(int(ans))
### BUGGY CODE ###

def main():
    
    h,w = map(int,input().split())
    l = [list(input()) for i in range(h)]

    c = [[[-1]*2 for i in range(w)] for i in range(h)]
    ans = 0
    for i in range(h):
        for j in range(w):
            if c[i][j][0] == -1:
                n = 0
                while i+n < h:
                    if l[i+n][j] == ".":
                        n += 1
                    else:
                        break
                for k in range(n):
                    c[i+k][j][0] = n
                
            if c[i][j][1] == -1:
                n = 0
                while j+n < w:
                    if l[i][j+n] == ".":
                        n += 1
                    else:
                        break
                for k in range(n):
                    c[i][j+k][1] = n
    
    
            ans = max(ans,c[i][j][0]+c[i][j][1])
    print(ans-1)
if __name__ == "__main__":
    main()

### FIXED CODE ###


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

c1 = [[-1 for i in range(w)] for i in range(h)]
c2 = [[-1 for i in range(w)] for i in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        if c1[i][j] == -1:
            n = 0
            while i+n < h:
                if l[i+n][j] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c1[i+k][j] = n
            
        if c2[i][j] == -1:
            n = 0
            while j+n < w:
                if l[i][j+n] == ".":
                    n += 1
                else:
                    break
            for k in range(n):
                c2[i][j+k] = n


        ans = max(ans,c1[i][j]+c2[i][j])
print(ans-1)
### BUGGY CODE ###

num, capacity = map(int, input().split())
dp = [0]*(capacity+1)

for i in range(1, num + 1):
    weight, value = map(int, input().split())
    for w in range(capacity,-1,-1):
        if w < weight:
            continue
        else:
            dp[w] = max( dp[w - weight] + value,  dp[w] )
print(dp[capacity])

### FIXED CODE ###

def calc(num,capacity):
    dp = [0]*(capacity+1)
    for _ in range(num):
        weight, value = map(int, input().split())
        for w in range(capacity,weight - 1,-1):
            tmp = dp[w - weight] + value
            if dp[w] < tmp:
              dp[w] = tmp
    return dp[capacity]

num, capacity = map(int, input().split())
print(calc(num,capacity))
### BUGGY CODE ###

# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

tot = 0
for i in range(N):
    for j in range(i+1, N):
        tot += A[i] * A[j]
        
print(tot % (10 ** 9 + 7))

### FIXED CODE ###

# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

sum_A = sum(A)

tot = 0
for i in range(N):
    sum_A -= A[i]
    tot += A[i] * sum_A
        
print(tot % 1000000007)
### BUGGY CODE ###

a = []
x = 1

n = int(input())
a = input().split()

for i in range(n):
    a[i-1] = int(a[i-1])
    x = x * a[i-1]
    
if x <= 10**18:
    print(x)
else:
    print(-1)

### FIXED CODE ###

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

for i in range(n):
  ans = ans * a[i]
  if ans > 10**18:
    ans = -1
    break

print(ans)
### BUGGY CODE ###

flag = True
S = input()
Q = int(input())
for i in range(Q):
  T = input().split()
  if T[0] == "1":
    if flag == True:
      flag = False
    else:
      flag = True
  else:
    if flag == True:
      if T[1] == "1":
        S = T[-1] + S
      else:
        S = S + T[-1]
    else:
      if T[1] == "1":
        S = S + T[-1]
      else:
        S = T[-1] + S
if flag == True:
  print(S)    
else:
  T = S[::-1]
  print(T)

### FIXED CODE ###

flag = True
sen = ""
ushi = ""
S = input()
Q = int(input())
for i in range(Q):
  T = input().split()
  if T[0] == "1" :
    flag = not flag
  else:
    if flag:
      if T[1] == "1":
        sen = T[2] + sen
      else:
        ushi = ushi + T[2]
    else:
      if T[1] == "1":
        ushi = ushi + T[2]
      else:
        sen = T[2] + sen
ans = sen + S + ushi
if flag == False:
  print(ans[::-1])
else:
  print(ans)
### BUGGY CODE ###

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

# 累積積
AC = [1]
for a in A:
    AC.append(AC[-1]*a)
AC.pop(0)
# print(AC)

for i in range(k,n):
    if (i-1)-k < 0:
        prev = AC[i-1]
    else:
        prev = AC[i-1] / AC[(i-1)-k]
    
    if i-k < 0:
        now = AC[i]
    else:
        now = AC[i] / AC[i-k]
    # print(prev)
    # print(now)
    # print((i-1)-(k))
    # print(i-1)
    # print("****")
    # print(i-(k))
    # print(i)
    if prev < now:
        print("Yes")
    else:
        print("No")
    # print("----------")

### FIXED CODE ###

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

for i in range(k,n):
    if A[i-k] < A[i]:
        print("Yes")
    else:
        print("No")