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

import numpy as np
def cal_list(list):
    temp = len(list)
    ans = 0
    for i in range(temp):
        ans += sum(range(1,list[i]+1))/list[i]
    return ans

n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0

for i in range(n):
    try:
        if ans < sum(p[i:i+k]):
            ans = sum(p[i:i+k])
            ans_list = p[i:i+k]
    except:
        pass

print(cal_list(ans_list))

### FIXED CODE ###

# import numpy as np

def cal_ans(x):
    ans = (x+1)/2
    return ans
n,k = map(int,input().split())
p = list(map(int,input().split()))
p = list(map(cal_ans,p))

ans_temp = 0
ans_list = []
S = [0]
for i in range(n):
    S.append(S[i]+p[i])
# print(p)
# print(S)
# for i in range(n-k+1):
#     ans_list.append(sum(p[i:i+k]))
t_len = len(S)
ans1 = 0
for i in range(t_len - k):
    if ans1 < S[i+k]-S[i]:
        ans1 = S[i+k]-S[i]
print(ans1)
# ans = 0
# for i in range(k):
#     ans += (ans_list[i]*(ans_list[i]+1)/2)/ans_list[i]
#     # print((ans_list[i]*(ans_list[i]+1)/2))
# print(ans)
### BUGGY CODE ###

N,W=map(int,input().split())
lwv=[]
for i in range(N):
    lwv.append(list(map(int,input().split())))
ldp=[[float("inf") for j in range(10**5)] for i in range(N)]
for j in range(10**5):
    if lwv[0][1]>=j+1:
        ldp[0][j]=lwv[0][0]
for i in range(1,N):
    for j in range(10**5):
        comp=ldp[i-1][j+1-lwv[i][1]-1]+lwv[i][0] if j+1-lwv[i][1]>0 else lwv[i][0]
        ldp[i][j]=min(ldp[i-1][j],comp)
for j in range(10**5-1,-1,-1):
    if ldp[N-1][j]<=W:
        print(j+1)
        break


### FIXED CODE ###

N,W=map(int,input().split())
lw=[]
lv=[]
for i in range(N):
    w,v=map(int,input().split())
    lw.append(w)
    lv.append(v)
ldp=[[float("inf") for j in range(10**5)] for i in range(N)]
for j in range(10**5):
    if lv[0]>=j+1:
        ldp[0][j]=lw[0]
for i in range(1,N):
    for j in range(10**5):
        ldp[i][j]=min(ldp[i-1][j],ldp[i-1][j+1-lv[i]-1]+lw[i] if j+1-lv[i]>0 else lw[i])
for j in range(10**5-1,-1,-1):
    if ldp[N-1][j]<=W:
        print(j+1)
        break
### BUGGY CODE ###

from heapq import heappush, heappop


def main():

    def f(hi, wi):
        return hi * w + wi


    h, w = map(int, input().split())
    sh, sw = map(int, input().split())
    gh, gw = map(int, input().split())
    s = [input() for _ in range(h)]
    INF = 10 ** 9

    sh -= 1
    sw -= 1
    gh -= 1
    gw -= 1

    hp = [[0, f(sh, sw)]]
    dist = [[INF] * w for _ in range(h)]
    dist[sh][sw] = 0

    while hp:
        d, i = heappop(hp)
        hi, wi = divmod(i, w)

        if d != dist[hi][wi]:
            continue

        for dh in range(-2, 3):
            for dw in range(-2, 3):
                nh = hi + dh
                nw = wi + dw
                if 0 <= nh <= h - 1 and 0 <= nw <= w - 1 and s[nh][nw] == ".":
                    if abs(dh) + abs(dw) == 1:
                        cost = 0
                    else:
                        cost = 1

                    dist_now = d + cost
                    if dist_now < dist[nh][nw]:
                        dist[nh][nw] = dist_now
                        heappush(hp, [dist_now, f(nh, nw)])

    ans = dist[gh][gw]
    if ans == INF:
        ans = -1
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque


def main():

    def f(hi, wi):
        return hi * w + wi

    h, w = map(int, input().split())
    sh, sw = map(int, input().split())
    gh, gw = map(int, input().split())

    s = [input() for _ in range(h)]
    INF = 10 ** 9

    sh -= 1
    sw -= 1
    gh -= 1
    gw -= 1

    dq = deque([f(sh, sw)])
    dist = [[INF] * w for _ in range(h)]
    dist[sh][sw] = 0

    while dq:
        i = dq.popleft()
        hi, wi = divmod(i, w)

        for dh in range(-2, 3):
            for dw in range(-2, 3):
                if dh == 0 and dw == 0:
                    continue
                nh = hi + dh
                nw = wi + dw
                if 0 <= nh <= h - 1 and 0 <= nw <= w - 1 and s[nh][nw] == ".":
                    if abs(dh) + abs(dw) == 1:
                        if dist[hi][wi] < dist[nh][nw]:
                            dist[nh][nw] = dist[hi][wi]
                            dq.appendleft(f(nh, nw))
                    else:
                        if dist[hi][wi] + 1 < dist[nh][nw]:
                            dist[nh][nw] = dist[hi][wi] + 1
                            dq.append(f(nh, nw))

    ans = dist[gh][gw]
    if ans == INF:
        ans = -1

    print(ans)


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

N, W = map(int, input().split())

weight = [None] * N
value  = [None] * N

for i in range(N):
    w, v = map(int, input().split())
    weight[i] = w
    value[i]  = v

