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

import sys
import math
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

II = input_int

def map_int_input():
    return map(int, input())

MII = map_int_input

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

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

def LII_split():
    return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

S = input()
N = len(S)
# N 文字の文字列 S から、長さ N+1 の ---累積和--- s[0], s[1], ..., s[N] を作る
# これを 2019 で割ったあまりで分類する (具体的には counter[ r ] := あまりが r のやつが何個あるか)
# 各 r ごとに、counter[r] 個から 2 個選ぶ方法の数を、足し上げる(dp)

counter = dict()

for i in range(N + 1):
    if i == 0:
        sub = 0
    elif i == 1:
        sub = int(S[N-1])
    else:
        sub = int(S[N - i] + str(sub))
    rest = sub % 2019
    if rest in counter:
        counter[rest] += 1
    else:
        counter[rest] = 1

# def combinations_count(n, r):
#     return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = 0
for r in counter.values():
    ans += r*(r-1)/2
print(int(ans))

### FIXED CODE ###

S = list(input())
N = len(S)
# N 文字の文字列 S から、長さ N+1 の ---累積和--- s[0], s[1], ..., s[N] を作る
# これを 2019 で割ったあまりで分類する (具体的には counter[ r ] := あまりが r のやつが何個あるか)
# 各 r ごとに、counter[r] 個から 2 個選ぶ方法の数を、足し上げる

counter = [0] * 2019
k = 10
for i in range(N + 1):
    if i == 0:
        sub = 0
    elif i == 1:
        sub = int(S[N - 1])
    else:
        sub += int(S[N - i]) * k
        k *= 10
        k %= 2019
    rest = sub % 2019
    counter[rest] += 1

ans = 0
for r in counter:
    ans += r * (r - 1) // 2
print(ans)
### BUGGY CODE ###

# 入力
B, W = map(int, input().split())

MOD = 10**9 + 7

p = 0
q = 0
cp = 0
cq = 0
for i in range(1, B + W + 1):
    # i番目の解は i-1番目までに白チョコレートが枯渇している確率 +
    # i-1番目までにどちらのチョコレートも枯渇しない確率 / 2
    ans = ((1 + q - p) * pow(2, MOD - 2, MOD)) % MOD
    # 出力
    print(ans)
    cp = (
        0 if i < B else
        1 if i == B else
        (cp * (i - 1) * pow(i - B, MOD - 2, MOD)) % MOD
    )
    p = (
        0 if i < B else
        pow(2**i, MOD - 2, MOD) if i == B else
        (p + cp * pow(2**i, MOD - 2, MOD)) % MOD
    )
    cq = (
        0 if i < W else
        1 if i == W else
        (cq * (i - 1) * pow(i - W, MOD -2, MOD)) % MOD
    )
    q = (
        0 if i < W else
        pow(2**i, MOD - 2, MOD) if i == W else
        (q + cq * pow(2**i, MOD - 2, MOD)) % MOD
    )


### FIXED CODE ###

# 入力
B, W = map(int, input().split())

# ModInt定義
MOD = 10**9 + 7


class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    def __repr__(self):
        return str(self.x)

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    __radd__ = __add__
    __rsub__ = __sub__
    __rmul__ = __mul__
    __rtruediv__ = __truediv__
    __rpow__ = __pow__


p = ModInt(0)
q = ModInt(0)
cp = ModInt(0)
cq = ModInt(0)
for i in range(1, B + W + 1):
    # i番目の解は i-1番目までに白チョコレートが枯渇している確率 +
    # i-1番目までにどちらのチョコレートも枯渇しない確率 / 2
    ans = (1 + q - p) / 2
    # 出力
    print(ans)
    cp = (
        ModInt(0) if i < B else
        ModInt(1) if i == B else
        cp * (i - 1) / (i - B)
    )
    p = (
        ModInt(0) if i < B else
        ModInt(1) / ModInt(2**i) if i == B else
        p + cp / pow(2, i, MOD)
    )
    cq = (
        ModInt(0) if i < W else
        ModInt(1) if i == W else
        cq * (i - 1) / (i - W)
    )
    q = (
        ModInt(0) if i < W else
        ModInt(1) / ModInt(2**i) if i == W else
        q + cq / pow(2, i, MOD)
    )
