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

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

# ユークリッドの互除法
ans = 1
for j in range(n):
    x = a.pop(j)
    # print(a)
    b = a[0]
    for i in range(n-1-1):
        c = a[i+1]
        r = b%c
        while r!=0:
            b = c
            c = r
            r = b%c
        # print(c)
        b = min(b, c) # bを更新
    ans = max(ans, b)
    # print(ans)
    a.insert(j, x) # xを戻す
print(ans)


### FIXED CODE ###

def gcd(x, y):
    while y!=0:
        x, y = y, x % y # x,yの大小が逆でも、入れ替わるので、OK
    return x

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

if n == 2:
    print(max(a))

elif n>=3:
    l = [-1] * n
    r = [-1] * n
    l[0] = a[0]  #一番左を左に挿入
    r[-1] = a[-1] #一番右を右に挿入
# print(l)
# print(r)

    for i in range(1, n): #左から最大公約数をn-1回計算していく
        l[i] = gcd(l[i-1], a[i]) # l[0]とa[1]の最大公約数をl[1]に挿入⇒
        # l[1]とa[2]の最大公約数をl[2]に挿入。隣同士素があったら、それ以降右側全て1
    for i in range(n-2, -1, -1): #右から最大公約数を計算していく
        r[i] = gcd(r[i+1], a[i]) # r[n-1]とa[n-2]の最大公約数をr[n-2]に挿入

        # print("l",l) # lはn-1桁のlist
        # print("r",r)

    ans = max(r[1], l[-2]) # rの左から2番目とlの右から2番目の大きい方を、ansに挿入.
        # 右端、左端は、最大公約数ではないため。(元々の数列)

    for i in range(1, n-1): #両端を切り取った中で、lは右側に寄せて、rは左側に寄せているので、
        g = gcd(l[i-1], r[i+1]) #
        ans = max(ans, g)
        # print(i, g, ans)
    print(ans)
### BUGGY CODE ###

import math
import copy
m=int(input())
a=list(map(int,input().split()))
total=0
count=0
for j in range(m):
   c = a.count(j+1)
   if c>1:
      count = math.factorial(c)//math.factorial(2)//math.factorial(c-2)
      total = total + count
      count=0
for k in range(m):
    c = a.count(a[k])
    d=copy.copy(total)
    if c > 2:
        d =d - math.factorial(c)//math.factorial(2)//math.factorial(c-2)+math.factorial(c-1)//math.factorial(2)//math.factorial(c-3)
    if c==2:
        d= d-1
    print(d)


### FIXED CODE ###

import math
import collections
m=int(input())
a=list(map(int,input().split()))
A=collections.Counter(a)
total=0
for j in A.values():
    total = total + j*(j-1)//2
for k in range(m):
    s=A[a[k]]
    d=total-s+1
    print(d)
### BUGGY CODE ###

import math
# from collections import Counter

# N = int(input()) # 1行, 単数
# arg = list(map(int, input().split())) # 1行, 配列
# D = Counter(arg) # 出現数カウント

# print('Yes')
# print('No')
# print()
import collections
N = int(input()) # 1行, 単数
A = list(map(int, input().split())) # 1行, 配列
Q = int(input()) # 1行, 単数
counter = collections.Counter(A)

while True:
  try:
    # ans = 0
    B,C = list(map(int, input().split())) # 1行, 配列
    # counter[C] = counter[C] + counter[B]
    # del counter[B]
    # for i in counter.keys():
    #   ans = ans + i * counter[i]
    A = [C if i == B else i for i in A]
    
    print(sum(A))
  except:
    break;

### FIXED CODE ###

import math
# from collections import Counter

# N = int(input()) # 1行, 単数
# arg = list(map(int, input().split())) # 1行, 配列
# D = Counter(arg) # 出現数カウント

# print('Yes')
# print('No')
# print()
import collections
N = int(input()) # 1行, 単数
A = list(map(int, input().split())) # 1行, 配列
Q = int(input()) # 1行, 単数
counter = collections.Counter(A)
ans = 0
for i in counter.keys():
  ans = ans + i * counter[i]

while True:
  try:

    B,C = list(map(int, input().split())) # 1行, 配列
    old = C * counter[C] + counter[B] * B
    counter[C] = counter[C] + counter[B]
    del counter[B]
    new = C * counter[C]
    ans = ans + (new - old)
    print(ans)
  except:
    break;
### BUGGY CODE ###

