Harryxun/stf_run huggingface dataset:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from heapq import heappush, heappop

N,M,S = map(int,readline().split())
ABC = [list(map(int,readline().split())) for _ in range(M)]
m = map(int,read().split())
CD = list(zip(m,m))

graph = [[] for _ in range(N)]
for u,v,a,b in ABC:
    graph[u-1].append((v-1,a,b))
    graph[v-1].append((u-1,a,b))

def f():
  INF = 10 ** 18
  arrive = [False]*n
  ans = []
  qq = 2500
  dist = [[INF] * qq for _ in range(N)]
  dist[0][min(qq-1,S)] = 0
  q = [(0,min(qq-1,S),0)]
  while q:
      st,ss,v = heappop(q) # 総時間、銀貨、今いる頂点
      if dist[v][ss] < st:
        continue
      if not arrive[v]:
        arrive[v] = True
        ans.append((v,st))
        if all(arrive):
          break
      c,d = CD[v]
      # 銀貨の購入
      if ss < qq-1:
          ns = min(ss + c, qq-1)
          nt = st + d
          if dist[v][ns] > nt:
              dist[v][ns] = nt
              heappush(q,(nt,ns,v))
      # 移動
      for nex,g,tt in graph[v]:
          if ss-g < 0:
              continue
          dt = st + tt
          if dist[nex][ss-g] <= dt:
              continue
          dist[nex][ss-g] = dt
          heappush(q,(dt,ss-g,nex))
  return ans

ab = f()
from operator import itemgetter
ab = sorted(ab,key=itemgetter(0))
for i in range(N-1):
  print(ab[i][1])

### FIXED CODE ###

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

from heapq import heappush, heappop

N,M,S = map(int,readline().split())
ABC = [list(map(int,readline().split())) for _ in range(M)]
m = map(int,read().split())
CD = list(zip(m,m))

graph = [[] for _ in range(N)]
for u,v,a,b in ABC:
    graph[u-1].append((v-1,a,b))
    graph[v-1].append((u-1,a,b))

def f():
  INF = 10 ** 18
  arrive = [False]*N
  ans = []
  qq = 2500
  dist = [[INF] * qq for _ in range(N)]
  dist[0][min(qq-1,S)] = 0
  q = [(0,min(qq-1,S),0)]
  while q:
      st,ss,v = heappop(q) # 総時間、銀貨、今いる頂点
      if dist[v][ss] < st:
        continue
      if not arrive[v]:
        arrive[v] = True
        ans.append((v,st))
        if all(arrive):
          break
      c,d = CD[v]
      # 銀貨の購入
      if ss < qq-1:
          ns = min(ss + c, qq-1)
          nt = st + d
          if dist[v][ns] > nt:
              dist[v][ns] = nt
              heappush(q,(nt,ns,v))
      # 移動
      for nex,g,tt in graph[v]:
          if ss-g < 0:
              continue
          dt = st + tt
          if dist[nex][ss-g] <= dt:
              continue
          dist[nex][ss-g] = dt
          heappush(q,(dt,ss-g,nex))
  return ans

ab = f()
from operator import itemgetter
ab = sorted(ab,key=itemgetter(0))
for i in range(1,N):
  print(ab[i][1])
n,l = map(int,input().split())
l = sorted([str(input()) for _ in range(l)])
print(l)

### FIXED CODE ###

n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")
n = int(input())
y = int(input())

for man in range(0, 2000):
    for gosen in range(0, 4000):
        for sen in range(0, 20000):
            if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n:
                print(man, gosen, sen)
                exit()

print("-1 -1 -1")



### FIXED CODE ###

def solve(n, y):
    for man in range(n + 1):
        for gosen in range(n - man + 1):
            sen = n - man - gosen
            if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n:
                print('{} {} {}'.format(man, gosen, sen))
                return
    print("-1 -1 -1")
    return            

#main
n, y = map(int, raw_input().split())
solve(n, y)
h,n=map(int,input().split())
a=list(map(int,input().split()))
sum=0
for i in range(n):
    sum+=a[i]
