Harryxun/stf_run huggingface dataset:
N = int(input())
List = list(map(int,input().split()))
List_ans = []
List.sort()
for x in range(N-1):
  if List[x]==List[x+1]:
    List_ans.append(List[x])
M = max(List_ans)
m = min(List_ans)
print(M*m)

### FIXED CODE ###

N = int(input())
List = list(map(int,input().split()))
List_t = []
List_q = []
List.sort()
for x in range(N-1):
  if List[x]==List[x+1]:
    List_t.append(List[x])
for x in range(N-3):
  if List[x]==List[x+1]==List[x+2]==List[x+3]:
    List_q.append(List[x])

if len(List_q) == 0:
  if len(List_t)<=1:
    print(0)
  else:
    M = sorted(set(List_t))[-1]
    m = sorted(set(List_t))[-2]
    print(M*m)
else:
  M_q = sorted(set(List_q))[-1]
  M_t = sorted(set(List_t))[-1]
  m = sorted(set(List_t))[-2]
  print(max([M_q**2,M_t*m]))
import math
import itertools
n = int(input())

if(n %2 == 1):
    d = int((n-1)/2) + 1
else:
    d = int(n/2)

ans = d/n

print(f'{ans:.08f}')

### FIXED CODE ###

import math
import itertools
n = int(input())
 
if(n %2 == 1):
    d = int((n-1)/2) + 1
else:
    d = int(n/2)
 
ans = d/n
 
print('{:.08f}'.format(ans))
from collections import deque
n,m = map(int,input().split())

b = [[] for i in range(n)]
for i in range(m):
    a=list(map(int,input().split()))
    b[a[1]-1].append(a[0])
    b[a[0]-1].append(a[1])
    
c = [-1 for i in range(n)]
c[0] = 0
q = deque([1])
now = 0
count = 0
while q:
    print(c,q, now)
    count = count + 1
    if count > n:
        print("No")
        exit()
    now = q.popleft() - 1
    for i in range(len(b[now])):
        #count = count + 1
        #print(now+1, "=>", b[now][i])
        if c[b[now][i] - 1] == -1:
            q.append(b[now][i])
            c[q[-1] - 1] = now + 1
            #print(c)
            
#print(count)
print("Yes")
for i in range(1,len(c)):
    print(c[i])

### FIXED CODE ###

from collections import deque
n,m = map(int,input().split())

b = [[] for i in range(n)]
for i in range(m):
    a=list(map(int,input().split()))
    b[a[1]-1].append(a[0])
    b[a[0]-1].append(a[1])
    
c = [-1 for i in range(n)]
c[0] = 0
q = deque([1])
now = 0
count = 0
while q:
    #print(c,q, now)
    count = count + 1
    if count > n:
        print("No")
        exit()
    now = q.popleft() - 1
    for i in range(len(b[now])):
        #count = count + 1
        #print(now+1, "=>", b[now][i])
        if c[b[now][i] - 1] == -1:
            q.append(b[now][i])
            c[q[-1] - 1] = now + 1
            #print(c)
            
#print(count)
print("Yes")
for i in range(1,len(c)):
    print(c[i])
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N,K,Q=map(int,input().split())

A=[int(input()) for _ in range(Q)]
S=[K-Q]*N


for i in range(K):
	S[A[i]-1]+=1	
	
print(S)
for k in range(N):
	if S[k]>0:
		print("Yes")
	else:
		print("No")
	

### FIXED CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N,K,Q=map(int,input().split())

A=[int(input()) for _ in range(Q)]
S=[K-Q]*N


for i in range(Q):
	S[A[i]-1]+=1	
	
for k in range(N):
	if S[k]>0:
		print("Yes")
	else:
		print("No")
import sys

ar = []
x = sys.stdin.readline()
x = x.split(' ')
(n,m)=[int(str) for str in x]