N = int(input())
s = list(input())
# N: 処理する区間の長さ
N0 = 2**(N-1).bit_length()
id_ele = [0,set()]
data = [id_ele]*(2*N0)
# a_k の値を x に更新
def segfunc(x,y):
    return (len(x[1]|y[1]),x[1]|y[1])

def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = segfunc(data[2*k+1], data[2*k+2])
# 区間[l, r)の最小値
def query(l, r):
    L = l + N0; R = r + N0
    s = id_ele
    while L < R:
        if R & 1:
            R -= 1
            s = segfunc(s, data[R-1])

        if L & 1:
            s = segfunc(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s

for i in range(N):
  update(i,(1,set(s[i])))
q = int(input())
for _ in range(q):
  p,a,b = input().split()
  if p == "1":
    update(int(a)-1,(1,set(b)))
  if p == "2":
    print(query(int(a)-1,int(b))[0])
    

### FIXED CODE ###

def main():
  import sys
  input = sys.stdin.readline
  n = int(input())
  s = list(input())

  def segfunc(x,y):
      return x|y

  def init(init_val):
      #set_val
      for i in range(n):
          seg[i+num-1]=init_val[i]    
      #built
      for i in range(num-2,-1,-1) :
          seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
      
  def update(k,x):
      k += num-1
      seg[k] = x
      while k:
          k = (k-1)//2
          seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
      
  def query(p,q):
      if q<=p:
          return ide_ele
      p += num-1
      q += num-2
      res=ide_ele
      while q-p>1:
          if p&1 == 0:
              res = segfunc(res,seg[p])
          if q&1 == 1:
              res = segfunc(res,seg[q])
              q -= 1
          p = p//2
          q = (q-1)//2
      if p == q:
          res = segfunc(res,seg[p])
      else:
          res = segfunc(segfunc(res,seg[p]),seg[q])
      return res

  #####単位元######
  ide_ele = 0

  #num:n以上の最小の2のべき乗
  num =2**(n-1).bit_length()
  seg=[ide_ele]*2*num

  A = []
  for i in range(n):
    A.append(1<<(ord(s[i])-96))
  init(A)
  q = int(input())
  for _ in range(q):
    p,a,b = input().split()
    if p == "1":
      update(int(a)-1,1<<(ord(b)-96))
    if p == "2":
      print(bin(query(int(a)-1,int(b))).count("1"))
main()
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
b = [0] * n
k = []
for i in range(n):
    for j in range(i, n):
        if (j+1) % (i+1) == 0:
            b[i] += a[j]
            b[i] = b[i] % 2
    if b[i] == 1:
        k.append(str(i+1))
if a == b:
    print(len(k))
    for kk in k:
        print(kk)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
b = [0] * n
ans = []
for i in range(n, 0, -1):
    temp = sum(b[i - 1:n:i]) % 2
    if temp != a[i - 1]:
        b[i - 1] = 1
    if b[i - 1] == 1:
        ans.append(str(i))
print(len(ans))
if len(ans) > 0:
    print(" ".join(ans))
### BUGGY CODE ###

N, *d = map(int, open(0).read().split())
for i in range(N):
    max = 0
    for j in range(N):
        if d[j] > max:
            if(i == j):
                continue
            max = d[j]
    print(max)

### FIXED CODE ###

N, *d = map(int, open(0).read().split())
allmax = max(d)
allMaxCount = d.count(allmax)
for i in range(N):
    max = 0
    if(allMaxCount > 1 or d[i] != allmax):
        max = allmax
    else:
        for j in range(N):
            if(i == j):
                continue
            if d[j] > max:
                max = d[j]
                if max == allmax:
                    break
    print(max)
### BUGGY CODE ###

import numpy as np

# メモ用
memo = np.zeros((201,201,201))
K = int(input())

count = 0

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

def gcd3(a,b,c):
    # 〇順に並べる
    # L = [a,b,c]
    # L.sort()
    # a,b,c = L[0],L[1],L[2]
    

    if memo[a,b,c] != 0:
        return memo[a,b,c]
    else:
        t = gcd(a,b)
        memo[a,b,c] = gcd(t,c) 
        return memo[a,b,c]


for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            count += gcd3(i,j,k)

print(int(count))

### FIXED CODE ###

from math import gcd

K = int(input())

ans = 0

# ３つの数の最大公約数
# ⇒まず２つの数の最大公約数をとり
# その数とのこり１つの数の最大公約数をとる
# for a in range(1,K+1):
#     for b in range(1, K+1):
#         g = gcd(a, b)
#         for c in range(1, K+1):
#             ans += gcd(g, c)

# これでは３重ループとなり200**3 = 8000000 ではLTEとなる

#　そこで、一番内側のループをなくすために、
# gcd(g,1) + gcd(g,2) + ・・・　+gcd(g,K) を先に計算しておく
L = [0] * 201

for g in range(1, K+1):
    for c in range(1, K+1):
        L[g] += gcd(g, c)


for a in range(1, K+1):
    for b in range(1, K+1):
        g = gcd(a, b)
        ans += L[g]

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

from collections import deque
n = int(input())
l = deque()

for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        l.append(cmd[1])
    if cmd[0] == 'find':
        if cmd[1] in set(l):
        	print('yes')
        else:
        	print('no')

### FIXED CODE ###

from collections import defaultdict

d = defaultdict(lambda: 0)

N = int(input())

for _ in range(N):
    ord, str = input().split()
    if ord == 'insert':
        d[str] = 1
    else:
        if str in d:
            print('yes')
        else:
            print('no')
### BUGGY CODE ###

import copy

N = input()
A = [0]*N
tmp = [0]*N

for i in range(0,N):
  tmp[i]=int(raw_input())
for i in range(0,N):
  A[i] = copy.deepcopy(tmp)

for i in range(0,N):
  A[i].pop(i)
  print max(A[i])

### FIXED CODE ###

N = int(raw_input())
A = []
for i in range(0,N):
  A.append(int(raw_input()))
A = list(enumerate(A))
A = sorted(A, key=lambda x: x[1])
max_A = A[N-1][1]
second_max_A = A[N-2][1]
A = sorted(A,key=lambda x: x[0])
for i in range(0,N):
  if A[i][1] == max_A:
    print second_max_A
  else:
    print max_A
### BUGGY CODE ###

N=int(input())
S=[input() for _ in range(N)]
S_=list(set(S))

ans=0
ans_s=[]
for s in S_:
    x=S.count(s)
    if ans<x:
        ans=x
        ans_s=[s]
    elif ans==x:
        ans_s.append(s)

ans_s.sort()

for a in ans_s:
    print(a)

### FIXED CODE ###

N=int(input())
S=[input() for _ in range(N)]
S_=list(set(S))

ans_d={s:0 for s in S_}
for s in S:
    ans_d[s]+=1

M=max(set(ans_d.values()))
for k,v in sorted(ans_d.items()):
    if v==M:
        print(k)
### BUGGY CODE ###

import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(IN())
mod=1000000007

#+++++

def main():
	#a = int(input())
	#b , c = tin()
	s = list(input())[:-1]
	while True:
		p=''
		pi=-1
		is_exist_st=False
		#pa(s)
		for i, c in enumerate(s):
			if p == 'S' and c == 'T':
				s[pi] = 'e'
				s[i] = 'e'
				#print(s)
				is_exist_st = True
				p=''
				for bj in range(i):
					if s[i-1-bj]!='e':
						p=s[i-1-bj]
						pi=i-1-bj
						break
				
			elif c == 'e':
				pass
			else:
				p=c
				pi=i
		
		if not is_exist_st:
			break	
	return len(s)-s.count('e')
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

### FIXED CODE ###

import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(IN())
mod=1000000007

#+++++

def main():
	#a = int(input())
	#b , c = tin()
	s = list(input())[:-1]

	count_s = 0
	delete_num=0
	for c in s:
		if c == 'S':
			count_s+=1
		else: #if c == 'T':
			if count_s == 0:
				pass
			else:
				count_s-=1
				delete_num+=2
	return len(s)-delete_num
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
### BUGGY CODE ###

from math import ceil
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 10**10
for i in range(N-1):
    ans = min(ans, abs(sum(A[:i+1])-sum(A[i+1:])))
print(ans)

### FIXED CODE ###

from math import ceil
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
Asum = sum(A)
ans = 10**10
x = 0
for i in range(N-1):
    x+=A[i]
    ans = min(ans, abs(Asum-2*x))
print(ans)
### BUGGY CODE ###

import copy
a,b,c=map(int,input().split())
d=[]
for i in range(c):
    i=int(input())
    d.append(i)
d=[i-1 for i in d]
e=[b]*a

for i in d:
    e=[i-1 for i in e]
    e[i]=e[i]+1

for i in e:
    if i>0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

import copy
a,b,c=map(int,input().split())
d=[]
for i in range(c):
    i=int(input())
    d.append(i)
d=[i-1 for i in d]
e=[b]*a

e=[i-len(d) for i in e]
for i in d:
    e[i]+=1
    
for i in e:
    if i>0:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

from bisect import bisect_left,bisect_right

n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
    lim=False
    for j in range(i+1,n):
        MIN=abs(l[i]-l[j])
        MAX=l[i]+l[j]
        min_idx=max(bisect_right(l,MIN),j+1)
        if not lim:
            max_idx=bisect_left(l,MAX)
            if max_idx==n:lim=True
        res=max_idx-min_idx
        if min_idx<=i<=max_idx:res-=1
        if min_idx<=j<=max_idx:res-=1
        cnt+=max(res,0)
print(cnt)

### FIXED CODE ###

from bisect import bisect_left,bisect_right

n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
    lim=False
    for j in range(i+1,n):
        MIN=abs(l[i]-l[j])
        MAX=l[i]+l[j]
        min_idx=max(bisect_right(l,MIN),j+1)
        if not lim:
            max_idx=bisect_left(l,MAX)
            if max_idx==n:lim=True
        res=max_idx-min_idx
        if min_idx<=i<=max_idx:res-=1
        if min_idx<=j<=max_idx:res-=1
        cnt+=max(res,0)
print(cnt)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

mod = 998244353
A, B, C, D = map(int, input().split())

dp = [[0] * (D+1) for _ in range(C+1)]
dp[A][B] = 1
for i in range(A+1, C+1):
    dp[i][B] = dp[i-1][B] * B % mod
for j in range(B, D):
    for i in range(A, C+1):
        x = dp[i][j] * i
        dp[i][j+1] = (dp[i][j+1] + x) % mod
        for k in range(i + 1, C+1):
            dp[k][j+1] = (dp[k][j+1] + x) % mod
            x = x * (j + 1) % mod
print(dp[C][D])



### FIXED CODE ###

import sys
input = sys.stdin.readline

mod = 998244353
A, B, C, D = map(int, input().split())

dp = [[0] * (D+1) for _ in range(C+1)]
dp[A][B] = 1
for i in range(A, C+1):
    if i > A:
        dp[i][B] = dp[i-1][B] * B % mod
    for j in range(B+1, D+1):
        dp[i][j] = dp[i][j-1] * i + dp[i-1][j] * j - dp[i-1][j-1] * (i - 1) * (j - 1)
        dp[i][j] %= mod
print(dp[C][D])
### BUGGY CODE ###

N = int(input())
S = input()

result = 0

for i in range(1000):
    if i < 10:
        temp = "00" + str(i)
    elif i < 100:
        temp = "0" + str(i)
    else:
        temp = str(i)

    cur = 0
    for j in range(N):
        if S[j] == temp[cur]:
            cur += 1
        if cur == 3:
            result += 1
            break

print(result)

### FIXED CODE ###

N = int(input())
S = input()

result = 0

for i in range(1000):
    if i < 10:
        temp = "00" + str(i)
    elif i < 100:
        temp = "0" + str(i)
    else:
        temp = str(i)

    cur = 0
    for j in range(3):
        if temp[j] in S[cur:]:
            cur += S[cur:].index(temp[j]) + 1
            if j == 2:
                result += 1
        else:
            break

print(result)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n,k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
ans = []
chk = 0
for i in range(n-k+1):
  m = sum(p[i:k+i])
  chk = max(chk,m)
  if chk == m:
    ans = [(j+1)/2 for j in p[i:k+i]]
print(sum(ans))

### FIXED CODE ###

def main():  
  import sys
  read = sys.stdin.buffer.read
  readline = sys.stdin.buffer.readline
  readlines = sys.stdin.buffer.readlines
  import numpy as np #pypy不可
  n,k = map(int,readline().split())
  p =  np.array(read().split(),np.int32)
  np.cumsum(p,out=p)
  chk = p[k-1]
  for i in range(n-k):
    c = p[i+k]-p[i]
    chk = max(c,chk)
  print((chk+k)/2)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

matrix = []

visited = set()

for i in range(H):
    matrix.append(list(input()))

visited = set()

for i in range(H):
    for j in range(W):
        if matrix[i][j] == '#' and (i, j) not in visited:
            for ud, lr in ((-1, 0), (1, 0), (0, -1), (0, 1)):
                if not(0 <= i+ud < H and 0 <= j+lr < W)  or matrix[i+ud][j+lr] == '#':
                    continue
                visited.add((i+ud, j+lr))
                matrix[i+ud][j+lr] = '#'

res = 0

while visited:
    res += 1
    buf = set()
    for i, j in visited:
        if matrix[i][j] == '#' and (i, j) not in buf:
            for ud, lr in ((-1, 0), (1, 0), (0, -1), (0, 1)):
                if not(0 <= i+ud < H and 0 <= j+lr < W)  or matrix[i+ud][j+lr] == '#':
                    continue
                buf.add((i+ud, j+lr))
                matrix[i+ud][j+lr] = '#'
    if not buf:
        break
    visited = buf

print(res)



### FIXED CODE ###

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

matrix = []

visited = set()

for i in range(H):
    matrix.append(list(input()))

visited = set()

for i in range(H):
    for j in range(W):
        if matrix[i][j] == '#' and (i, j) not in visited:
            for ud, lr in ((-1, 0), (1, 0), (0, -1), (0, 1)):
                if not(0 <= i+ud < H and 0 <= j+lr < W)  or matrix[i+ud][j+lr] == '#':
                    continue
                visited.add((i+ud, j+lr))
                matrix[i+ud][j+lr] = '#'

res = 0

while visited:
    res += 1
    buf = set()
    for i, j in visited:
        if matrix[i][j] == '#' and (i, j) not in buf:
            for ud, lr in ((-1, 0), (1, 0), (0, -1), (0, 1)):
                if not(0 <= i+ud < H and 0 <= j+lr < W)  or matrix[i+ud][j+lr] == '#':
                    continue
                buf.add((i+ud, j+lr))
                matrix[i+ud][j+lr] = '#'
    if not buf:
        break
    visited = buf

print(res)
### BUGGY CODE ###

from itertools import chain
from collections import defaultdict
 
N = int(input())
T = tuple(map(int,input().split()))
V = tuple(map(int,input().split()))
 
dp = {0:0}
 
for t,v_max in zip(T,V):
 
  ndp = dict()
  
  def it():
    for vf in range(2*v_max+1):
      vf /= 2
      def it():
        for vi,d in dp.items():
          if abs(vf-vi) > t or vi > v_max:
            continue
          vp = (t+vi+vf)/2
          yield d + (2*vp*vp-vf*vf-vi*vi)/2 - max(0,vp-v_max)**2
      yield (vf,max(it(),default=-float('inf')))
  
  dp = dict(it())
 
print(dp[0])

### FIXED CODE ###

from itertools import chain
 
double = lambda c: int(c)*2
 
N = int(input())
T = tuple(map(double,input().split()))
V = tuple(map(double,input().split()))
 
dp = [0]
 
for t,v_max,vf_max in zip(T,V,chain(V[1:],(0,))):

  ndp = [None]*(min(vf_max,v_max)+1)
  
  for vf in range(len(ndp)):
    vi = min(len(dp)-1,vf+t)
    while vi >= 0 and dp[vi] is None:
      vi -= 1

    if vi < max(0,vf-t):
      ndp[vf] = None
    else:
      vp = (vf+t+vi)/2
      ndp[vf] = dp[vi] + 2*vp*vp-vf*vf-vi*vi - 2*max(0,vp-v_max)**2
  dp = ndp
 
print(dp[0]/8)
### BUGGY CODE ###

n = int(input())
t_a = [tuple(map(int, input().split(" "))) for _ in range(n)]

now_t, now_a = 1, 1
for t_i, a_i in t_a:
	count = 1
	while t_i*count < now_t or a_i*count < now_a:
		count += 1
	now_t = t_i*count
	now_a = a_i*count

print(now_t + now_a)

### FIXED CODE ###

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

n_t, n_a = 1, 1
for t, a in TA:
    # print(n_t/t, n_a/a)
    v = max(-(-n_t//t), -(-n_a//a))
    n_t, n_a = t*v, a*v

print(n_t+n_a)
### BUGGY CODE ###

import sys
n = int(input())
a = list(map(int, input().split()))
mina =  100000000000000
for i in range(1, n):
    mina = min(mina, abs(sum(a[:i]) - sum(a[i:])))
print(mina)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
x = a[0]
y = sum(a[1:])
mina = abs(x - y)
for i in range(1, n - 1):
    x += a[i]
    y -= a[i]
    mina = min(mina, abs(x - y))
print(mina)
### BUGGY CODE ###

import copy
import bisect
N = int(input())
L = sorted(list(map(int,input().split())))
count = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        ma = bisect.bisect_right(L[j+1:], L[i] + L[j] -1)
        if ma >= 0:
            count += ma
print(count)



### FIXED CODE ###


import bisect
N = int(input())
L = list(map(int,input().split()))
count = 0
L.sort()
for i in range(N-2):
    for j in range(i+1,N-1):
        count += bisect.bisect(L,L[i]+L[j]-1)-j-1
print(count)
### BUGGY CODE ###

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

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
s=sum(a)
ans=0
for i in range(n-1):
  s-=a[i]
  ans+=a[i]*s
  if ans>(10**9+7):
    ans=ans%(10**9+7)
print(ans)
### BUGGY CODE ###

S=input()
l=[0 for x in range(len(list(S)))]
for i in range(len(list(S))):
    p_i=i
    p_l=[]
    for j in range(10**6):
        if S[p_i]=="R":
            p_i+=1
        elif S[p_i]=="L":
            p_i-=1
    l[p_i]+=1

print(*l)

### FIXED CODE ###

s=input()
s="L"+s+"R"
N=len(s)
a=[1]*N
for i in range(1,N-1):
    if s[i]=="R" and s[i+1]=="R":
        a[i+2]+=a[i]
        a[i]=0
for i in range(N-1,1,-1):
    if s[i]=="L" and s[i-1]=="L":
        a[i-2]+=a[i]
        a[i]=0
print(*a[1:-1])
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]
C =[]
for i in A:
    count = 0
    for j in A:
        if i == j:
            count += 1
        if count == 2:
            C.append('NO')
        else:
            C.append('YES')
if 'NO' in C :
    print('NO')
else:
    print('YES')

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
B = sorted(A)
NO = False
for i in range(0,len(B)-1):
    if B[i+1] - B[i] == 0:
        NO = True
if NO == True:
    print('NO')
else:
    print('YES')
### BUGGY CODE ###

import numpy as np
H,W=map(int,input().split())
S=[]
for i in range(H):
    s=input()
    s1=[]
    for j in range(W):
        if s[j]=='.':
            s1+=[1]
        else:
            s1+=[0]
    S+=[s1]
S=np.array(S)

T1=[]
for i in range(H):
    s=S[i]
    t2=s[0]
    if t2==1:
        t1=1
    else:
        t1=0
    t=[]
    k=0
    for j in range(1,W):
        if s[j]==t2:
            if t2==1:
                t1+=1
        else:
            t2=s[j]
            t+=[t1]*(j-k)
            k=j
            if t2==1:
                t1=1
            else:
                t1=0
    else:
        t+=[t1]*(W-k)
    T1+=[t]
T1=np.array(T1)


T2=[]
for i in range(W):
    s=S.T[i]
    t2=s[0]
    if t2==1:
        t1=1
    else:
        t1=0
    t=[]
    k=0
    for j in range(1,H):
        if s[j]==t2:
            if t2==1:
                t1+=1
        else:
            t2=s[j]
            t+=[t1]*(j-k)
            k=j
            if t2==1:
                t1=1
            else:
                t1=0
    else:
        t+=[t1]*(H-k)
    T2+=[t]
T2=np.array(T2).T

print(np.max(T1+T2)-1)

### FIXED CODE ###

import numpy as np
H,W=map(int,input().split())
S=[]
for i in range(H):
    s=input()
    s1=[]
    for j in range(W):
        if s[j]=='.':
            s1+=[1]
        else:
            s1+=[0]
    S+=[s1]
S=np.array(S)

Tl=np.zeros((H,W),dtype=np.int)
Tr=np.zeros((H,W),dtype=np.int)

Tu=np.zeros((H,W),dtype=np.int)
Td=np.zeros((H,W),dtype=np.int)
for i in range(1,W):
    Tl[:,i]+=(Tl[:,i-1]+1)*S[:,i-1]

for i in range(W-2,-1,-1):
    Tr[:,i]+=(Tr[:,i+1]+1)*S[:,i+1]

for i in range(1,H):
    Tu[i,:]+=(Tu[i-1,:]+1)*S[i-1,:]

for i in range(H-2,-1,-1):
    Td[i,:]+=(Td[i+1,:]+1)*S[i+1,:]

print(((Tl+Tr+Tu+Td)*S).max()+1)