dp = [[None] * (W+1) for _ in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0
for v in range(N):
    for w in range(W+1):
        if w >= weight[v]:
            dp[v+1][w] = max(dp[v][w-weight[v]] + value[v], dp[v][w])
        else:
            dp[v+1][w] = dp[v][w]
print(dp[N][W])


### FIXED CODE ###

N, W = map(int, input().split())

weight = [None] * N
value  = [None] * N

for i in range(N):
    w, v = map(int, input().split())
    weight[i] = w
    value[i]  = v

dp = [[None] * (W+1) for _ in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0
for v in range(N):
    for w in range(W+1):
        if w >= weight[v]:
            dp[v+1][w] = max(dp[v][w-weight[v]] + value[v], dp[v][w])
        else:
            dp[v+1][w] = dp[v][w]
print(dp[N][W])
### BUGGY CODE ###

C, K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]

tmp = 1

for i in range(K):
  tmp = A[i] * tmp

for i in range(K,C):
  tmp_tmp = (tmp / A[i-K]) * A[i]
  if tmp < tmp_tmp:
    print("Yes")
  else:
    print("No")
  tmp = tmp_tmp



### FIXED CODE ###

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

for i in range(N-K):
  if A[K+i] > A[i]:
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

from math import gcd
N = int(input())
A = list(map(int,input().split()))

def solve():
    g = 0
    for a in A:
        g = gcd(g,a)
    if g > 1:
        print('not coprime')
        exit()

    from collections import Counter
    def factorize(n):
        d = Counter()
        m = 2
        while m*m <= n:
            while n%m == 0:
                n //= m
                d[m] += 1
            m += 1
        if n > 1:
            d[n] += 1
        return d

    ctr = Counter()
    for a in A:
        fac = factorize(a)
        if fac & ctr:
            print('setwise coprime')
            exit()
        ctr |= fac
    print('pairwise coprime')
solve()

### FIXED CODE ###

from math import gcd
N = int(input())
A = list(map(int,input().split()))

g = 0
for a in A:
    g = gcd(g,a)
if g > 1:
    print('not coprime')
    exit()

sa = set()
for a in A:
    if a==1: continue
    if a in sa:
        print('setwise coprime')
        exit()
    sa.add(a)

MAXN = 10**6+10
sieve = [0,0] + [1]*MAXN
p = 2
small_primes = []
while p*p <= MAXN:
    if sieve[p]:
        small_primes.append(p)
        for q in range(2*p,MAXN+1,p):
            sieve[q] = 0
    p += 1

st = set()
for a in A:
    for p in small_primes:
        found = False
        while a%p==0:
            a //= p
            found = True
        if found:
            if p in st:
                print('setwise coprime')
                exit()
            st.add(p)
        if a==1: break
    else:
        if a in st:
            print('setwise coprime')
            exit()
        st.add(a)

print('pairwise coprime')
### BUGGY CODE ###

n = int(input())
ls = list(map(int,input().split()))
ans = 1
for i in range(n):
    ans *= ls[i]
if ans <= 10 ** 18:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

n = int(input())
ls = list(map(int,input().split()))
ans = 1
if 0 in ls:
    print(0)
else:
    for i in range(n):
        ans *= ls[i]
        if ans > 10 ** 18:
            print(-1)
            break
    if ans <= 10 ** 18:
        print(ans)
### BUGGY CODE ###

from collections import deque


class Dinic:
    def __init__(self, n):
        self.n = n
        self.links = [[] for _ in range(n)]
        self.depth = None
        self.progress = None

    def add_link(self, _from, to, cap):
        self.links[_from].append([cap, to, len(self.links[to])])
        self.links[to].append([0, _from, len(self.links[_from]) - 1])

    def bfs(self, s):
        depth = [-1] * self.n
        depth[s] = 0
        q = deque([s])
        while q:
            v = q.popleft()
            for cap, to, rev in self.links[v]:
                if cap > 0 and depth[to] < 0:
                    depth[to] = depth[v] + 1
                    q.append(to)
        self.depth = depth

    def dfs(self, v, t, flow):
        if v == t:
            return flow
        links_v = self.links[v]
        for i in range(self.progress[v], len(links_v)):
            self.progress[v] = i
            cap, to, rev = link = links_v[i]
            if cap == 0 or self.depth[v] >= self.depth[to]:
                continue
            d = self.dfs(to, t, min(flow, cap))
            if d == 0:
                continue
            link[0] -= d
            self.links[to][rev][0] += d
            return d
        return 0

    def max_flow(self, s, t):
        flow = 0
        while True:
            self.bfs(s)
            if self.depth[t] < 0:
                return flow
            self.progress = [0] * self.n
            current_flow = self.dfs(s, t, float('inf'))
            while current_flow > 0:
                flow += current_flow
                current_flow = self.dfs(s, t, float('inf'))


n, a, b = map(int, input().split())
aaa = list(map(int, input().split()))
mf = Dinic(2 * n + 2)
t = 2 * n + 1
for i in range(1, n + 1):
    mf.add_link(0, i, b)
    mf.add_link(n + i, t, a)
INF = 10 ** 18
for i in range(n):
    r = aaa[i]
    for l in reversed(aaa[:i]):
        if l > r:
            mf.add_link(r, l + n, INF)
        if l + 1 == r:
            mf.add_link(r, l, INF)
            break
print(mf.max_flow(0, t))


### FIXED CODE ###

from bisect import bisect
from operator import itemgetter

n, a, b = map(int, input().split())
ppp = map(int, input().split())
qqq = [i for i, p in sorted(enumerate(ppp, start=1), key=itemgetter(1))]
INF = 10 ** 15

dp = [(0, 0)]
for i in qqq:
    ndp = []
    s = bisect(dp, (i,))
    tmp_min = INF
    for j, cost in dp[:s]:
        cost += b
        ndp.append((j, cost))
        tmp_min = cost
    stay_cost = dp[s - 1][1]
    if tmp_min > stay_cost:
        ndp.append((i, stay_cost))
        tmp_min = stay_cost
    for j, cost in dp[s:]:
        cost += a
        if tmp_min > cost:
            ndp.append((j, cost))
            tmp_min = cost
    dp = ndp

print(dp[-1][1])
### BUGGY CODE ###

import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = read().decode().rstrip()

l = 0
r = 0

cnt = 0
while l < len(S):
    r = l
    while r < len(S):
        acc = S[l:r + 1]
        if int(acc) % 2019 == 0:
            cnt += 1
        r += 1
    l += 1

print(cnt)


### FIXED CODE ###

import sys
from collections import Counter, defaultdict
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = read().decode().rstrip()

reminders = defaultdict(lambda: 0)
tmp = 0
mul = 1

for c in S[::-1]:
    c = int(c)
    tmp = (tmp + c * mul) % 2019
    mul = mul * 10 % 2019
    reminders[tmp] += 1
reminders[0] += 1

ans = 0

for r, cnt in reminders.items():
    ans += cnt * (cnt - 1) // 2

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

import sys
from collections import defaultdict, deque
input = sys.stdin.readline
N, M = map(int, input().split())
guidepost = [None] * N
distance = [0] + [10**9] * (N - 1)
dd = defaultdict(list)
for _ in range(M):
    a, b = map(int, input().split())
    dd[a].append(b)
    dd[b].append(a)
stack = deque([1])
checked = [False] * N
while len(stack) >= 1:
    i = stack.popleft()
    checked[i - 1] = True
    for j in dd[i]:
        distance[j - 1] = min(distance[j - 1], distance[i - 1] + 1)
        if guidepost[j - 1] is None:
            guidepost[j - 1] = i
        elif distance[guidepost[j - 1] - 1] > distance[i - 1]:
            guidepost[j - 1] = i
        if not checked[j - 1]:
            stack.append(j)
print('Yes')
for i in range(1, N):
    print(guidepost[i])

### FIXED CODE ###

import sys
from collections import defaultdict, deque
input = sys.stdin.readline
N, M = map(int, input().split())
guidepost = [None] * N
distance = [0] + [10**9] * (N - 1)
dd = defaultdict(list)
for _ in range(M):
    a, b = map(int, input().split())
    dd[a].append(b)
    dd[b].append(a)
stack = deque([1])
checked = [False] * N
while len(stack) >= 1:
    i = stack.popleft()
    if checked[i - 1]:
        continue
    checked[i - 1] = True
    for j in dd[i]:
        distance[j - 1] = min(distance[j - 1], distance[i - 1] + 1)
        if guidepost[j - 1] is None:
            guidepost[j - 1] = i
        elif distance[guidepost[j - 1] - 1] > distance[i - 1]:
            guidepost[j - 1] = i
        if not checked[j - 1]:
            stack.append(j)
print('Yes')
# join?
# for i in range(1, N):
#     print(guidepost[i])
print('\n'.join([str(guidepost[i]) for i in range(1, N)]))
### BUGGY CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)

# ax ≡ 1 (mod m)
def modinv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m



def modfact(n,N):
    r = 1
    for i in range(1,n+1):
        r = r % N * i % N
    return r


def modconb(n,r,N):
    p = modfact(n,N)
    q1 = modinv(modfact(r,N),N)
    q2 = modinv(modfact(n-r,N),N)
    return p*q1%N*q2%N

N = 10**9+7
n = int(input())
a = list(map(int,input().split()))
b=[0]*n
for i in range(n+1):
    b[a[i]-1] += 1
w = b.index(2)+1
index = []
for i in range(n+1):
    if a[i] == w:
        index.append(i)
l = index[0]
r = n - index[1]

for i in range(n+1):
    ans = modconb(n+1,i+1,N)
    if l+r >= i:
        ans -= modconb(l+r,i,N)
    print(ans)

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)