print('Yes' if sum>=h else 'No')

### FIXED CODE ###

h,a=map(int,input().split())
if h%a==0:
    print(h//a)
else:
    print(1+h//a)
# -*- coding: utf-8 -*-

import numpy as np

N = int(input())

A = np.array(list(map(int, input().split())))

if 0 in A:
    print(0)
    exit(-1)

if np.sum(A > 0) % 2 == 1:
    print(np.prod(A))
    exit(-1)

mul = A[0]
for i in A[1:]:
    if 1000000000000000000 / i < mul:
        print(-1)
        exit(-1)
    mul *= i

if mul > 1000000000000000000:
    print(-1)
    exit(-1)
print(mul)

### FIXED CODE ###

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

import numpy as np

N = int(input())

A = np.array(list(map(int, input().split())))

if 0 in A:
    print(0)
    exit(0)

mul = A[0]

if np.sum(A < 0) % 2 == 1:
    for i in A[1:]:
        mul *= i
else:
    for i in A[1:]:
        if 1000000000000000000 / i < mul:
            print(-1)
            exit(0)
        mul *= i

if mul > 1000000000000000000:
    print(-1)
    exit(0)

print(mul)
H,W = [int(i) for i in input().split()]
ans = 0

for x in range(1,W):
    y = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y
    Sc1 = (W - x) * (H - y)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    Sa2 = H * x
    Sb2 = H * y
    Sb2 = H * (W - x - y)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

print(ans)


### FIXED CODE ###

H,W = [int(i) for i in input().split()]
ans = H * W

for x in range(1,W):
    y1 = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y1
    Sc1 = (W - x) * (H - y1)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    y2 = (W - x) // 2
    Sa2 = H * x
    Sb2 = H * y2
    Sc2 = H * (W - x - y2)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

H,W = W,H
for x in range(1,W):
    y = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y
    Sc1 = (W - x) * (H - y)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    y2 = (W - x) // 2
    Sa2 = H * x
    Sb2 = H * y2
    Sc2 = H * (W - x - y2)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

print(ans)
from heapq import heappop, heappush
N, M = map(int, input().split())
A = list(map(int, input().split()))

queue = []

for a in A:
  if a == 1:
    heappush(queue, (2, 1))
  elif a == 2:
    heappush(queue, (5, 2))
  elif a == 3:
    heappush(queue, (5, 3))
  elif a == 4:
    heappush(queue, (4, 4))
  elif a == 5:
    heappush(queue, (5, 5))
  elif a == 6:
    heappush(queue, (6, 6))
  elif a == 7:
    heappush(queue, (3, 7))
  elif a == 8:
    heappush(queue, (7, 8))
  elif a == 9:
    heappush(queue, (6, 9))

x, y = heappop(queue)
mod = N % x
ans = [y] * ((N - N % x) // x)
baseX = x

while mod != 0:
  ans = ans[1:]
  mod += baseX
  x, y = heappop(queue)
  ans.append(y)
  mod %= x

for a in sorted(ans, reverse=True):
  print(a, end="")

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
weight = [0,2,5,5,4,5,6,3,7,6]
dp=[-1]*(N+1)
dp[0] = 0

for i in range(N+1):
  if dp[i] == -1: continue
  for a in A:
    if i+weight[a]<N+1:
      dp[i+weight[a]] = max(dp[i+weight[a]],dp[i]*10+a)

print(dp[-1])
k = int(input())        
    if (k%2) == 0:
        o = (k*(k+1))/2
        e = (k*(k-1))/2
        print(o+e)
    else:
        o = (k*(k-1))/2
        e = (k*(k-1))/2
        print(o+e)

### FIXED CODE ###

#おそらく上は偶数の処理がおかしい
k = int(input())        
#奇数の場合
if (k%2) == 1:
    o = (k-1) * (k+1) / 8
    #eはoと同じ数値
    print(int(2*o))
#偶数の場合 
else:
    o = k * (k+2) / 8
    e = k * (k-2) / 8
    print(int(o+e))
S = input()

list_ = []
length = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        length += 1
    else:
        list_.append(length)
        length = 0
        
print(max(list_))

### FIXED CODE ###

s = input()
ACGT = ["A","C","G","T"]
ans = 0
ANS = [0]

for i in range(len(s)):
    if s[i] in ACGT:
        ans += 1
    else:
        ans = 0
        
    ANS.append(ans)
        
print(max(ANS))
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,M = map(int,input().split())
A = [int(i) for i in input().split()]
change = [0 for i in range(M)]
for i in range(M):
    change[i] = [int(i) for i in input().split()]

D = []
for i in range(M):
    b,c = change[i]
    D += [c]*b

D.sort()
D.reverse()

A.sort()
ans = sum(A)
for i in range(len(D)):
    if D[i]-A[i] < 0:
        break
    else:
        ans += D[i]-A[i]
print(ans)


### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,M = map(int,input().split())
A = [int(i) for i in input().split()]
change = [0 for i in range(M)]
for i in range(M):
    change[i] = [int(i) for i in input().split()]

D = []
change = sorted(change,key=lambda x:x[1],reverse=True)
for i in range(M):
    b,c = change[i]
    for j in range(b):
        D += [c]
    if len(D) > N:
        break

A += D
A.sort(reverse=True)
print(sum(A[:N]))
a op b = input().split()
if op == "+":
    print(int(a) + int(b))
elif op == '-':
    print(int(a) - int(b))

### FIXED CODE ###

a, op, b = input().split()
if op == "+":
    print(int(a) + int(b))
elif op == '-':
    print(int(a) - int(b))
lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]

sum_lst = sum(lst_int)

lst_diff = []
for i in lst_str:
    val = 10 - int(i[-1])
    if val != 10:
        lst_diff.append(val)

diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)

### FIXED CODE ###

lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]