ret = 0
chk = []
for i in range(m):
  x = sys.stdin.readline()
  x = x.split(' ')
  (s,c)=[int(str) for str in x]
  if not ( s in chk):
    if(n-s>=0):
      ret += c*10**(n-s)
      chk.append(s)
  else:
      if( c != int(ret/10**(n-s))):
        print("-1")
        exit(0)


if( ret == 0 and n == 1):
  print("0")
  exit(0)
if( ret < 10**(n-1)):
  if not ( n-1 in chk):
    print(ret+10**(n-1))
  else:
    print("-1")
else:
  print(ret)
sys.stdout.flush()


### FIXED CODE ###

import sys

x = sys.stdin.readline()
x = int((int(x)+1)/2)
print(x)

sys.stdout.flush()
N,Q = map(int, input().split())
graph = [[] for _ in range(N)]
counter = [0]*N
for i in range(N-1):
    a,b = map(int, input().split()) 
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

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

def dfs(v, parent):
    for i in graph[v]:
        if i==parent:
            continue
        counter[i] += counter[v]
        dfs(i, v)
        
dfs(0, -1)
print(*counter) 

### FIXED CODE ###

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

N,Q = map(int, input().split())
graph = [[] for _ in range(N)]
counter = [0]*N
for i in range(N-1):
    a,b = map(int, input().split()) 
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

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

def dfs(v, parent):
    for i in graph[v]:
        if i==parent:
            continue
        counter[i] += counter[v]
        dfs(i, v)
        
dfs(0, -1)
print(*counter)
from functools import reduce

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

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

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

def lcm(n):
  return reduce(lcm_base, n)

f = 0
for i in a:
  f += lcm(a) - 1 % i

print(int(f))


### FIXED CODE ###

n = int(input())
print(sum(list(map(int, input().split()))) - n)
a,b=map(int,input().split())
count=0
for i in range(a,b+1):
  if i==i[::-1]:
    count+=1
print(count)

### FIXED CODE ###

a,b=map(int,input().split())
count=0
for i in range(a,b+1):
  i=str(i)
  if i==i[::-1]:
    count+=1
print(count)
N, M = map(int, input().split())
if N == M:
    print("Yes")
else:
    Print("No")

### FIXED CODE ###

N, M = map(int, input().split())
if M == N:
    print('Yes')
else:
    print('No')
s,t=input(),input()
d={"a":0,"b":0,"c":0,"d":0,"e":0,"f":0,"g":0,"h":0,"i":0,"j":0,"k":0,"l":0,"m":0,"n":0,"o":0,"p":0,"q":0,"r":0,"s":0,"t":0,"u":0,"v":0,"w":0,"x":0,"y":0,"z":0}
for i,j in s,t:
  if d[i]==0:d[i]=j
  elif d[i]!=j:print("No");exit()
  if d[j]==0:d[j]=i
  elif d[j]!=i:print("No");exit()
print("Yes")


### FIXED CODE ###

s,t=input(),input()
rs=[""for _ in range(26)]
rt=[""for _ in range(26)]
def a(n):return [chr(ord('a')+i)for i in range(26)].index(n)
for i in range(len(s)):
  ss,tt=a(s[i]),a(t[i])
  if rs[ss]=="":rs[ss]=t[i]
  elif rs[ss]!=t[i]:print("No");exit()
  if rt[tt]=="":rt[tt]=s[i]
  elif rt[tt]!=s[i]:print("No");exit()
print("Yes")
X,t = map(int,input().split())
print(max(X-t),0)

### FIXED CODE ###

X,t = map(int,input().split())
print(max(X-t,0))
a,b,c=map(str, input().split())
if a[len(a)]==b[0] and b[len(b)]==c[0]:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

a,b,c=map(str, input().split())
if a[len(a)-1]==b[0] and b[len(b)-1]==c[0]:
  print('YES')
else:
  print('NO')
l = int(input())
d = l/3
print(d^3)

### FIXED CODE ###

l = int(input())
d = l/3
print(d**3)
# coding: UTF8
a, b, h = list(map(int, int(input()).split("\n"))) 

S = int((a + b) * h // 2)
print(S)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
 
print(int((a+b)*h//2))
x,a,b = tuple(map(int,input().split()))

if b-a=<x:
  print("delicious")
else:
  print("dangerous")

### FIXED CODE ###

x,a,b = tuple(map(int,input().split()))
 
if a-b>=0 :
  print("delicious")
elif b-a<=x:
  print("safe")
else:
  print("dangerous")
n,m = map(int,input().split())
a = []
mod = 10**9+7
d = [0 for i in range(n+1)]
d[0] = 1
d[1] = 1
d[2] = 2
for i in range(3,n+1):
    d[i] = d[i-1] + d[i-2]
d.append(0)
if m != 0:
    for i in range(m):
        b = int(input())
        a.append(b)
    ans = 1
    if a[0] == 1:
        ans = 1
    else:
        ans = ans*d[a[0]-1]%mod
    for i in range(m-1):
        ans = ans*d[a[i+1]-a[i]-2]%mod
    ans = ans*d[n-a[m-1]-1]%mod
else:
    ans = d[n]
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
a = []
mod = 10**9+7
d = [0 for i in range(n+1)]
d[0] = 1
d[1] = 1
if n >1 :
    d[2] = 2
for i in range(3,n+1):
    d[i] = d[i-1] + d[i-2]
if m != 0:
    d.append(0)
    for i in range(m):
        b = int(input())
        a.append(b)
    ans = 1
    if a[0] == 1:
        ans = 1
    else:
        ans = ans*d[a[0]-1]%mod
    for i in range(m-1):
        ans = ans*d[a[i+1]-a[i]-2]%mod
    ans = ans*d[n-a[m-1]-1]%mod
else:
    ans = d[n]%mod
print(ans)
x = int(input())
for i in range(-200, 200):
  for j in range(-200, 200):
    if i**5-j**5 == x):
      print(i, j)
      exit()

### FIXED CODE ###

import sys

x = int(input())

for i in range(-200, 200):
    for j in range(-200, 200):
        if i**5 - j**5 == x:
            print(i, j)
            sys.exit()
X = int(input())

if X == 1:
  print(1)
  exit()

ans = 0

for b in range(2, int(x**0.5)+2):
  temp = b
  while temp <= X:
    ans = max(ans, temp)
    temp *= b

print(ans)

### FIXED CODE ###

X = int(input())

if X == 1:
  print(1)
  exit()

ans = 0

for b in range(2, int(X**0.5)+2):
  temp = b
  while temp <= X:
    ans = max(ans, temp)
    temp *= b

print(ans)
import sys
import math
MOD = 10 ** 9 + 7

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def mod_inv(a):
    x = extgcd(a,MOD)[0]
    return (MOD+x%MOD)%MOD

input = sys.stdin.readline
n,a,b = map(int,input().split())
x1 = 1

a = min(a,n-a)
b = min(b,n-b)
if a > b:
    a,b = b,a

for i in range(n-a+1,n+1):
    x1 = x1 * i % MOD
for i in range(1,a+1):
    x1 = x1 * pow(i,MOD-2,MOD)

x2 = x1
for i in range(n-b+1,n-a+1):
    x2 = x2 * i % MOD
for i in range(a+1,b+1):
    x2 = x2 * mod_inv(i,MOD-2,MOD)
    x2 = x2 % MOD

t = []
nn = n
while nn > 0:
    t.append(nn % 2)
    nn //= 2
x0 = 1
for i in range(len(t)):
    x0 = x0 ** 2
    x0 = x0 % MOD
    if t[len(t)-i-1] == 1:
        x0 *= 2
        x0 = x0 % MOD
print ((x0 - x1 - x2 - 1) % MOD)




### FIXED CODE ###

import sys
import math
MOD = 10 ** 9 + 7

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def mod_inv(a):
    x = extgcd(a,MOD)[0]
    return (MOD+x%MOD)%MOD

input = sys.stdin.readline
n,a,b = map(int,input().split())
x1 = 1

a = min(a,n-a)
b = min(b,n-b)
if a > b:
    a,b = b,a

for i in range(n-a+1,n+1):
    x1 = x1 * i % MOD
x11 = 1
for i in range(1,a+1):
    x11 = x11 * i % MOD
x1 = x1 * mod_inv(x11) % MOD

x2 = x1
for i in range(n-b+1,n-a+1):
    x2 = x2 * i % MOD
x21 = 1
for i in range(a+1,b+1):
    x21 = x21 * i % MOD
x2 = x2 * mod_inv(x21) % MOD

t = []
nn = n
while nn > 0:
    t.append(nn % 2)
    nn //= 2
x0 = 1
for i in range(len(t)):
    x0 = x0 ** 2
    x0 = x0 % MOD
    if t[len(t)-i-1] == 1:
        x0 *= 2
        x0 = x0 % MOD
print ((x0 - x1 - x2 - 1) % MOD)
from math import factorial

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

def comb(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

for k, val in enumerate(A):
    count = 0
    nums = [0] * N
    for i, v in enumerate(A):
        if k == i:
            continue
        nums[v] += 1
    combs = list(map(lambda n: int(comb(n, 2)), filter(lambda n: n > 1, nums)))
    print(sum(combs))

### FIXED CODE ###

from math import factorial

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

def comb(n, r):
    if n - r < 0:
        return 0
    else:
        return factorial(n) // (factorial(n - r) * factorial(r))

nums = [0] * (N + 1)
for i, v in enumerate(A):
    nums[v] += 1
combs = list(map(lambda n: comb(n, 2), nums))
total = sum(combs)

for k, val in enumerate(A):
    print(total - (nums[val] - 1))
N=int(input())
St=[int(x) for x in input().split()]
num=1
out=[]
while num<=N:
  for i in range(N):
    if St[i] ==num:
      out.append(i)
      num+=1

for i in range(N):
  print(out[i]+1,end=" ")
    

### FIXED CODE ###

N=int(input())

if N%2==0:
  print(float(0.5))

else:
  s=float(((N+1)/2)/N)
  print(s)
INF = 1000000007

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

for i in range(len(a)):
    for j in range(len(a)):
        if i == j: continue
        #print(a[i], a[j])
        if a[i] > a[j]:
            if i < j:
                ans_i += 1
            else:
                ans_e += 1
x = ans_i * k
ans = ans_i + ans_e
y = ans * (k * (k-1) )// 2)
print(int((x + y) % INF))


### FIXED CODE ###

INF = 1000000007

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

for i in range(len(a)):
    for j in range(len(a)):
        if i == j: continue
        #print(a[i], a[j])
        if a[i] > a[j]:
            if i < j:
                ans_i += 1
            else:
                ans_e += 1
x = ans_i * k
ans = ans_i + ans_e
y = ans * ((k * (k-1) ) // 2)
print(int((x + y) % INF))
d = int(input())
if d=25:
	print("Christmas")
if d=24:
	print("Christmas Eve")
if d=23:
	print("Christmas Eve Eve")
if d=22:
	print("Christmas Eve Eve Eve")

### FIXED CODE ###

d = int(input())
if d==25:
    print("Christmas")
if d==24:
    print("Christmas Eve")
if d==23:
    print("Christmas Eve Eve")
if d==22:
    print("Christmas Eve Eve Eve")
n = int(input())
cards = []
for i in range(n):
    s, a = input().split()
    cards.append((s, a))
l = [(s, a) for s in "SHCD" and  a in range(1,14) and (s,a)not in cards]
for b in l:
    print(s + " " + a)

### FIXED CODE ###

n = int(input())
cards = []
for i in range(n):
    s, a = input().split()
    cards.append((s, int(a)))
l = [(s, a) for s in "SHCD" for a in range(1,14) if (s,a)not in cards]
for s, a in l:
    print(s + " " + str(a))
N = int(input())
l = [None]*N
s = []
for i in range(N):
    k = list(map(int,input().split()))
    if k[0]==k[1]:
        s.append(k)
    else:
        l[i] = k

if len(s)>1:
    print("No")
else:
    l = sorted(l, key=lambda x: x[1])
    cnt = 0
    if len(k)==1:
        cnt += s[0][1]

    flag = True
    for j in l:
        if j==None:
            continue
        else:
            cnt += j[0]
        if cnt>j[1]:
            print("No")
            flag = False
            break
    if flag:
        print("Yes")

### FIXED CODE ###

N = int(input())
l = [None]*N
s = []
for i in range(N):
    k = list(map(int,input().split()))
    if k[0]==k[1]:
        s.append(k)
        l[i] = [0,0]
    else:
        l[i] = k

if len(s)>1:
    print("No")
else:
    l = sorted(l, key=lambda x: x[1])
    cnt = 0
    if len(s)==1:
        cnt += s[0][1]

    flag = True
    for j in l:
        if j==[0,0]:
            continue
        else:
            cnt += j[0]
        if cnt>j[1]:
            print("No")
            flag = False
            break
    if flag:
        print("Yes")
import sys
n=sys.argv
print(n*n*n)

### FIXED CODE ###

n=input()
num=int(n)
print(num*num*num)
A,B = map(int,input().split())
if A+B==3:
  print(3)
elif A+B==4:
  print(2)
elif A+B==5:
  print(1)

### FIXED CODE ###

a = int(input())
b = int(input())
if a+b == 3:
  print(3)
elif a+b == 4:
  print(2)
else:
  print(1)
import math
n, d = map(int, input().split())
a = int(math.seil(n/(2*d+1)))
print(a)


### FIXED CODE ###

n, d = map(int, input().split())
a = int((n+2*d)/(2*d+1))
print(a)
(a,b,c) = (int(input()),int(input()),int(input()))
s = (a+b)*h/2
print(s)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
s = (a+b)*h/2
print(int(s))
import math
a, b, c, d = list(map(int, input().split()))
e = c * d / math.gcd(c, d)

cko = math.floor(b/c) - math.ceil(a/c) + 1
dko = math.floor(b/d) - math.ceil(a/d) + 1
cdko = math.floor(b/e) - math.ceil(a/e) + 1
print(b-a+1-cko-dko+cdko)

### FIXED CODE ###

import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)

cko = b//c - (a-1)//c
dko = b//d - (a-1)//d
eko = b//e - (a-1)//e
print(b-a+1-cko-dko+eko)
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0]*N
dp[0] = 0
dp[1]=abs(h[1]-h[0])
for i in range(2,N):
  dp[i] += min(dpj+abs(hj-h[i]) for dpj,hj in zip(dp[i-K:i],h[i-K:i])
print(dp[-1])

### FIXED CODE ###

import numpy as np
N,K = map(int,input().split())
h = list(map(int,input().split()))
h = np.array(h)
dp = [0]*N
dp = np.array(dp)
dp[1]=abs(h[1]-h[0])
for i in range(1,N):
  j = max(0,i-K)
  dp[i] = min(dp[j:i]+abs(h[i]-h[j:i]))
print(dp[N-1])
# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Grand Contest 024 B問題 WA
Author     : Kitaura Hiromi
LastUpdate : 20180520
Since      : 20180520
"""
N = int(input())
p = [int(input()) for i in range(N)]
q = [0] * N
for i in range(N):
    q[p[i]-1] = i

cnt = 1
for i in range(N-1):
    if q[i+1] - q[i] > 0:
        cnt += 1
    else:
        max_cnt = max(max_cnt, cnt)
        cnt = 1
print(N - max_cnt)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Contents   : AtCoder Grand Contest 024 B問題 WA
Author     : Kitaura Hiromi
LastUpdate : 20180520
Since      : 20180520
"""
N = int(input())
p = [int(input()) for i in range(N)]
q = [0 for i in range(N)]
for i in range(N):
    q[p[i]-1] = i

cnt = 1
max_cnt = 1
for i in range(N-1):
    if q[i+1] > q[i]:
        cnt += 1
    else:
        max_cnt = max(max_cnt, cnt)
        cnt = 1
max_cnt = max(max_cnt, cnt)
print(N - max_cnt)
n = input()
 
if (n[0] == n[1] == n[2] or (n[1] == n[2] == n[3]):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = input()
if(N[0] == N[1] == N[2] or
   N[1] == N[2] == N[3]):
    print('Yes')
else:
    print('No')
def main():
    from itertools import combinations
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    cc = combinations(range(n), (n-1)//2+1)
    m = 10**9
    for c in cc:
        memo1 = []
        memo2 = []
        for i in c:
            if i % 2 == 0:
                memo1.append((a[i], i))
            else:
                memo1.append((b[i], i))
        for i in set(range(n))-set(c):
            if i % 2 == 1:
                memo2.append((a[i], i))
            else:
                memo2.append((b[i], i))
        memo1.sort()
        memo2.sort()
        memo = []
        for i in range(n//2):
            memo.append(memo1[i])
            memo.append(memo2[i])
        if n % 2 == 1:
            memo.append(memo1[i+1])
        flag = 0
        for i in range(n-1):
            if memo[i][0] > memo[i+1][0]:
                flag = 1
                break
        if flag == 1:
            continue
        memo = [i for j, i in memo]
        cnt = 0
        for i in range(n-1):
            for j in range(i+1, n):
                if memo[i] > memo[j]:
                    cnt += 1
        m = min(cnt, m)
    if m == 10**9:
        print(-1)
    else:
        print(m)


main()


### FIXED CODE ###

def main():
    from itertools import combinations
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    cc = combinations(range(n), (n-1)//2+1)
    m = 10**9
    if n == 1:
        print(0)
        return
    for c in cc:
        memo1 = []
        memo2 = []
        for i in c:
            if i % 2 == 0:
                memo1.append((a[i], i))
            else:
                memo1.append((b[i], i))
        for i in set(range(n))-set(c):
            if i % 2 == 1:
                memo2.append((a[i], i))
            else:
                memo2.append((b[i], i))
        memo1.sort()
        memo2.sort()
        memo = []
        for i in range(n//2):
            memo.append(memo1[i])
            memo.append(memo2[i])
        if n % 2 == 1:
            memo.append(memo1[i+1])
        flag = 0
        for i in range(n-1):
            if memo[i][0] > memo[i+1][0]:
                flag = 1
                break
        if flag == 1:
            continue
        memo = [i for j, i in memo]
        cnt = 0
        for i in range(n-1):
            for j in range(i+1, n):
                if memo[i] > memo[j]:
                    cnt += 1
        m = min(cnt, m)
    if m == 10**9:
        print(-1)
    else:
        print(m)


main()
import sys
H,W = map(int, input().split())
C = [list(map(int,i.split())) for i in sys.stdin.readlines()]
G =[[None for i in range(W)] for j in range(H)]

ans = []
for i in range(W):
  if C[0][i] == 0:
      G[0][i] = 1
      ans.append(1)
  else: G[0][i] = 0
for i in range(H):
  if C[i][0] == 0:
      G[i][0] = 1
      ans.append(1)
  else: G[i][0] = 0


for i in range(1,H):
    for j in range(1,W):
        if C[i][j] == 0:
            G[i][j] = min(G[i-1][j], G[i][j-1],G[i-1][j-1]) + 1
            ans.append(G[i][j])
        else:G[i][j] = 0

ans = max(ans) ** 2
print(str(ans))

### FIXED CODE ###

import sys
H,W = map(int, input().split())
C = [list(map(int,i.split())) for i in sys.stdin.readlines()]
G =[[None for i in range(W)] for j in range(H)]

for i in range(W):
  if C[0][i] == 0:
      G[0][i] = 1
  else: G[0][i] = 0
for i in range(H):
  if C[i][0] == 0:
      G[i][0] = 1
  else: G[i][0] = 0


for i in range(1,H):
    for j in range(1,W):
        if C[i][j] == 0:
            G[i][j] = min(G[i-1][j], G[i][j-1],G[i-1][j-1]) + 1
        else:G[i][j] = 0

ans = max(max(i) for i in G) ** 2
print(str(ans))
import numpy as np
h, w = map(int,input().split())
f = lambda:list(map(str,input().split()))
g = []
for i in range(h):
  li = f()
  g.append(li)
#print(g)
dp = np.zeros((h,w))
dp[0][0] = 1
#print(g[1][0] == '.')
#print(g[1][0])
#print(g[0][3])
mod = 10**9+7
for i in range(h):
  for j in range(w):
    if i+1<h and g[i+1][j] == '.':
      dp[i+1][j] = (dp[i+1][j] + dp[i][j])%mod
    if j+1<w and g[i][j+1] == '.':
      dp[i][j+1] = (dp[i][j+1] + dp[i][j])%mod
print(dp[-1][-1])

### FIXED CODE ###

h, w = map(int,input().split())
g = [list(input()) for _ in range(h)]
#print(g)
dp = [[0]*w for _ in range(h)]
dp[0][0] = 1
#print(g[1][0] == '.')
#print(g[1][0])
#print(g[0][3])
mod = 10**9+7
for i in range(h):
  for j in range(w):
    if i+1<h and g[i+1][j] == '.':
      dp[i+1][j] = (dp[i+1][j] + dp[i][j])%mod
    if j+1<w and g[i][j+1] == '.':
      dp[i][j+1] = (dp[i][j+1] + dp[i][j])%mod
print(dp[-1][-1])
N=int(input())
x = [list(map(int, input().split())) for i in range(N)]
count=0
for i in range(N-2):
  if x[i][0]==x[i][1] and x[i+1][0]==x[i+1][1] and x[i+2][0]==x[i+2][1]:
     count=count+1
  else:
     count=count
else:
  if count>0 :
    print'Yes'
  else :
    print'No'

### FIXED CODE ###

N=int(input())
x = [list(map(int, input().split())) for i in range(N)]
count=0
for i in range(N-2):
  if x[i][0]==x[i][1] and x[i+1][0]==x[i+1][1] and x[i+2][0]==x[i+2][1]:
     count=count+1
  else:
     count=count+0
else:
  if count>0 :
    print('Yes')
  else :
    print('No')
#!/usr/bin/python3

import numpy as np

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

sorted_num = np.sort((nums))

res = 1
for i in range(sorted_num[1], 0, -1):
    nums_div_i = np.remainder(nums, i)

    nums_div_i = nums_div_i > 0
    d = np.sum(np.ones(N) * nums_div_i)
    if d == 1 or d == 0:
        res = i
        break

print(res)


### FIXED CODE ###

#!/snap/bin/pypy3
def gcd(a, b):
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


def main():
    N = int(input())
    nums = list(map(int, input().split()))

    L = [0 for _ in range(N + 1)]
    R = [0 for _ in range(N + 1)]

    for i, num in enumerate(nums):
        L[i + 1] = gcd(L[i], num)

    for i in range(N - 2, -1, -1):
        R[i] = gcd(R[i + 1], nums[i + 1])

    print(max(gcd(L[i], R[i]) for i in range(N)))


if __name__ == '__main__':
    main()
[a, b] = [int(_) for _ in input().split()]
print(a*b + " " + (a+b)*2)

### FIXED CODE ###

[a, b] = map(int, input().split())
print(a*b, (a+b)*2)
# 2019 9.1
# A Tenki

S = list(input())
T = list(input())

cnt = 0

for i in range(3):
    if S[i] == T[i]:
        cnt += 1

print(cnt)

### FIXED CODE ###

# 2019 9.1
# Power Socket

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

kuti = 1
cnt = 0

while kuti < B:
    kuti += A - 1
    cnt += 1

print(cnt)
print(A * B)

### FIXED CODE ###

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