N = 10**9+7
R = 10**5+10
modfact = [0]*(R+1)
def modfact_memo(n,N):
    r = 1
    modfact[0] = 1
    for i in range(1,n+1):
        r = r % N * i % N
        modfact[i] = r
modfact_memo(R,N)

# ax ≡ 1 (mod m)
modinv=[0]*(R+1)
def modinv_memo(a,m):
    for i in range(a+1):
        j = modfact[i]
        (inv, q, gcd_val) = egcd(j, m)
        modinv[i] = inv % m
modinv_memo(R,N)

def modconb(n,r,N):
    p = modfact[n]
    q1 = modinv[r]
    q2 = modinv[n-r]
    return p*q1%N*q2%N


n = int(input())
a = list(map(int,input().split()))
b=[0]*n
for i in range(n+1):
    b[a[i]-1] += 1
w = b.index(2)+1
index = []
for i in range(n+1):
    if a[i] == w:
        index.append(i)
l = index[0]
r = n - index[1]

for i in range(n+1):
    ans = modconb(n+1,i+1,N)
    if l+r >= i:
        ans -= modconb(l+r,i,N)
        ans %= N
    print(ans)
### BUGGY CODE ###

n = int(input())
tmp = list(map(int, input().split()))
ans = 0
a = sorted(tmp)
if n == 1:
    print(1)
    exit()
if a[0] == 1:
    if a[1] == 1:
        print(0)
        exit()
    else:
        print(1)
        exit()
double = set(a)
for i in double:
    if not tmp.count(i) == 1:
        ans -= tmp.count(i)

# a.sort()