### BUGGY CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Group = [N, 0, 0, 0, 0, 0]
X = [0] * 6
Y = [0] * 6
Method = [A, B, C, D, E]
T = 0
while Group[len(Method)] < N:
    for i in range(len(Method)):
        if Group[i]<=Method[i]:
            X[i+1] = Group[i]
            X[i] = 0
        else:
            X[i+1] = Method[i]
            X[i] = Group[i] - Method[i]
        Y[i] = Y[i] + X[i]
        Y[i+1] = Y[i+1] + X[i+1]
        X[i] = 0
        X[i+1] = 0
    Group[0] = Y[0]
    Group[1] = Y[1]
    Group[2] = Y[2]
    Group[3] = Y[3]
    Group[4] = Y[4]
    Group[5] = Group[5] + Y[5]
    Y = [0] * 6
    T += 1
print(T)

### FIXED CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
M = min(A, B, C, D, E)
X = N // M
if N % M == 0:
    X = X - 1
print(5 + X)
### BUGGY CODE ###

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

res = []
for i in range(len(A) - 1, 0, -1):
    val = A[i]
    max_val = -1
    for j in A[:i]:
        if max_val < j:
            max_val = j

    if max_val > val:
        res.append(max_val - val)
    else:
        res.append(0)

print(sum(res))


### FIXED CODE ###

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

res = 0
max_val = -1
for a in A:
    if a >= max_val:
        max_val = a
    else:
        res += max_val - a

print(res)
### BUGGY CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    K = int(readline())
    if K%2==0:
        print(-1)
    else:
        seven = 7
        ans = 1
        while True:
            seven = seven%K
            if seven==0:
                print(ans)
                break
            else:
                seven = seven*10+7
                ans += 1


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    K = int(readline())
    if K%2==0:
        print(-1)
    else:
        seven = 7
        amari = set([7])
        ans = 1
        while True:
            seven = seven%K
            if seven==0:
                print(ans)
                break
            else:
                seven = seven*10+7
                if seven in amari:
                    print(-1)
                    break
                ans += 1
                amari.add(seven)


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

n, m = map(int, input().split())
s = list(input())
connect = [set() for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    connect[a-1].add(b-1)
    connect[b-1].add(a-1)
def reach(xs):
    ret = set()
    for x in xs:
        ret.add(s[x])
    return ret
update = True
while update:
    update = False
    for i in range(n):
        if s[i] != 'X':
            c = reach(connect[i])
            if not ('A' in c and 'B' in c):
                update = True
                s[i] = 'X'
if 'A' in s and 'B' in s: print('Yes')
else: print('No')

### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
n, m = map(int, input().split())
s = input()
out = [set() for _ in range(n)]
count = [[0, 0] for _ in range(n)]
def f(c):
    if c == 'A': return 0
    else: return 1
for _ in range(m):
    a, b = map(int, input().split())
    if a == b:
        count[a-1][f(s[a-1])] += 1
    elif b-1 not in out[a-1]:
        count[a-1][f(s[b-1])] += 1
        count[b-1][f(s[a-1])] += 1
    out[a-1].add(b-1)
    out[b-1].add(a-1)
elim = set()
def eliminate(x):
    elim.add(x)
    c = f(s[x])
    for node in out[x]:
        if node not in elim:
            count[node][c] -= 1
            if count[node][0] * count[node][1] == 0:
                eliminate(node)
for i in range(n):
    if i not in elim and count[i][0] * count[i][1] == 0:
        eliminate(i)
if len(elim) < n: print('Yes')
else: print('No')
### BUGGY CODE ###

P = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))
dp = [[0]*(S+1) for i in range(N+1)]
# dp = [[0]*(S+1) for i in range(N)]
# dp[i][j] i番目まで見た時に和がjになる組み合わせの個数
dp[0][0] = 1
for i in range(N):
    num = A[i]
    for j in range(S+1):
        dp[i+1][j] += dp[i][j]*2
        if j-num >= 0:
            dp[i+1][j] += dp[i][j-num]
        dp[i+1][j] %= P
print(dp[N][S])

### FIXED CODE ###

P = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))
dp = [[0]*(S+1) for i in range(N+1)]
# dp = [[0]*(S+1) for i in range(N)]
# dp[i][j] i番目まで見た時に和がjになる組み合わせの個数
dp[0][0] = 1
for i in range(N):
    num = A[i]
    for j in range(S+1):
        dp[i+1][j] += dp[i][j]*2
        if j-num >= 0:
            dp[i+1][j] += dp[i][j-num]
        dp[i+1][j] %= P
print(dp[N][S])
### BUGGY CODE ###

from collections import deque
N,H=map(int,input().split())
a=[];b=[]
for _ in range(N):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)
bb=[]
for i in range(N):
    if b[i]>=max(a):
        bb.append(b[i])
if sum(bb)>=H:
    print(len(bb))
else:
    ans=int((H-sum(bb))/max(a))+len(bb)
    if (H-sum(bb))%max(a)==0:
        print(ans)
    else:
        print(ans+1)

