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

n = int(input())
a = list(map(int, input().split()))
count = 1
for i in a:
    count = count * i
if count > 10**18:
    print(-1)
else:print(count)

### FIXED CODE ###

import sys

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

if 0 in a:
    print(0)
    sys.exit()

for i in a:
    count = count * i
    if count > 10**18:
        print(-1)
        sys.exit()
print(count)
### BUGGY CODE ###

s=input()
l=len(s)
ans=0
for i in range(l-3):
    for j in range(3,l-i):
        if j==3:
            p=int(s[i:i+4])%2019
        else:
            p=(p*10+int(s[i+j]))%2019
        if p==0:
             ans+=1
print(ans)

### FIXED CODE ###

s=input()
l=len(s)
ans=0
p=0
a={}
b=-1
c=-1
d=-1
e=-1
q=1
for j in range(l)[::-1]:
    p=(p+int(s[j])*q)%2019
    q*=10
    q%=2019
    if p==0:
        ans+=1
    if a.get(p)!=None:
        ans+=a[p]
    if a.get(p)!=None:
        a[p]+=1
    else:
        a[p]=1
print(ans)
### BUGGY CODE ###

L,R = map(int, input().split())
t = 2019
for i in range(L,R):
    for j in range(i+1,R+1):
        m = (i*j)%2019
        t = min(m,t)
print(t)

### FIXED CODE ###

L,R = map(int, input().split())
if R-L >= 2019:
  print(0)
else:
  t = 2019
  for i in range(L,R):
    for j in range(i+1,R+1):
        m = (i*j)%2019
        t = min(m,t)
  print(t)
### BUGGY CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

H, W = map(int,input().split())
sth, stw = map(int,input().split())
glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1

INF = -1
Gmap = [list(input()) for _ in range(H)]
seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
direc5 = set([])
for i in range(-2,3):
    for j in range(-2,3):
        direc5.add((i, j))
direc5 = direc5 - direc
direc5 = direc5 - {(0,0)}
nxt_st = set([])
nxt_st_all = set([])

def bfs(pnxt):
    next_q = deque([])
    for h, w in pnxt:
        next_q.append((h,w))
        seen[h][w] = 0
    nxt = set([])
    while len(next_q)!=0:
        #キュー取り出し(先頭)
        h,w = next_q.popleft()
        if h == glh and w == glw:
            print(ret)
            exit()
        seen[h][w] = 0
        for dh, dw in direc:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF:
                next_q.append((hs, ws))
        for dh, dw in direc5:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF and not (hs, ws) in nxt:
                nxt.add((hs, ws))

    return nxt

ret = -1
nxt_st.add((sth, stw))
while len(nxt_st)>0:
    ret += 1
    nxt_st = bfs(nxt_st)
print(-1)


### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

from collections import deque

H, W = map(int,input().split())
sth, stw = map(int,input().split())
glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1

INF = -1
Gmap = [list(input()) for _ in range(H)]
seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
direc5 = set([])
for i in range(-2,3):
    for j in range(-2,3):
        direc5.add((i, j))
direc5 = direc5 - direc
direc5 = direc5 - {(0,0)}

def bfs(pnxt):
    next_q = deque([])
    for h, w in pnxt:
        next_q.append((h,w))
        seen[h][w] = 0
    nxt = set([])
    while len(next_q)!=0:
        h, w = next_q.popleft()
        if h == glh and w == glw:
            print(ret)
            exit()
        for dh, dw in direc:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF:
                next_q.append((hs, ws))
                seen[hs][ws] = 0
        for dh, dw in direc5:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF and not (hs, ws) in nxt:
                nxt.add((hs, ws))
    return nxt

ret = 0
nxt_st = set([])
nxt_st.add((sth, stw))
while len(nxt_st)>0:
    nxt_st = bfs(nxt_st)
    ret += 1
print(-1)
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]

l = [s.count(i) for i in s]
d = {i:j for i,j in zip(s, l)}
m = max(l)

d = {i:j for i, j in zip(s, l)}
ans = [i for i in d if d[i] == m]
ans = sorted(ans)

for i in ans:
    print(i)

### FIXED CODE ###

from collections import Counter

n = int(input())
s = [input() for i in range(n)]

d = Counter(s)
m = max(d.values())
ans = [i for i in d if d[i] == m]
ans = sorted(ans)

for i in ans:
    print(i)
### BUGGY CODE ###

N, K = map(int, input().split()) # 横に2個
L = [list(map(int, input().split())) for _ in range(N-1)]

mod = 10**9+7

neardic = {}
for p in range(1, N+1):
    near = []
    for l in L:
        if p in l:
            other = set(l) - {p}
            near.append(list(other)[0])
    neardic[p] = set(near)


def color(p=1, state=[1], prob=K, checked=set()):
    nears = neardic[p]
    checked.add(p)
    unchecked_nears = nears - checked
    A = len(unchecked_nears)
    if A == 0:
        return prob
    nextprobmax = K-1 if len(state) == 1 else K-2
    for i, near in enumerate(unchecked_nears):
        prob = prob * (nextprobmax - i) % mod
        nowstate = state[:]
        nowstate.append(near)
        prob = color(near, nowstate, prob, checked)
    return prob

print(color())




### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

checked = [False]*N
C = [None]*N
checked[0] = True

def dfs(p, c1, c2, depth):
    C[p] = c1 + c2
    d = 0
    for np in graph[p]:
        if not checked[np]:
            checked[np] = True
            d += 1
            g = 1 if depth > 0 else 0
            dfs(np, d, g, depth+1)
        

dfs(0, 0, 0, 0)
#print(C)

mod = 10**9+7
ans = 1
for n in range(N):
    ans = ans * (K-C[n]) % mod

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

def judgePrime(n):
  result = True
  for i in xrange(2, int(round(n))):
    if n % i == 0:
      result = False
      break
  return result

def getPrimeNumFromList(list):
  count = 0
  for i in xrange(len(list)):
    target = 0
    if i == 0:
      target = list[0]
      if judgePrime(target):
        count += 1
      else:
        pass

  return count

n = int(raw_input())
list = []

for i in xrange(n):
  list.append(int(raw_input()))
list.sort()

prime_list = []
all_list = range(2, list[len(list) - 1] + 1)

while True:
  v = all_list.pop(0)
  prime_list.append(v)
  # print "all_list : "
  # print all_list
  # print "prime_list : "
  # print prime_list
  for i in xrange(len(all_list)):
    if i >= len(all_list):
      break
    elif all_list[i] % v == 0:
      all_list.pop(i)
      i -= 1
  if len(all_list) == 0:
    break
  elif prime_list[len(prime_list) - 1] ^ 2 >= all_list[len(all_list) - 1]:
    prime_list.append(all_list)
    break

count = 0
for i in xrange(len(prime_list)):
  if prime_list[i] in list:
    count += 1

print count

### FIXED CODE ###

import pdb

n = int(raw_input())
count = 0
for x in xrange(n):
  target = int(raw_input())
  # pdb.set_trace()
  if target == 2:
    count += 1
  elif target < 3 or not target & 1:
    continue
  else:
    if pow(2, target - 1, target) == 1:
      count += 1

print count
### BUGGY CODE ###

N,K=map(int,input().split())
light=list(map(int,input().split()))
for k in range(K):
  imo=[0]*(N+1)
  for i in range(N):
    l=max(0,i-light[i])
    r=min(N-1,i+light[i])+1
    imo[l]+=1
    imo[r]-=1
  for i in range(1,N):
    imo[i]+=imo[i-1]
  if light==imo:
    break
  else:
    light=imo[:]
print(*light[:-1])

### FIXED CODE ###

N,K=map(int,input().split())
light=list(map(int,input().split()))
for k in range(K):
  imo=[0]*(N+1)
  for i in range(N):
    l=max(0,i-light[i])
    r=min(N-1,i+light[i])+1
    imo[l]+=1
    imo[r]-=1
  for i in range(1,N):
    imo[i]+=imo[i-1]
  if light==imo:
    break
  else:
    light=imo[:]
print(*light[:-1])
### BUGGY CODE ###

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

total = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        total += a[i] * a[j]
print(total % (pow(10, 9) + 7))

### FIXED CODE ###

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

s_1 = 0
s_2 = 0
m = 10 ** 9 + 7
for i in range(n):
    s_1 += a[i] % m
    s_2 += (a[i] ** 2) % m
s = (s_1 * s_1 - s_2) * pow(2, -1, m) % m
print(s)
### BUGGY CODE ###

import itertools
N, M, Q = map(int, input().split())
m = list()
res = -100
for i in range(Q):
    n = list(map(int, input().split()))
    m.append(n)
l = list()
for i in range(M):
    l.append(i + 1)
p = itertools.combinations_with_replacement(l, N)
for p in p:
    total = 0
    for i in range(Q):
        num = 0
        a = m[i][0]
        b = m[i][1]
        A = p[a - 1]
        B = p[b - 1]
        C = B - A
        if m[i][2] == C:
            num = num + m[i][3]
            total = total + num
    if res < total:
        res = total
print(res)


### FIXED CODE ###

import math
import itertools

N, M, Q = map(int, input().split())
a = [0]*Q
b = [0]*Q
c = [0]*Q
d = [0]*Q
for i in range(Q):
    a[i], b[i], c[i], d[i] = map(int, input().split())
Al = [0]*M
for i in range(M):
    Al[i] = i + 1
All = list(itertools.combinations_with_replacement(Al, N))

ans = 0

for A in All:
    wa = 0
    for i in range(Q):
        kari = A[b[i]-1] - A[a[i] - 1]
        if kari == c[i]:
            wa = wa + d[i]
    if ans < wa:
        ans = wa
print(ans)
### BUGGY CODE ###

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

L=[0]*M
R=[0]*M

for i in range(M):
  L[i],R[i]=map(int,input().split())

def prison(N,M,L,R):
  count=0
  step=0
  for l,r in zip(L,R):
    num=list(range(l,(r+1)))
    if step!=0:
      num=list(set(num) & set(num_pre))
    num_pre=num
    step+=1
  return len(num_pre)
print(prison(N,M,L,R))

### FIXED CODE ###

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

L=[0]*M
R=[0]*M

for i in range(M):
  L[i],R[i]=map(int,input().split())

def prison(N,M,L,R):
  max_val=min(R)
  min_val=max(L)
  num=max_val-min_val+1
  if num<=0:
    num=0
  return(num)

print(prison(N,M,L,R))
### BUGGY CODE ###

N_ = int(input())

A_ = list(map(int,input().split()))
#A_.remove(1)
#print(A_)
def xC(num):
    return (num * (num - 1)) //2

def Re_(reA,t):
    Dup = []
    num = 0
    #print(reA)
    for i in range(len(reA)):
        if Dup.count(reA[i]) == 0:
            Dup.append(reA[i])
        else:
            pass
    for i in range(len(Dup)):
        num += xC(reA.count(Dup[i]))
    return num

for i in range(N_):
    B_ = A_.copy()
    B_.remove(A_[i])
    res = Re_(B_,A_[i])
    print(res)


### FIXED CODE ###

N_ = int(input())

A_ = input().split()
#print(A_)

#U_ = set(A_)
#print(U_)


#def xC(num):
#    return (num * (num - 1)) //2
import collections
cnt = collections.Counter(A_)

num = 0
dict = {}
#judge = {}
#for u in U_:
#    judge[u] = False
#    num += xC(A_.count(u))
for v in cnt.values():
    num += v*(v - 1)//2
Re = []
for value in A_:
    Re.append(str(num - (cnt[value] - 1)))
print('\n'.join(Re))
### BUGGY CODE ###

n,a=map(int,input().split())
x=list(map(int,input().split()))
m=max(x)
L3=[]
for i3 in range(n+1):
  L2=[]
  for i2 in range(n+1):
    L1=[0 for i1 in range(n*m+1)]
    L2.append(L1)
  L3.append(L2)
for i3 in range(n+1):
  for i2 in range(n+1):
    for i1 in range(m*n+1):
      if i1==0 and i2==0 and i3==0:
        L3[i3][i2][i1]=1
      elif i3>0 and i1<x[i3-1]:
        L3[i3][i2][i1]=L3[i3-1][i2][i1]
      elif i3>0 and i2>0 and i1>=x[i3-1]:
        L3[i3][i2][i1]=L3[i3-1][i2][i1]+L3[i3-1][i2-1][i1-x[i3-1]]
      else:
        L3[i3][i2][i1]=0
ct=0
for i2 in range(n+1):
  for i1 in range(1,m*n+1):
    if i1==i2*a:
      ct+=L3[n][i2][i1]
print(ct)

### FIXED CODE ###

n,a=map(int,input().split())
x=list(map(int,input().split()))
m=max(x)
L3=[]
for i3 in range(n+1):
  L2=[]
  for i2 in range(n+1):
    L1=[0 for i1 in range(n*m+1)]
    L2.append(L1)
  L3.append(L2)
for i3 in range(n+1):
  for i2 in range(n+1):
    for i1 in range(m*n+1):
      if i1==0 and i2==0 and i3==0:
        L3[i3][i2][i1]=1
      elif i3>0 and i1<x[i3-1]:
        L3[i3][i2][i1]=L3[i3-1][i2][i1]
      elif i3>0 and i2>0 and i1>=x[i3-1]:
        L3[i3][i2][i1]=L3[i3-1][i2][i1]+L3[i3-1][i2-1][i1-x[i3-1]]
      else:
        L3[i3][i2][i1]=0
ct=0
for i2 in range(n+1):
  for i1 in range(1,m*n+1):
    if i1==i2*a:
      ct+=L3[n][i2][i1]
print(ct)
### BUGGY CODE ###

#coding:utf-8
import re

if __name__ == "__main__":
    patterns = ["dream", "dreamer", "erase" ,"eraser"]
    S = input()

    # while True:
    #     flag = False
    #     if S[-5:] == "dream":
    #         S = S[:-5]
    #         flag = True
    #     if S[-7:] == "dreamer":
    #         S = S[:-7]
    #         flag = True
    #     if S[-5:] == "erase":
    #         S = S[:-5]
    #         flag = True
    #     if S[-6:] == "eraser":
    #         S = S[:-6]
    #         flag = True
    #
    #     if flag == False:
    #         print("NO")
    #         break
    #
    #     if S == "":
    #         print("YES")
    #         break

    while True:
        flag = False
        if re.search("dream$",S):
            S = re.sub("dream$","",S)
            flag = True
        if re.search("dreamer$",S):
            S = re.sub("dreamer$","",S)
            flag = True
        if re.search("erase$",S):
            S = re.sub("erase$","",S)
            flag = True
        if re.search("eraser$",S):
            S = re.sub("eraser$","",S)
            flag = True

        if flag == False:
            print("NO")
            break

        if S == "":
            print("YES")
            break

### FIXED CODE ###

#coding:utf-8
import re

if __name__ == "__main__":
    patterns = ["dream", "dreamer", "erase" ,"eraser"]
    S = input()

    while True:
        flag = False
        if S[-5:] == "dream":
            S = S[:-5]
            flag = True
        if S[-7:] == "dreamer":
            S = S[:-7]
            flag = True
        if S[-5:] == "erase":
            S = S[:-5]
            flag = True
        if S[-6:] == "eraser":
            S = S[:-6]
            flag = True

        if flag == False:
            print("NO")
            break

        if S == "":
            print("YES")
            break
### BUGGY CODE ###

MOD = 10 ** 9 + 7
ans = 1

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

if n == k:
    for x in a:
        ans *= x
    print(ans % MOD)
    exit()

pos = []
neg = []

for x in a:
    if x >= 0:
        pos.append(x)
    else:
        neg.append(x)

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

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

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


l = []

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

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

l.sort(reverse=True)

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

print(ans % MOD)


### FIXED CODE ###

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

MOD = 10 ** 9 + 7
ans = 1

#全部取る
if n == k:
    for x in a:
        ans *= x
        ans %= MOD
    print(ans % MOD)

#全部負かつ奇数個取る
elif max(a) < 0 and k % 2:
    a.sort()
    for i in range(1, k+1):
        ans *= a[-i]
        ans %= MOD
    print(ans % MOD)

else:
    pos = []
    neg = []
    
    for x in a:
        if x >= 0:
            pos.append(x)
        else:
            neg.append(x)
    
    pos.sort(reverse=True)
    neg.sort()
    
    
    if k % 2:
        ans *= pos.pop(0)
        k -= 1
     
    #2個ずつ取る
    num = []
    for x, y in zip(pos[::2], pos[1::2]):
        num.append(x * y)
    for x, y in zip(neg[::2], neg[1::2]):
        num.append(x * y)

    num.sort(reverse=True)

    for i in range(k // 2):
        ans *= num[i]
        ans %= MOD
    
    print(ans % MOD)
### BUGGY CODE ###

N = int(input())
A = input()
count = 0
split = [int(i) for i in A.split(" ")]

for i in range(N):
    i -= count
    if i + 1 != split[i]:
        del split[i]
        count += 1

if split == []:
    print(-1)
else:
    print(count)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
count = 0
num = 1

for i in range(N):
    if A[i] == num:
        num += 1
    else:
        count += 1

if count == N:
    print(-1)
else:
    print(count)
### BUGGY CODE ###

import sys
input = sys.stdin.buffer.readline

def main():
    n, w = map(int,input().split())
    wei = []
    val = []
    for i in range(n):
        a, b = map(int,input().split())
        wei.append(a)
        val.append(b)

    dp = [[0 for i in range(w+1)] for j in range(n+1)]

    for i in range(n):
        for sum_w in range(w+1):
            
            if sum_w - wei[i] >= 0:
                dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - wei[i]] + val[i])

            
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

    print(dp[n][w])


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

def main():
    n, w = map(int,input().split())
    wei = []
    val = []
    for i in range(n):
        a, b = map(int,input().split())
        wei.append(a)
        val.append(b)

    dp = [[0 for i in range(w+1)] for j in range(n+1)]

    for i in range(n):
        for sum_w in range(w+1):
            
            if sum_w - wei[i] >= 0:
                dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - wei[i]] + val[i])

            
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

    print(dp[n][w])


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

from collections import deque

class MyClass():    
    def load(self):
        self.n = input()
        self.A = map(int,raw_input().split())
        self.q = input()
        self.M = map(int,raw_input().split())

    def main(self):
        self.load()
        W = map(self.solve,self.M)
        for w in W:
            print w

    def solve(self,m):
        qA = deque(self.A)
        for j in range(self.n):
            w = self.rec(m,list(qA))
            if w:
                break
            qA.popleft()
        if w:
            return "yes"
        else:
            return "no"

    def rec(self,m,A):
        if len(A) == 1:
            r1 = False
        else:
            r1 = self.rec(m,A[1:])
        m_new = m - A[0]
        if m_new < 0:
            r2 = False
        elif m_new == 0:
            r2 = True
        else:
            if len(A) == 1:
                r2 = False
            else:
                r2 = self.rec(m_new,A[1:])
        if r1 or r2:
            return True
        else:
            return False

if __name__ == "__main__":
    MC = MyClass()
    MC.main()

### FIXED CODE ###

from collections import deque

def main():
    n = input()
    A = deque(map(int,raw_input().split()))
    q = input()
    M = map(int,raw_input().split())

    p = rec([0],A)

    for m in M:
        if m in p:
            print "yes"
        else:
            print "no"

def rec(a,A):
    if len(A) == 0:
        return a
    else:
        y = A.popleft()
        a = a+[x+y for x in a]
        return rec(a,A)

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

ans = 0
N = int(input())
array = list(map(int, input().split()))
for i in range(N):
      ans += array[i]*sum(array[i+1:N])
print(ans%(10**9+7))

### FIXED CODE ###

ans = 0
N = int(input())
array = list(map(int, input().split()))
x = sum(array)
y = 0
for i in range(N):
  y += array[i]**2

ans = x**2 -y
print((ans//2)%(10**9+7))
### BUGGY CODE ###

n = int(input())
ps = list(map(int,input().split()))
count = 1
for i in range(len(ps)):
    if i != 0:
        x = ps[i]
        mi = min(ps[0:i])
        if mi>ps[i]:
            count += 1
print(count)

### FIXED CODE ###

n = int(input())
ps = list(map(int,input().split()))
count = 1
mi = ps[0]
for i in range(1,len(ps)):
    if mi>=ps[i]:
        mi = ps[i]
        count += 1
print(count)
### BUGGY CODE ###

import numpy as np
def main():
    N,W = map(int,input().split())
    wvlist = []
    dp =[[0 for i in range(W+1)] for j in range(N+1)]
    for i in range(N):
        lista = list(map(int,input().split()))
        wvlist.append(lista)
    for i in range(N):
        for j in range(W+1):
            if wvlist[i][0] <= j:
                dp[i+1][j] = max(dp[i+1][j],dp[i][j-wvlist[i][0]]+wvlist[i][1])
            else:
                dp[i+1][j] = dp[i][j]
    print(np.amax(dp))            
        
    
    
main()

### FIXED CODE ###

N,W = map(int,input().split())
array = []
for i in range(N):
    wv = list(map(int,input().split()))
    array.append(wv)
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if j-array[i][0] >= 0:
            dp[i+1][j] = max(dp[i][j],dp[i][j-array[i][0]]+array[i][1])
        else:
            dp[i+1][j] = dp[i][j]
print(dp[-1][-1])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)
N,M = map(int,input().split())

class Union_Find():

    def __init__(self,n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rank = [0]*(n+1)

    #xの木の根を返す関数
    def find_root(self,x):
        if self.root[x]<0:
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]

    #xの木とyの木を統合する関数
    def unite(self,x,y):
        x = self.find_root(x)
        y = self.find_root(y)

        if x==y:
            return
        else:
            self.root[x]+=self.root[y]
            self.root[y]=x 
        """
        elif self.rank[x]>self.rank[y]:
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y

            if self.rank[x]==self.rank[y]:
                self.rank[y]+=1
        """


    #xとyの木の根が同じならTrueを返す関数
    def same(self,x,y):
        return self.find_root(x)==self.find_root(y)

    #xの木の要素数を返す関数
    def cnt(self,x):
        return -self.root[self.find_root(x)]

G=Union_Find(N)
ans=0
for i in range(M):
    a,b=map(int,input().split())
    G.unite(a,b)

for i in range(1,N+1):
    ans = max(ans,G.cnt(i))
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
N,M = map(int,input().split())

class Union_Find():

    def __init__(self,n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rank = [0]*(n+1)

    def find_root(self,x):
        if self.root[x]<0:
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]

    def unite(self,x,y):
        x = self.find_root(x)
        y = self.find_root(y)

        if x==y:
            return
        elif self.rank[x]>self.rank[y]:
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y

            if self.rank[x]==self.rank[y]:
                self.rank[y]+=1

    def same(self,x,y):
        return self.find_root(x)==self.find_root(y)

    def cnt(self,x):
        return -self.root[self.find_root(x)]

G=Union_Find(N)
ans=0
for i in range(M):
    a,b=map(int,input().split())
    G.unite(a,b)

for i in range(1,N+1):
    ans = max(ans,G.cnt(i))
print(ans)
### BUGGY CODE ###

import math
N, K=map(int, input().split())
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if k>0 and sum([math.ceil(a/k)-1 for a in A])<=K:
        if k-1>0 and sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1


### FIXED CODE ###

import math
N, K=map(int, input().split())
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if k>0 and sum([math.ceil(a/k)-1 for a in A])<=K:
        if k==1 or sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1