check = True
loop = list(range(len(a)))
for i in loop:
    for j in range(0, i):
        if a[j]*2 > a[i]:
            break
        if i == j:
            continue
        if a[i]%a[j] == 0:
            check = False
            break

    if check:
        ans += 1
        # print(i)
    check = True

print(ans)


### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a.sort()
c = Counter(a)
m = max(a) + 1
dp = [False]*m
ans = 0
for ai in a:
    if dp[ai]:
        continue
    if c[ai] == 1:
        ans += 1
    for i in range(ai, m, ai):
        dp[i] = True
print(ans)
### BUGGY CODE ###

import math
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
maxconb=0
ans=[0,0]

def comb(a,b):
    return math.factorial(a)//(math.factorial(a-b) * math.factorial(b))

def mid(a):
    if(a%2!=0):
        return (a+1)//2
    else:
        return a//2
#print(a)
for i in range(n-1):
    ai=a[i]
    temp=list(map(lambda x:abs(x-mid(ai)),a[i+1:]))
#    print(temp)
    bi=a[temp.index(min(temp))+i+1]
#    print(str(ai)+":"+str(bi))
    c=comb(ai,bi)
    if(maxconb<c):
        maxconb=c
        ans=[ai,bi]
print(str(ans[0])+" "+str(ans[1]))

### FIXED CODE ###

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

def mid(a):
    if(a%2!=0):
        return (a+1)//2
    else:
        return a//2

ai=a[0]
temp=list(map(lambda x:abs(x-mid(ai)),a[1:]))
bi=a[temp.index(min(temp))+1]
print(str(ai)+" "+str(bi))
### BUGGY CODE ###

from heapq import heappop, heappush 
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()

    
    def dijkstra():
        def toId(x, y, v): return (x*(w+2)+y)*4 + v

        def modCeil(x): return x + (-x)%k

        def push(x, y, v, cost):
            nId = toId(x, y, v)
            if dp[nId] > cost:
                dp[nId] = cost
                heappush(que, (cost, nId))

        inf = 1e18

        dp = [inf]*(h+2)*(w+2)*4
        dp[toId(xs, ys, 0)] = 0

        que = [(0, toId(xs, ys, 0))]
        dx = [-1, 0, 1, 0]
        dy = [0, 1, 0, -1]
        while que:
            cost, Id = heappop(que)
            x = Id//4//(w+2)
            y = Id//4%(w+2)
            v = Id%4

            if cost > dp[Id]:
                continue
            
            for nv in range(4):
                push(x, y, nv, modCeil(cost))
            
            nx, ny = x+dx[v], y+dy[v]
            if field[nx][ny] == '.':
                push(nx, ny, v, cost+1)

        ans = inf
        for v in range(4):
            ans = min(ans, dp[toId(xg, yg, v)])
        if ans == inf:     
            return -1
        return modCeil(ans)//k

    h, w, k = map(int, input().split())
    xs, ys, xg, yg = map(int, input().split())
    field = ['@'*(w+2)]
    for _ in range(h):
        field.append('@'+input()+'@')
    field.append('@'*(w+2))
    ans = dijkstra()
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
from collections import deque
def input(): return sys.stdin.readline().rstrip()

def main():
    
    h, w, k = map(int, input().split())
    xs, ys, xg, yg = map(lambda x: int(x)-1, input().split())
    field = [input() for _ in range(h)]

    inf = 1e7

    dist = [[inf]*w for _ in range(h)]
    dist[xs][ys] = 0
    que = deque([(xs, ys)])
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]
    while que:
        x, y = que.popleft()
        for i in range(4):
            nx, ny = x, y
            for _ in range(k):
                nx += dx[i]
                ny += dy[i]
                if nx < 0 or nx >= h or ny < 0 or ny >= w: break
                if field[nx][ny] == '@' or dist[nx][ny] <= dist[x][y]: break
                if dist[nx][ny] > dist[x][y] + 1:
                    dist[nx][ny] = dist[x][y] + 1
                    que.append((nx, ny))
        
    if dist[xg][yg] == inf:
        print(-1)
    else:
        print(dist[xg][yg])
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N,W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]

dp = [[0 for _ in range(W+1)] for _ in range(N+1)] 

dp[0][0] = 0