### FIXED CODE ###

N,H=map(int,input().split())
S=[[int(x) for x in input().split()] for _ in range(N)]
A,B=zip(*S)
A=max(A)
B=[b for b in B if b>A]
B.sort(reverse=True)
ans=0
cnt=0
for b in B:
    if H<=0:
        break
    cnt+=1
    H-=b
if H>0:
    cnt+=(H-1)//A+1
print(cnt)
### BUGGY CODE ###

r, g, b, n = [int(num) for num in input().split()]

#総当たり
counter = 0
for r_c in range(0, n // r + 1):
  for g_c in range(0, n // g + 1):
    for b_c in range(0, n // b + 1):
      if (r_c * r + g_c * g + b_c * b) == n:
        counter += 1
print(counter)

### FIXED CODE ###

r, g, b, n = [int(num) for num in input().split()]
arr = [r, g, b]
arr.sort()

#総当たり
counter = 0
for c_1 in range(0, n // arr[-1] + 1):
  for c_2 in range(0, n // arr[-2] + 1):
      if n - c_1 * arr[-1] - c_2 * arr[-2] < 0:
        break
      if (n - c_1 * arr[-1] - c_2 * arr[-2]) % arr[-3] == 0:
        counter += 1
print(counter)
### BUGGY CODE ###


def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    if 0 in a_list:
        print('0')
        return

    result = 1

    for a in a_list:
        result = result * a

    if result > 10**18:
        print('-1')
        return

    print(result)


if __name__ == "__main__":
    main()


### FIXED CODE ###


def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    a_list = list(filter((1).__ne__, a_list))

    if 0 in a_list:
        print('0')
        return

    result = 1

    for a in a_list:
        result = result * a

        if result > 10**18:
            print('-1')
            return

    print(result)


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

import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    answer = 0
    means = list(map(lambda x: (1+x)/2, p))
    sum_list = [sum(means[:i]) for i in range(N+1)]
    for i in range(N-K+1):
        answer = max(answer, sum_list[i+K]-sum_list[i])
    print(answer)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    answer = sum(p[0:K])
    r = answer
    for i in range(N-K):
        answer = answer - p[i] + p[i+K]
        r = max(r, answer)
    print((r+K)/2)


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

R,G,B,N =map(int,input().split())
ans=0
for r in range(N//R +1):
  for g in range(N//G +1):
    n = N-r*R-g*G
    
    if n>=0:
      if n%B==0:

        ans+=1

print(ans)

### FIXED CODE ###

R,G,B,N =map(int,input().split())
ans=0
for r in range(N//R +1):
  for g in range(N//G +1):
    n = N-r*R-g*G
    
    if n>=0:
      if n%B==0:

        ans+=1

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

N = int(input())
if N == 1:
    print(0)
    exit()
primes = []
i = 2
tmp = N
flag = False
while i**2 <= tmp:
    if N % i == 0:
        flag = True
        count = 0
        while N % i == 0:
            N //= i
            count += 1
        primes.append((i, count))
    i += 1

if (not N == 1) and flag:
    i = 2
    tmp = N
    while N > 1:
        if N % i == 0:
            count = 0
            while N % i == 0:
                N //= i
                count += 1
            primes.append((i, count))
        i += 1

if not primes:
    print(1)
    exit()

count = 0
for p in primes:
    c = 0
    t = 0
    for i in range(1, 10 ** 9):
        c += i
        t += 1
        if c > p[1]:
            count += t - 1
            break
        elif c == p[1]:
            count += t
            break

print(count)


### FIXED CODE ###

N = int(input())
if N == 1:
    print(0)
    exit()


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


primes = factorization(N)

count = 0
for p in primes:
    c = 0
    t = 0
    for i in range(1, 10 ** 9):
        c += i
        t += 1
        if c > p[1]:
            count += t - 1
            break
        elif c == p[1]:
            count += t
            break

print(count)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

h, w = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(h)]
B = [list(map(int, input().split())) for _ in range(h)]
M = 100*(h*w)
dp = [[[False]*2*M for j in range(w)] for i in range(h)]
d = abs(A[0][0] - B[0][0])
dp[0][0][M-d] = True
dp[0][0][M+d] = True
for i in range(h):
  for j in range(w):
    d = abs(A[i][j] - B[i][j])
    if i:
      for s in range(2*M):
        if s >= d:
          dp[i][j][s] |= dp[i-1][j][s-d]
        if s < 2*M-d:
          dp[i][j][s] |= dp[i-1][j][s+d]
    if j:
      for s in range(2*M):
        if s >= d:
          dp[i][j][s] |= dp[i][j-1][s-d]
        if s < 2*M-d:
          dp[i][j][s] |= dp[i][j-1][s+d]
for i, v in enumerate(dp[-1][-1]):
  if i >= M and v:
    print(i-M)
    break

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
  h, w = map(int, input().split())
  A = [list(map(int, input().split())) for _ in range(h)]
  B = [list(map(int, input().split())) for _ in range(h)]
  M = 80*(h+w)
  dp = [[0]*w for i in range(h)]
  d = abs(A[0][0] - B[0][0])
  mask = (1 << (2*M)) - 1
  dp[0][0] |= 1 << (M-d)
  dp[0][0] |= 1 << (M+d)
  for i in range(h):
    for j in range(w):
      d = abs(A[i][j] - B[i][j])
      if i:
        dp[i][j] |= (dp[i-1][j] << d) & mask
        dp[i][j] |= dp[i-1][j] >> d
      if j:
        dp[i][j] |= (dp[i][j-1] << d) & mask
        dp[i][j] |= dp[i][j-1] >> d
  t = dp[-1][-1] >> M
  ans = (t & (-t)).bit_length() - 1
  print(ans)
  
if __name__ == "__main__":
  main()
### BUGGY CODE ###

n = int(input())
list_num = list(map(int, input().split()))
nums = list(set(list_num))
count = 0

for i in range(len(nums)):
    a = list_num.count(nums[i])
    count += a * (a - 1) / 2

for i in range(len(list_num)):
    list_c = list_num.copy()
    c = list_c.pop(i)
    b = list_c.count(c)
    print(int(count - b))

### FIXED CODE ###

import collections
n=int(input())
arr=list(map(int,input().split()))
cnt=collections.Counter(arr) #各数Akの個数を数える
total=0
for key in cnt.keys():
  total+=cnt[key]*(cnt[key]-1)//2 #各数Akについて、cnt[Ak]個から異なる2個のボールを取り出す場合の数を事前に計算する
for i in range(n): #各iについて上記の方法で答えを求める
  print(total-cnt[arr[i]] + 1)
### BUGGY CODE ###

def search(key, L):
    inc = -1
    exc = N
    while abs(inc-exc) > 1:
        mid = (inc+exc) // 2
        if True if L[mid] <= key else False:
            inc = mid
        else:
            exc = mid
    return exc


def main():
    ans = 0
    for a in A:
        for i in range(search(a, B), N):
            ans += N - search(B[i], C)
    print(ans)


if __name__ == "__main__":
    N = int(input())
    A = [int(a) for a in input().split()]
    B = sorted([int(b) for b in input().split()])
    C = sorted([int(c) for c in input().split()])
    main()


### FIXED CODE ###

def search(key, L):
    inc = -1
    exc = N
    while abs(inc-exc) > 1:
        mid = (inc+exc) // 2
        if True if L[mid] <= key else False:
            inc = mid
        else:
            exc = mid
    return exc


def main():
    ans = 0
    for a in A:
        e = search(a, B)
        if e < N:
            ans += E[e]
    print(ans)


if __name__ == "__main__":
    N = int(input())
    A = [int(a) for a in input().split()]
    B = sorted([int(b) for b in input().split()])
    C = sorted([int(c) for c in input().split()])
    E = [0]*N
    for i in range(1, N+1):
        E[-i] = (N-search(B[N-i], C)) + E[-i+1]
    main()
### BUGGY CODE ###

def main():
    from bisect import bisect_left as bl
    from bisect import bisect_right as br

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

    inf = 10**18+1

    ok = -inf
    ng = inf
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        cnt = 0
        for i in a:
            if i < 0:
                if mid % i == 0:
                    cnt += n - br(a, mid//i)
                else:
                    cnt += n - br(a, mid//i + 0.5)
            elif i > 0:
                if mid % i == 0:
                    cnt += bl(a, mid//i)
                else:
                    cnt += bl(a, mid//i + 0.5)
            else:
                if mid > 0:
                    cnt += n
                else:
                    cnt += 0
        for i in a:
            if i*i < mid:
                cnt -= 1
        if cnt//2 < k:
            ok = mid
        else:
            ng = mid
    print(ok)


main()


### FIXED CODE ###

def main():
    from bisect import bisect_left as bl

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

    inf = 10**18+1

    ok = -inf
    ng = inf
    start_0 = bl(a, 0)
    start_1 = bl(a, 1)

    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        cnt = 0
        if mid >= 0:
            now = 0
            if start_0 > 0:
                for i in a[start_0-1::-1]:
                    while now < n:
                        if i*a[now] >= mid:
                            now += 1
                        else:
                            break
                    cnt += n - now
            now = n
            for i in a[start_1:]:
                while now > 0:
                    if i*a[now-1] >= mid:
                        now -= 1
                    else:
                        break
                cnt += now
        else:
            now = 0
            for i in a[:start_0]:
                while now < n:
                    if i*a[now] >= mid:
                        now += 1
                    else:
                        break
                cnt += n - now
            now = n
            for i in a[n-1:start_1-1:-1]:
                while now > 0:
                    if i*a[now-1] >= mid:
                        now -= 1
                    else:
                        break
                cnt += now
        if mid > 0:
            cnt += n * (start_1 - start_0)
        cnt -= len([None for i in a if i*i < mid])
        if cnt//2 < k:
            ok = mid
        else:
            ng = mid
    print(ok)


main()
### BUGGY CODE ###

s = list(input())
Ans = 0
for i in range(len(s)):
    if s[i] == 'B':
        for j in range(len(s)-i-1):
            if s[i+j+1]=='W':
                Ans += j+1
                s[i] = 'W'
                s[i+1] = 'B'
                s[i+j+1] = 'B'
                break
print(Ans)

### FIXED CODE ###

s = list(input())
Ans = 0
W_put_place = 0
for i in range(len(s)):
    if s[i] == 'W':
        Ans += i - W_put_place
        W_put_place += 1
print(Ans)
### BUGGY CODE ###

from itertools import combinations
N,X,Y = map(int, input().split())
ans = [0]*(N-1)
for a,b in combinations(range(N),2):
    c = min([abs(a-b), abs(X-1-a)+abs(Y-1-b)+1, abs(Y-1-a)+abs(X-1-b)+1])
    ans[c-1] += 1
print("\n".join([str(i) for i in ans]))

### FIXED CODE ###

from itertools import combinations
N,X,Y = map(int, input().split())
ans = [0]*(N-1)
for a,b in combinations(range(N),2):
  c = min([abs(a-b), abs(X-1-a)+abs(Y-1-b)+1, abs(Y-1-a)+abs(X-1-b)+1])
  ans[c-1] += 1
for i in ans: print(i)
### BUGGY CODE ###

n, k = list(map(int, input().split()))
al = list(map(int, input().split()))
t = 1
for i in range(n):
    tt = t
    t *= al[i]

    if i < k:
        continue
    else:
        t //= al[i-k]
        if tt < t:
            print('Yes')
        else:
            print('No')


### FIXED CODE ###

n, k = list(map(int, input().split()))
al = list(map(int, input().split()))
t = 1
for i in range(n):
    if i < k:
        continue
    else:
        t //= al[i-k]
        if al[i-k] < al[i]:
            print('Yes')
        else:
            print('No')
### BUGGY CODE ###

H, N = map(int,input().split())
Magic = [list(map(int, input().split())) for i in range(N)]
MAX_COST = max(Magic)[1]


dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H):
    for damage, cost in Magic:
        next_index = min(h + damage, H)
        dp[next_index] = min(dp[next_index], dp[h] + cost)
 
print(dp[-1])

### FIXED CODE ###

H, N = map(int,input().split())
Magic = [list(map(int, input().split())) for i in range(N)]
MAX_COST = max(Magic)[1]

dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H):
    for damage, cost in Magic:
        next_index = min(h + damage, H)
        dp[next_index] = min(dp[next_index], dp[h] + cost)
 
print(dp[-1])
### BUGGY CODE ###

N=int(input())
l=[]
for i in range(N):
  l.append(sorted(input()))
ans=0
for a in range(N):
  for b in range(a+1,N):
    if l[a]==l[b]:
      ans+=1
print(ans)

### FIXED CODE ###

N=int(input())
l=[]
from collections import Counter
for i in range(N):
  l.append(''.join(sorted(input())))
l1=Counter(l).values()
from math import factorial
ans=0
for a in l1:
  if a >= 2:
    ans+=int(factorial(a)/(factorial(a-2)*factorial(2)))
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
pre=a[0]
score=0
for i in range(1,n):
    score=pre*a[i]
    
    pre=score
    
if score>10**18:
    print(-1)
else:
    print(score)

### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)

    if 0 in A:
        print('0')
        return
    prod=1
    for a in A:
        prod*=a
        if prod> 1000000000000000000:
            print('-1')
            return
    print(prod)

ans=main()
### BUGGY CODE ###

N = int(input())

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

print(sum([i for i in range(N)]))
  



### FIXED CODE ###

N = int(input())

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

print((N-1) * N // 2)