sum_lst = sum(lst_int)

lst_diff = []
for i in lst_str:
    val = int(i[-1])
    if val != 0:
        lst_diff.append(10 - val)

if lst_diff == []:
    lst_diff = [0]
diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)
a,b = map(int, input().sprit())
if a < b:
  print(0)
else:
  print(10)

### FIXED CODE ###

a,b = map(int, input().split())
if a < b:
  print(0)
else:
  print(10)
import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq


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

for i in range(N - 1):
	a, b = list(map(int, input().split())

for i in range(Q):
	p, x = list(map(int, input().split()))

### FIXED CODE ###


import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq


N, Q = list(map(int, input().split()))
eda = [[] for i in range(N)]
ope = [0]*N
score = [0]*N
parent = [-1]*N


for i in range(N - 1):
	a, b = list(map(int, input().split()))
	eda[a - 1].append(b - 1)
	eda[b - 1].append(a - 1)

for i in range(Q):
	p, x = list(map(int, input().split()))
	ope[p - 1] += x


que = []
que.append(0)
score[0] = ope[0]
for ss in range(N - 1):
	loc = que.pop()
	for edge in eda[loc]:
		if parent[loc] != edge:
			score[edge] += score[loc] + ope[edge]
			que.append(edge)
			parent[edge] = loc

for i in range(N - 1):
	print(score[i], end = "")
	print(" ", end = "")
print(score[N - 1])
k,s=map(int,input().split())
cnt=0
for i in range(s+1):
	for j in range(i,s+12 2):
		if i<=k and j-i<=k and s-j<=k:
			cnt+=1
print(cnt)
		

### FIXED CODE ###

k,s=map(int,input().split())
cnt=0
for i in range(s+1):
    if i>k:
        break
    cnt+= max(0,min(i+k,s)-max(s-k,i)+1)
print(cnt)
a = 1
a*= a for a in input().split()

### FIXED CODE ###

x = 1
for a in input().split():
  x *= int(a)
if x == 175:
  print('YES')
else:
  print('NO')
yandy
N, D = map(int, input().split())
array = []
for _ in range(N):
    array.append([int(i) for i in input().split()])
 
ans = 0
for i in range(N):
    for j in range(i+1, N):
        s = 0
        for d in range(D):
            s += (array[i][d]-array[j][d]) ** 2
        if s ** (1/2) % 1 == 0:
            ans += 1
 
print(ans)

### FIXED CODE ###

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

ans=0
s=0
for i in range(N):
  for j in range(i+1,N):
    s=0
    for d in range(D):
      s+=(l[i][d]-l[j][d])**2
    if s**(1/2)%1==0:
      ans+=1
print(ans)
from math import factorial
n,m = map(int,input().split())

if n == 0:
   M = 0
if n == 1:
    M = 1
else:
    N = factorial(n)/factorial(2)/factorial(n-2)
if m == 0:
   M = 0
if m == 1:
    M = 0
else:
    M = factorial(m)/factorial(2)/factorial(m-2)

print(int(N+M))


### FIXED CODE ###

from math import factorial
n,m = map(int,input().split())

if n == 0:
   N = 0
elif n == 1:
    N = 0
else:
    N = factorial(n)/factorial(2)/factorial(n-2)
if m == 0:
   M = 0
elif m == 1:
    M = 0
else:
    M = factorial(m)/factorial(2)/factorial(m-2)

print(int(N+M))
import copy
import sys
sys.setrecursionlimit(10**7)

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b

def main():
    n, m = map(int, input().split())
    # これだと72がREになる
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    # Aの要素が複数ならlcmを計算する
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    # 元のAの値とlcmの半分の値を割り切れるものがあったら0
    #for i in A_:
    for a in A:
        # # これなら72は通る
        # print(0)
        # exit()
        # if a_lcm / 2 % a == 0:
        if (a_lcm / a) % 2 == 0: 
            print(0)
            exit()
        # else:
        #     continue
    # mがlcmの半分よりも小さかったら0
    if (a_lcm / 2) > m:
    # if a_lcm > m * 2:
        print(0)
        exit()
    else:
        # # あとは定数倍の数調べて終わり
        ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
data = [int(input()) for i in range(3)]
result = data[0]+data[1])*data[2]*0.5
if result == int(result) :
  print(int(result))
else :
  print(result)

### FIXED CODE ###

data = [int(input()) for i in range(3)]
result = (data[0]+data[1])*data[2]*0.5
if result == int(result) :
  print(int(result))
else :
  print(result)
S = input()
S.set()
alp = [chr(ord('a') + i) for i in range(26)]
for i in alp:
  if i not in S:
    print(i)
    break

### FIXED CODE ###

S = input()
S = set(S)
alp = [chr(ord('a') + i) for i in range(26)]
for i in alp:
  if i not in S:
    print(i)
    break
else:
  print("None")
s = input()


if s[0:3].count(s[0]) == 3 or s[1:4].count(s[3])
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

s = input()


if s[0:3].count(s[0]) == 3 or s[1:4].count(s[3]) == 3:
  print("Yes")
else:
  print("No")
def main():
    n, m, *ab, = map(int, open(0).read().split())
    f = [set() for _ in range(n)]
    for i, j in zip(ab[::2], ab[1::2]):
        f[i].add(j)
        f[j].add(i)

    group = []
    i = 1
    g = {i}
    nx = {i}
    checked = set()
    m = 0
    ans = 0
    while i <= n:
        if i in checked:
            i += 1
            continue

        tmp = set()
        for j in list(nx):
            tmp |= f[j]
        tmp -= nx

        if len(tmp) == 0:
            checked |= g
            group.append(g)
            l = len(g)
            m += l
            r = n - m
            ans = max(ans, l)
            if l >= r:
                break
            i += 1
            g = {i}
        else:
            g |= tmp
            nx = tmp

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, m, *ab, = map(int, open(0).read().split())
    p = [-1] * (n + 1)

    def find(x):
        while p[x] > 0:
            x = p[x]
        return x

    def union(i, j):
        pi, pj = find(i), find(j)
        if pi == pj:
            return
        if p[pi] < p[pj]:
            pi, pj = pj, pi
            i, j = j, i
        p[pi] += p[pj]
        p[pj] = pi
        reconnect(j, pi)

    def reconnect(i, j):
        while p[i] > 0:
            k = p[i]
            p[i] = j
            i = k

    for i, j in zip(ab[::2], ab[1::2]):
        union(i, j)

    print(-min(p))


if __name__ == '__main__':
    main()
print '%d %d' % (a, b)

### FIXED CODE ###

a, b = map(int, raw_input().split())
print a*b, (a+b)*2
import operator as op
from io import StringIO
from collections import *
from functools import *
from math import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    #y = reduce(gcd, xs)
    r, g, b, n = xs #map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass


### FIXED CODE ###

import operator as op
from io import StringIO
from collections import *
from functools import *
from fractions import gcd
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    xs = list(map(int, next(inputs).split()))
    y = reduce(gcd, xs)
    r, g, b, n = map(op.floordiv, xs, [y]*4)
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r*i
        for j in range(1 + (n_r // g)):
            if (n_r - g*j) % b == 0:
                #print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def main():
    # N=int(input())
    N,M = list(map(int,input().split()))
    a = list(map(int,input().split()))
    c = [2,5,5,4,5,6,3,7,6]
    dp = [-1e7 for _ in range(N+1)]
    dp[0] = 0
    for i in range(1,N+1):
        for j in a:
            dp[i] = max(dp[i],dp[i-c[j-1]]+1)
    ans = ""
    now = N
    for _ in range(dp[N]):
        ag = -1
        ma = -1
        for j in a:
            if now - c[j-1] < 0:
                continue
            if dp[now]!=dp[now-c[j-1]]+1:
                continue
            if j > ma:
                ma = j
        now -= c[ma-1]
        ans += str(ma)
    print(ans)

if __name__=='__main__':
    main()

### FIXED CODE ###


def main():
    # N=int(input())
    N,M = list(map(int,input().split()))
    a = list(map(int,input().split()))
    c = [2,5,5,4,5,6,3,7,6]
    dp = [int(-1e7) for _ in range(N+1)]
    dp[0] = 0
    for i in range(1,N+1):
        for j in a:
            if i-c[j-1]>=0:
                dp[i] = max(dp[i],dp[i-c[j-1]]+1)
    ans = ""
    now = N
    for _ in range(dp[N]):
        ag = -1
        ma = -1
        for j in a:
            if now - c[j-1] < 0:
                continue
            if dp[now]!=dp[now-c[j-1]]+1:
                continue
            if j > ma:
                ma = j
        now -= c[ma-1]
        ans += str(ma)
    print(ans)

if __name__=='__main__':
    main()
def encode(s):
#  r = [0]*26
#  for n in range(len(s)):
#    r[ord(s[n]) - ord('a')] += 1
#  return r
#  r = list(s)
#  r.sort()
#  return r
  r = 0
  for n in range(len(s)):
    so = ord(s[n]) - ord('a')
    r += 11**so
  return r

N = int(input())

S = []

for n in range(N):
  s = str(input())
  S = S + [encode(s)]

S.sort()
ptint('a')
ct = 0
M=1
ps=""
for cs in S:
  if cs==ps:
    M+=1
  else:
    ct += int((M**2-M)/2)
    M=1
    ps=cs
ct += int((M**2-M)/2)

print(ct)
      
  

### FIXED CODE ###

A,B = map(int,input().split())

x1=A+B
x2=A-B
x3=A*B

print(max(x1,max(x2,x3)))
N = int(input())

# ans = 1
# mac_c = 0
# for i in range(2, N+1):
#     c_count = 0
#     temp_i = i
#     while True:
#         if temp_i % 2 != 0:
#             break
#         temp_i /= 2
#         c_count += 1
#     if mac_c <= c_count:
#         mac_c = c_count
#         ans = i

# 別解
# 100以内の数で2の累乗を求めればいい
ans_list = [2**i for i in range(7)]
ans = max([i for i in ans_list if N > i])
print(ans)

### FIXED CODE ###

N = int(input())

ans = 1
mac_c = 0
for i in range(2, N+1):
    c_count = 0
    temp_i = i
    while True:
        if temp_i % 2 != 0:
            break
        temp_i /= 2
        c_count += 1
    if mac_c <= c_count:
        mac_c = c_count
        ans = i

print(ans)
#from functools import reduce
N = int(input())
Xs = list(map(int,input().split()))
Xs_ = sorted(Xs)
print(sum([Xs_[i]* (2**(-n+i-1)) if i != 0 else Xs_[i]*(2**(-n)) for i in range(N)]))

### FIXED CODE ###

#from functools import reduce
N = int(input())
Xs_ = sorted(map(int,input().split()))
print(sum([Xs_[i]*(2**(-N+1)) if i == 0 else Xs_[i]* (2**(-N+i)) for i in range(N)]))
n,q = map(int, input().split())
a_b = [list(map(int, input().split())) for _ in range(n-1)]
p_x = [list(map(int, input().split())) for _ in range(q)]

v = [[] for i in range(n)]
for e in a_b:
    v[e[0]-1].append(e[1]-1)
    v[e[1]-1].append(e[0]-1)
score = [0 for i in range(n)]
for e in p_x:
    score[e[0]-1]+=e[1]
result = [0 for i in range(n)]
def dfs(p, visited):
    if len(visited)==n:
        print(*score)
        return
    if visited ==[]:
        visited.append(p)
    for c in v[p]:
        if not c in visited:
            visited.append(c)
            score[c]+=score[p]
            dfs(c, visited)
dfs(0, [])

### FIXED CODE ###

import sys
from collections import deque
sys.setrecursionlimit(1000000)

n,q = map(int, input().split())
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(n-1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(q)]

v = [deque([]) for i in range(n)]
for e in a_b:
    v[e[0]-1]+=[e[1]-1]
    v[e[1]-1]+=[e[0]-1]
score = [0 for i in range(n)]
for e in p_x:
    score[e[0]-1]+=e[1]
def dfs(p, bp=-1):
    while v[p]:
        c =v[p].popleft()
        if c ==bp:
            continue
        #print(p, c, bp)
        score[c]+=score[p]
        dfs(c, bp=p)
visited = [0]                
dfs(0)
print(*score)
s = list(input())
ss = list(set(s))
if ss == 2:
  if count(ss[0]) == 2 and count(ss[1]);
    print('Yes')
  else:
    print('No')
else:
  print('Yes')

### FIXED CODE ###

if len(set(input())) == 2:
  print('Yes')
else:
  print('No')
import numpy as np
a = [list(input()) for i in range(3)]
a = np.ravel(a)
n = int(input())
b = [input() for i in range(n)]
ans = 'No'
for i in b:
    for j in range(3):
        if i in a[j*3:j*3+2] or i in a[j:j+6:3]:
            ans = 'Yes'
if b in a[0:8:4] or b in a[2:6:2]:
    ans = 'Yes'
print(ans)


### FIXED CODE ###

# ABC157 B
import numpy as np
a = [[input().split() for l in range(3)]]
a = np.ravel(a)
n = int(input())
b = [input() for i in range(n)]
ans = 'No'

def check(a,b):
    return set(a).issubset(b)

for i in range(3):
    if check(a[i*3:(i*3)+3],b) or check(a[i:i+7:3],b) or check(a[0:9:4],b) or check(a[2:7:2],b):
        ans = 'Yes'

print(ans)
def main()
	n = input()
  	arr = list(map(input().split()))
    if 0 in arr:
        print(0)
        return
  	prod = 1
    for x in arr:
        prod *= x
        if prod > int(1e18):
            print(-1)
            return
    print(prod)

if __name__ = "__main__":
	main()

### FIXED CODE ###

def main():
    n = int(input())
    arr = list(map(int, input().split()))
    if 0 in arr:
        print(0)
        return
    prod = 1
    for x in arr:
        prod *= x
        if prod > int(1e18):
            print(-1)
            return
    print(prod)

if __name__ == "__main__":
    main()