for i in range(N):
    weight = wv[i][0]
    for j in range(W+1):
        dp[i+1][j] = dp[i][j]
        if j >= weight:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight] + wv[i][1])
print(dp[N][W])

### FIXED CODE ###

N,W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]

dp = [[0 for _ in range(W+1)] for _ in range(N+1)] 

dp[0][0] = 0

for i in range(N):
    weight = wv[i][0]
    for j in range(W+1):
        dp[i+1][j] = dp[i][j]
        if j >= weight:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight] + wv[i][1])
print(dp[N][W])
### BUGGY CODE ###


import sys
sys.setrecursionlimit(10000000)
H,W,D=map(int,input().split())

dic={}
A=[]
for h in range(H):
    A.append(list(map(int,input().split())))
    for w in range(W):
        dic[A[h][w]]=[h,w]

Q=int(input())

c=[[-1]*(H*W+1) for _ in range(H*W+1)]

for i in range(H*W+1):
    c[i][i]=0

def rec(a,b):
    if c[a][b]!=-1:
        return c[a][b]
    y,x=dic[a]
    ny,nx=dic[a+D]
    ret=abs(y-ny)+abs(x-nx)+rec(a+D,b)
    c[a][b]=ret
    return ret

for i in range(Q):
    L,R=map(int,input().split())
    ans=rec(L,R)
    print(ans)

### FIXED CODE ###

H,W,D=map(int,input().split())
A=[]

for h in range(H):
    A.append(list(map(int,input().split())))

pos= {}
for h in range(H):
    for w in range(W):
        pos[A[h][w]]=[h,w]

S=[0]*(H*W)
for d in range(D):
    tmp=0
    now=d+1
    while now+D<=H*W:
        nowh,noww=pos[now]
        newh,neww=pos[now+D]
        tmp+=abs(nowh-newh)+abs(noww-neww)
        S[now+D-1]=tmp
        now+=D

Q=int(input())
for i in range(Q):
    L,R=map(int,input().split())
    ans=S[R-1]-S[L-1]
    print(ans)
### BUGGY CODE ###

num = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
cnt = 0
for i in range(num):
  sets = len(make_divisors(i))
  cnt+=sets

print(cnt)

### FIXED CODE ###

num = int(input())

def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
  
cnt = 0

print(sum(num_divisors_table(num)[:-1]))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
aset = set(a)
b = []
c = []
for i in aset:
    if a.count(i)>1:
        b.append(i)
    
    if a.count(i)>3:
        c.append(i)
b.sort()
c.sort()
m = len(b)
if m<2:
    if len(c)<1:
        print(0)
    else:
        print(c[-1]*c[-1])
else:
    if len(c)<1:
        print(b[-1]*b[-2])
    else:
        ans = max(b[-2]*b[-1],c[-1]*c[-1])
        print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
i = 1
j = 1
l = []
while i<n:
    if a[i]==a[i-1]:
        l.append(a[i])
        i+=2
    else:
        i+=1
l.append(0)
l.append(0)
print(l[0]*l[1])
### BUGGY CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[15]:


from collections import deque


# In[9]:


N,M = map(int, input().split())
alist = []
for _ in range(M):
    alist.append(int(input()))


# In[18]:


dp = deque([0]*2)
dp[0] = 1
ans = 0
mod = 1000000007
if N == 1:
    ans = 1
else:
    if 1 in alist:
        dp[1] = 0
    else:
        dp[1] = 1
    for i in range(2,N+1):
        dp.append((dp[i-1] + dp[i-2])%mod)
        if i in alist:
            dp[-1] = 0
        dp.popleft
    ans = dp[-1]
print(ans)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[15]:


from collections import deque


# In[38]:


N,M = map(int, input().split())
alist = [False]*N
for _ in range(M):
    alist[int(input())-1] = True


# In[41]:


dp = deque([0]*2)
dp[0] = 1
ans = 0
mod = 10**9+7
if N == 1:
    ans = 1
else:
    if alist[0]:
        dp[1] = 0
    else:
        dp[1] = 1
    for i in range(2,N+1):
        if alist[i-1]:
            dp.append(0)
        else:
            dp.append((dp[0]+dp[1])%mod)
        dp.popleft()
    ans = dp[-1]
print(ans)


# In[ ]: