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

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
#print(a)
lm = [0]
rm = [0]

for i in range(n-1):
    lm.append(max(a[i], lm[i]))

for i in range(n-1, 0, -1):
    rm.insert(0, (max(a[i], rm[n-i-1])))

#print(lm)
#print(rm)

for i in range(n):
    print(max(lm[i], rm[i]))

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
#print(a)
lm = [0] * n
rm = [0] * n

for i in range(1, n):
    lm[i] = max(a[i-1], lm[i-1])

for i in range(n-2, -1, -1):
    rm[i] = max(a[i+1], rm[i+1])


for i in range(n):
    print(max(lm[i], rm[i]))
### BUGGY CODE ###

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


def main():
    # 再帰関数を使うときは，その上限回数に注意
    # https://docs.python.org/ja/3/library/sys.html#sys.setrecursionlimit
    from sys import setrecursionlimit

    setrecursionlimit(5 * 10 ** 7)

    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    memo = [[-1 for _ in range(3)] for _ in range(k + 1)]

    def rec(i, j):
        if memo[i][j] != -1:
            return memo[i][j]

        result = 0

        for ak in a:
            if ak <= i:
                if rec(i - ak, (j + 1) % 2) == 0:
                    result = 1
                    break

        memo[i][j] = result

        return memo[i][j]

    ans = rec(k, 0)

    if ans == 1:
        print('First')
    else:
        print('Second')


if __name__ == '__main__':
    main()


### FIXED CODE ###

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


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [0 for _ in range(k + 1)]

    # See:
    # https://atcoder.jp/contests/dp/submissions/3956066
    for i in range(k):
        if dp[i]:
            continue

        for ai in a:
            if i + ai > k:
                break

            dp[i + ai] = 1

    if dp[-1] == 1:
        print('First')
    else:
        print('Second')


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

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

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

# dp[i, w]:  i-r achaag oroltsuulaad , 
#            w hurtelh achaatai max value
# dp[i]: w1 ,,,,,wN

dp = [ {} for i in range(N)]

def DP(i, Wi):
  if Wi in dp[i]:
    return dp[i][Wi]

  if i == 0:
    if Wi >= w[i]:
      dp[i][Wi] = v[i]
    else:
      dp[i][Wi] = 0
    return dp[i][Wi]
  
  vmax = DP(i - 1, Wi)
  if Wi >= w[i]:
    vmax = max(vmax, v[i] + DP(i - 1, Wi - w[i]))
  dp[i][Wi] = vmax
  return dp[i][Wi]

print(DP(N - 1, W))


### FIXED CODE ###

import numpy as np 

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

w_all = np.zeros(W + 1, dtype=int)

for i in range(N):
  w, v = map(int, input().split())
  w_all[w:] = np.maximum(w_all[w:], w_all[:-w] + v)

print(w_all[W])
### BUGGY CODE ###

if __name__ == "__main__":

    h,w = list(map(int,input().split()))

    q = []
    reached = [[True]*(w+2)]
    for i in range(1, h+1):
      reached.append([True] + [s == '#' for s in list(input())] + [True])
      for j in range(1,w+1):
        if reached[i][j]: q.append((i,j))
    reached.append([True]*(w+2))

    res = 0
    while 1:
      qq = []
      for k,l in q:
        if not reached[k+1][l]:
          qq.append((k+1, l))
          reached[k+1][l] = True
        if not reached[k][l+1]:
          qq.append((k, l+1))
          reached[k][l+1] = True
        if not reached[k-1][l]:
          qq.append((k-1, l))
          reached[k-1][l] = True
        if not reached[k][l-1]:
          qq.append((k, l-1))
          reached[k][l-1] = True
      if len(qq) == 0:
        break
      else:
        pass
      
      q = qq
      res += 1

    print(res)


### FIXED CODE ###

def main():
  h,w = map(int,input().split())

  q = []
  reached = [[True]*(w+2)]
  for i in range(1, h+1):
    reached.append([True] + [s == '#' for s in list(input())] + [True])
    for j in range(1,w+1):
      if reached[i][j]: q.append((i,j))
  reached.append([True]*(w+2))

  res = 0
  for i in range(100000000):
    qq = []
    for k,l in q:
      if not reached[k+1][l]:
        qq.append((k+1, l))
        reached[k+1][l] = True
      if not reached[k][l+1]:
        qq.append((k, l+1))
        reached[k][l+1] = True
      if not reached[k-1][l]:
        qq.append((k-1, l))
        reached[k-1][l] = True
      if not reached[k][l-1]:
        qq.append((k, l-1))
        reached[k][l-1] = True
    if len(qq) == 0:
      break
    else:
      pass

    q = qq
    res += 1

  print(res)
  return 0

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

from collections import defaultdict
from operator import itemgetter
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = 1000
for n in range(2**N):
    n = bin(n)[2:]
    if n.count('1')%2!=0:
        continue
    n = '0'*(N-len(n))+n
    l = []
    for i in range(N):
        if n[i]=='0':
            l.append([A[i],i])
        else:
            l.append([B[i],i+1])
    inversion = 0
    for i in range(N):
        if inversion>=ans:
            break
        for j in range(i+1,N):
            if l[i][0]>l[j][0]:
                inversion += 1
    if inversion>=ans:
        continue
    l.sort(key=itemgetter(0,1))
    d = defaultdict(list)
    for i in range(N):
        v,j = l[i]
        if (i-j)%2==1:
            d[v].append(i)
    possible = True
    for v in d:
        if len(d[v])%2==1:
            possible = False
        else:
            for i in range(len(d[v])//2):
                if (d[v][2*i+1]-d[v][2*i])%2==1:
                    inversion += d[v][2*i+1]-d[v][2*i]
                else:
                    possible = False
                    break
        if not possible:
            break
    if possible:
        ans = min(ans,inversion)

if ans == 1000:
    ans = -1
print(ans)

### FIXED CODE ###

from collections import defaultdict
from operator import itemgetter
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

ans = 1000
for n in range(2**N):
    n = bin(n)[2:]
    if n.count('1')%2!=0:
        continue
    n = '0'*(N-len(n))+n
    l = []
    for i in range(N):
        if n[i]=='0':
            l.append([A[i],i])
        else:
            l.append([B[i],i+1])
    inversion = 0
    for i in range(N):
        if inversion>=ans:
            break
        for j in range(i+1,N):
            if l[i][0]>l[j][0]:
                inversion += 1
    if inversion>=ans:
        continue
    l.sort(key=itemgetter(0))
    d = defaultdict(list)
    for i in range(N):
        v,j = l[i]
        if (i-j)%2==1:
            d[v].append(i)
    possible = True
    for v in d:
        if len(d[v])%2==1:
            possible = False
        else:
            for i in range(len(d[v])//2):
                if (d[v][2*i+1]-d[v][2*i])%2==1:
                    inversion += d[v][2*i+1]-d[v][2*i]
                else:
                    possible = False
                    break
        if not possible:
            break
    if possible:
        ans = min(ans,inversion)

if ans == 1000:
    ans = -1
print(ans)
### BUGGY CODE ###

import sys, heapq, bisect, math, fractions
from collections import deque
from collections import Counter
from collections import OrderedDict

N = int(input())

left = 0
right = N - 1
mid = 0

print(left, flush=True)
l = input()
if l == "Vacant":
    exit()
    
print(right, flush=True)
r = input()
if r == "Vacant":
    exit()

while left + 1 != right:
    mid = (r + l) // 2
    print(mid, flush=True)
    m = input()
    if m == "Vacant":
        exit()
        
    if (mid - left) % 2 == 0 and l != m or (mid - left) % 2 == 1 and l == m:
        right = mid
    else:
        left = mid


### FIXED CODE ###

import sys, heapq, bisect, math, fractions
from collections import deque
from collections import Counter
from collections import OrderedDict

N = int(input())

left = 0
right = N - 1
mid = 0

print(left, flush=True)
l = input()
if l == "Vacant":
    exit()
    
print(right, flush=True)
r = input()
if r == "Vacant":
    exit()

while left + 1 != right:
    mid = (right + left) // 2
    print(mid, flush=True)
    m = input()
    if m == "Vacant":
        exit()
        
    if ((mid - left) % 2 == 0 and l != m) or ((mid - left) % 2 == 1 and l == m):
        right = mid
        r = m
    else:
        left = mid
        l = m
### BUGGY CODE ###

k,s = map(int, input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                ans+=1
print(ans)

### FIXED CODE ###

k,s = map(int, input().split())
ans=0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0<=z and z<=k:
            ans+=1
print(ans)
### BUGGY CODE ###

n=int(input())
s_list=[''.join(sorted(input())) for _ in range(n)]
c = 0
s_list_exist = []
for s in s_list:
  c_contain = s_list.count(s)
  if not s in s_list_exist and c_contain != 1:
    c += c_contain * (c_contain-1) // 2
    s_list_exist.append(s)
print(c)

### FIXED CODE ###

n=int(input())
s_list=[''.join(sorted(input())) for i in range(n)]
c = 0
words = {}
for s in s_list:
  time = words.get(s,0)
  c += time
  words[s] = time + 1
print(c)
### BUGGY CODE ###

import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
R = 10**9 + 7
DBG = True  and False
def ddprint(x):
  if DBG:
    print(x)

# extended gcd and modinv
# x = y*(x/y) + x%y
#   ->  g = ax+by = a(y*(x/y) + x%y) + by
#         = (a*(x/y) + b)*y + a*(x%y)
#
# while  g=ax+by, b==0  ->  g=x, a=1

def exgcd(x,y):
    if y == 0:
        return (x,1,0)
    else:
        g,b,a = exgcd(y, x%y)
        return (g, a, b-(x//y)*a)

# return y s.t. x*y mod p == 1
def modinv(x,p):
    g,a,b = exgcd(x,p)  # ax+bp = g, g=1 if mutually prime
    return a%p

def rmod(i,qb,qw):
    numer = 2**i - qb + qw
    denom = 2**(i+1)
    iden = modinv(denom, R)
    ddprint("num {} den {} idn {}".format(numer, denom, iden))
    return (numer*iden)%R

b,w = inm()
ddprint("b {} w {}".format(b,w))
cb = cw = 1
qb = qw = 0
print(500000004)
for i in range(1,b+w):
    qb = 0 if i<b else 1 if i==b else (2*qb+cb)
    qw = 0 if i<w else 1 if i==w else (2*qw+cw)
    cb = 1 if i<b else (cb*i)//(i-b+1)
    cw = 1 if i<w else (cw*i)//(i-w+1)
    ddprint("i {} cb {} cw {} qb {} qw {}".format(i,cb,cw,qb,qw))
    print(rmod(i,qb,qw))


### FIXED CODE ###

inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
R = 10**9 + 7
DBG = True  and False
def ddprint(x):
  if DBG:
    print(x)

# extended gcd and modinv
# x = y*(x/y) + x%y
#   ->  g = ax+by = a(y*(x/y) + x%y) + by
#         = (a*(x/y) + b)*y + a*(x%y)
#
# while  g=ax+by, b==0  ->  g=x, a=1

def exgcd(x,y):
    if y == 0:
        return (x,1,0)
    else:
        g,b,a = exgcd(y, x%y)
        return (g, a, b-(x//y)*a)

# return y s.t. x*y mod p == 1
def modinv(x,p):
    g,a,b = exgcd(x,p)  # ax+bp = g, g=1 if mutually prime
    return a%p

def pw(x,e):
    if e==0:
        return 1
    elif e%2==0:
        return (pw(x,e//2)**2)%R
    else:
        return (x * pw(x,e//2)**2)%R

def rmod(i,qb,qw):
    global two2i, itwo2i
    numer = (two2i[i] - qb + qw)
    iden = itwo2i[i+1]
    ddprint("num {} idn {}".format(numer, iden))
    return (numer*iden)%R

b,w = inm()
ddprint("b {} w {}".format(b,w))

inv2 = modinv(2,R)
fact = [1] * (b+w+2)
for i in range(2,b+w+1):
    fact[i] = (i*fact[i-1])%R
ifact = [1] * (b+w+2)
ifact[b+w] = modinv(fact[b+w],R)
for i in range(b+w-1,0,-1):
    ifact[i] = ((i+1)*ifact[i+1])%R
two2i = [1] * (b+w+2)
itwo2i = [1] * (b+w+2)
itwo2i[1] = inv2
for i in range(1,b+w+1):
    x = (2*two2i[i-1])
    two2i[i] = x if x < R else x-R
    itwo2i[i] = (inv2*itwo2i[i-1]) % R
ddprint(fact[0:5])
ddprint(ifact[0:5])

cb = cw = 1
qb = qw = 0
print(500000004)
for i in range(1,b+w):
    qb = 0 if i<b else 1 if i==b else (2*qb+cb) % R
    qw = 0 if i<w else 1 if i==w else (2*qw+cw) % R
    cb = 1 if i<b else (fact[i]*ifact[b-1]*ifact[i-b+1]) % R
    cw = 1 if i<w else (fact[i]*ifact[w-1]*ifact[i-w+1]) % R
    ddprint("i {} cb {} cw {} qb {} qw {}".format(i,cb,cw,qb,qw))
    print(rmod(i,qb,qw))
### BUGGY CODE ###

from collections import deque
import sys
input=sys.stdin.readline

def Graph(ab):
    G=[[] for i in range(n)]
    for a,b in ab:
        G[a-1].append(b)
        G[b-1].append(a)
    return G

def DFS(G,v,p):
    log=[False]*n
    log[v-1]=True
    q=deque()
    q.append((v,p))
    ans=0
    while q:
        V,P=q[-1]
        for new_v in G[V-1]:
            if new_v==P:continue
            if log[new_v-1]==True:continue
            log[new_v-1]=True
            if new_v not in friend[v-1] and new_v not in block[v-1]:
                ans+=1
            q.append((new_v,V))
            break
        else:
            q.pop()

    return ans

n,m,k=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
cd=[list(map(int,input().split())) for i in range(k)]


friend=Graph(ab)
block=Graph(cd)
#print(friend,block,sep='\n')

ans=[]
for i in range(n):
    ans.append(DFS(friend,i+1,-1))

print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
class UnionFind:
    def __init__(self, n):
        # 親要素のノード番号を格納
        # par[x]=xの時そのノードは根　
        self.par = [-1] * n
        # rank
        self.size = [1] * n

    def find(self, x):
        # 根の番号を返す(所属する集合を確認する)
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def check(self, x, y):
        # x,yが同じ集合に属するかどうか調べる
        return self.find(x) == self.find(y)


    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)
        if x == y:return
        self.par[y]=x
        self.size[x]+=self.size[y]

import sys
input=sys.stdin.readline
n,m,k=map(int,input().split())
uf=UnionFind(n)
out=[[] for i in range(n)]

for i in range(m):
    a,b=map(int,input().split())
    uf.union(a-1,b-1)
    out[a-1].append(b-1)
    out[b-1].append(a-1)

for i in range(k):
    c,d=map(int,input().split())
    if uf.check(c-1,d-1):
        out[c-1].append(d-1)
        out[d-1].append(c-1)

for i in range(n):
    ans=uf.size[uf.find(i)]-1-len(out[i])
    print(ans,end=' ')
### BUGGY CODE ###

L = input()
n1 = L.count('1')

m=0
d=[]
for i, c in enumerate(reversed(L)):
    if c=='1':
        m+=1
        d.append((i, n1-m))
	
s = 2**n1
for dd in d:
    s += 3**dd[0] * 2**dd[1]

mod = 10**9+7
print(s % mod)

### FIXED CODE ###

def modpow(a, n, mod):
    res=1
    while n>0:
        if n & 1:
            res = res * a % mod
        n = n>>1
        a = a * a % mod
    return res


L = input()
n1 = L.count('1')

m=0
d=[]
for i, c in enumerate(reversed(L)):
    if c=='1':
        m+=1
        d.append((i, n1-m))

mod = 10**9+7
s = modpow(2, n1, mod)
for dd in d:
    s += (modpow(3,dd[0],mod) * modpow(2,dd[1],mod)) % mod

print(s % mod)
### BUGGY CODE ###

N,HP=map(int,input().split())
listK=[]
listN=[]

for i in range(N):
    k,n=map(int,input().split())
    listK.append(k)
    listN.append(n)
list1=[]
for j in range(N):
    if listN[j]>=max(listK):
        list1.append(listN[j])
        
list1.sort(reverse=True)

if HP<=sum(list1):
    cnt=0
    for x in range(len(list1)):
        HP=HP-list1[x]
        cnt+=1
        if HP<=0:
            print(cnt)
            exit()
else:
    HP=HP-sum(list1)
    cnt=len(list1)
    if HP%max(listK)==0:
        print(int(cnt+HP/(max(listK))))
    else:
        print(int(cnt+HP/(max(listK)))+1)

### FIXED CODE ###

n,h=map(int,input().split())
slash=[]
throw=[]
for i in range(n):
    x,y=map(int,input().split())
    slash.append(x)
    throw.append(y)
 
slash.sort(reverse=True)
throw.sort(reverse=True)
attack=0
for i in range(n):
    if throw[i]>=slash[0]:
        h-=throw[i]
        attack+=1
        if h<=0:
            print(attack)
            exit()
    else :
        break
 
attack+=int((h+slash[0]-1)/(slash[0]))
print(attack)
### BUGGY CODE ###

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

for i in range(N-1):
    for j in range(i+1, N):
        if A[i] == A[j]:
            print('NO')
            exit()

print('YES')


### FIXED CODE ###

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

A.sort()
for i in range(N-1):
    if A[i] == A[i+1]:
        print('NO')
        exit()

print('YES')
### BUGGY CODE ###

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

def myinput():
    return map(int,readline().split())

n = int(readline())
a = list(myinput())
mod = 10**9 + 7
ans = 0

for j in range(60):
    k = 2**j
    one = 0
    zero = 0
    for i in range(n):
        if (a[i]&k):
            one += 1
        else:
            zero += 1
    ans_bit = zero * one
    ans += (ans_bit)*(2**j) 
    ans %= mod   

print(ans%mod)

### FIXED CODE ###

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

def myinput():
    return map(int,readline().split())

n = int(readline())
a = list(myinput())
mod = 10**9 + 7
ans = 0

for j in range(60):
    k = 2**j
    one = 0
    zero = 0
    for i in range(n):
        if (a[i]&k):
            one += 1
        else:
            zero += 1
    ans_bit = zero * one
    ans += (ans_bit)*(2**j) 
    ans %= mod   

print(ans%mod)
### BUGGY CODE ###

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

def f(P):
    mx = k * P
    total = 0
    for i in range(n):
        tmp = total + w[i]
        if tmp > mx:
            return i
        else:
            total = tmp
    return n

def f(P):
    i = 0
    for j in range(k):
        s = 0
        while s + w[i] <= P:
            s += w[i]
            i += 1
            if i == n: return n
    return i

P = 0
l = range(sum(w))

while f(P) < n:
    P += 1
print(P)
    

### FIXED CODE ###

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

def f(P):
    i = 0
    for j in range(k):
        s = 0
        while s + w[i] <= P:
            s += w[i]
            i += 1
            if i == n: return n
    return i

left = 0
right = 100000 * 10000

while right - left > 1:
    mid = (left + right) // 2
    v = f(mid)
    if v>=n:right=mid
    else: left = mid
print (right)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
    print(a.count(i))

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
a=[0]*n
for i in range(n-1):
    a[p[i]-1]+=1
for i in range(0,n):
    print(a[i])
### BUGGY CODE ###

#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

q, k = map(int, input().split())
x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append((b[i],c[i]))
    l[b[i]].append((a[i],c[i]))

d = [0] * (n+1)
check = [0] * (n+1)
check[k] = 1
que = [k]

while len(que) > 0:
    tmp = que.pop(0)
    tmp_list = l[tmp]
    for i in tmp_list:
        if check[i[0]] == 0:
            que.append(i[0])
            check[i[0]] = 1
            d[i[0]] = d[tmp] + i[1]
        else:
            pass

for i in range(q):
    ans = d[x[i]] + d[y[i]]
    print(ans)

### FIXED CODE ###

#%%
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n-1):
    a[i], b[i], c[i] = map(int, input().split())

q, k = map(int, input().split())

l = [[] for _ in range(n+1)]
for i in range(n-1):
    l[a[i]].append([b[i],c[i]])
    l[b[i]].append([a[i],c[i]])

d = [0] * (n+1)
check = [0] * (n+1)
check[k] = 1
que = [k]
count = 1

while len(que) > 0:
    tmp = que.pop(0)
    for i in l[tmp]:
        if check[i[0]] == 0:
            que.append(i[0])
            check[i[0]] = 1
            d[i[0]] = d[tmp] + i[1]
            count += 1
        else:
            pass
    if count >= n:
        break

x, y = [0] * q, [0] * q
for i in range(q):
    x[i], y[i] = map(int, input().split())
    print(d[x[i]] + d[y[i]])
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
n = int(input())
a = list(map(int,input().split()))
ans = 0
mod = (10**9 +7)
for j in range(61):
    num_zero = 0
    for i in range(len(a)):
        if a[i] % 2 == 0: 
            num_zero += 1
        a[i] = a[i] //2
    #print(a)
    ans += num_zero * (n-num_zero) * (2**j) 
    #print(ans)
print(ans%mod)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
n = int(input())
a = list(map(int,input().split()))
ans = 0
mod = (10**9 +7)
for j in range(61):# 2**j 桁に対して1なものの数を求める
    num_one = 0
    for i in range(len(a)):
        if a[i] & 2**j: 
            num_one += 1
    #print(j,num_one)
    ans += (2**j % mod) * (n-num_one)*(num_one) % mod
    #print(ans)
print(ans%mod)
### BUGGY CODE ###

N = int(input().strip())
A = [int(v) for v in input().strip().split()]
C = {}

for a in A:
    C.setdefault(a, 0)
    C[a] += 1

for i, a in enumerate(A):
    C[a] -= 1
    sum_ = sum([n * (n - 1) // 2 for n in C.values() if n > 1])
    C[a] += 1
    print(sum_)

### FIXED CODE ###

from functools import lru_cache

N = int(input().strip())
A = [int(v) for v in input().strip().split()]
C = {}


@lru_cache(maxsize=None)
def pair(k):
    return k * (k - 1) // 2

@lru_cache(maxsize=None)
def calc(s, a):
    return s - pair(C[a]) + pair(C[a] - 1)

for a in A:
    C.setdefault(a, 0)
    C[a] += 1

S = sum([pair(v) for v in C.values()])

for a in A:
    print(calc(S, a))
### BUGGY CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list_trans = [A,B,C,D,E]
list = [N,0,0,0,0,0]#initial condition
time = 0

while list[5] < N:
    list_new = [0,0,0,0,0,0]
    for i in range(len(list)-1):
        if (list[i] - list_trans[i]) >= 0:
            list_new[i] -= list_trans[i]
            list_new[i+1] += list_trans[i]
        else:
            list_new[i] -= list[i]
            list_new[i+1] += list[i]
    for i in range(len(list)):
        list[i] = list[i] + list_new[i]
    time += 1
print(time)

### FIXED CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list_t = [A,B,C,D,E]
lowest = list_t[0]

for i in range(len(list_t)):
    if lowest >= list_t[i]:
        lowest = list_t[i]
    
    
if (N % lowest) != 0:
    print(N // lowest + 5)
else:
    print(N // lowest + 4)